diff --git a/CHANGELOG.md b/CHANGELOG.md index 4364aff..f70f5d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The public API of this library consists of the public functions declared in file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support for the Linux x64 and Darwin x64 platforms. +## Unreleased Changes +### Fixed +- Fixed the path to Windows resources. (#109) + ## [4.0.0] - 2022-08-23 ### Breaking Changes - Upgraded the core library to v4.0.0. (#104, #103, #102, #91) diff --git a/src/main/c/h3-java/build-h3.sh b/src/main/c/h3-java/build-h3.sh index 3cb6e8a..2f9fd93 100755 --- a/src/main/c/h3-java/build-h3.sh +++ b/src/main/c/h3-java/build-h3.sh @@ -181,10 +181,10 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux # Copy the built artifact into the source tree so it can be included in the # built JAR. OUTPUT_ROOT=src/main/resources/$image - if [ "$image" -eq "windows-static-x64" ]; then + if [ "$image" = "windows-static-x64" ]; then OUTPUT_ROOT=src/main/resources/windows-x64 fi - if [ "$image" -eq "windows-static-x86" ]; then + if [ "$image" = "windows-static-x86" ]; then OUTPUT_ROOT=src/main/resources/windows-x86 fi mkdir -p $OUTPUT_ROOT diff --git a/src/test/java/com/uber/h3core/TestH3CoreCrossCompile.java b/src/test/java/com/uber/h3core/TestH3CoreCrossCompile.java new file mode 100644 index 0000000..1868ec0 --- /dev/null +++ b/src/test/java/com/uber/h3core/TestH3CoreCrossCompile.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.uber.h3core; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assume.assumeTrue; + +import com.google.common.collect.ImmutableList; +import java.io.IOException; +import java.util.List; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Test that particular resource names exist in the built artifact when cross compiling. Although we + * cannot test that those resources run correctly (since they can't be loaded), we can at least test + * that the cross compiler put resources in the right locations. This test is only run if the system + * property h3.use.docker has the value true. + */ +public class TestH3CoreCrossCompile { + @BeforeClass + public static void assumptions() { + assumeTrue( + "Docker cross compilation enabled", "true".equals(System.getProperty("h3.use.docker"))); + } + + @Test + public void testResourcesExist() throws IOException { + List resources = + ImmutableList.of( + "/linux-x64/libh3-java.so", + "/linux-x86/libh3-java.so", + "/linux-arm64/libh3-java.so", + "/linux-armv5/libh3-java.so", + "/linux-armv7/libh3-java.so", + "/linux-ppc64le/libh3-java.so", + "/linux-s390x/libh3-java.so", + "/windows-x64/libh3-java.dll", + "/windows-x86/libh3-java.dll", + "/darwin-x64/libh3-java.dylib", + "/darwin-arm/libh3-java.dylib", + "/freebsd-x64/libh3-java.so", + "/android-arm/libh3-java.so", + "/android-arm64/libh3-java.so"); + for (String name : resources) { + assertNotNull(name + " is an included resource", H3CoreLoader.class.getResource(name)); + } + } +}