Skip to content

Commit 06a5f67

Browse files
author
Isaac Brodsky
authored
Fix paths to Windows resources (#109)
* Fix paths to Windows resources * Add PR number * Put cross compile assertions in their own file
1 parent e2c5044 commit 06a5f67

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The public API of this library consists of the public functions declared in
66
file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support
77
for the Linux x64 and Darwin x64 platforms.
88

9+
## Unreleased Changes
10+
### Fixed
11+
- Fixed the path to Windows resources. (#109)
12+
913
## [4.0.0] - 2022-08-23
1014
### Breaking Changes
1115
- Upgraded the core library to v4.0.0. (#104, #103, #102, #91)

src/main/c/h3-java/build-h3.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux
181181
# Copy the built artifact into the source tree so it can be included in the
182182
# built JAR.
183183
OUTPUT_ROOT=src/main/resources/$image
184-
if [ "$image" -eq "windows-static-x64" ]; then
184+
if [ "$image" = "windows-static-x64" ]; then
185185
OUTPUT_ROOT=src/main/resources/windows-x64
186186
fi
187-
if [ "$image" -eq "windows-static-x86" ]; then
187+
if [ "$image" = "windows-static-x86" ]; then
188188
OUTPUT_ROOT=src/main/resources/windows-x86
189189
fi
190190
mkdir -p $OUTPUT_ROOT
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2022 Uber Technologies, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.uber.h3core;
17+
18+
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assume.assumeTrue;
20+
21+
import com.google.common.collect.ImmutableList;
22+
import java.io.IOException;
23+
import java.util.List;
24+
import org.junit.BeforeClass;
25+
import org.junit.Test;
26+
27+
/**
28+
* Test that particular resource names exist in the built artifact when cross compiling. Although we
29+
* cannot test that those resources run correctly (since they can't be loaded), we can at least test
30+
* that the cross compiler put resources in the right locations. This test is only run if the system
31+
* property <code>h3.use.docker</code> has the value <code>true</code>.
32+
*/
33+
public class TestH3CoreCrossCompile {
34+
@BeforeClass
35+
public static void assumptions() {
36+
assumeTrue(
37+
"Docker cross compilation enabled", "true".equals(System.getProperty("h3.use.docker")));
38+
}
39+
40+
@Test
41+
public void testResourcesExist() throws IOException {
42+
List<String> resources =
43+
ImmutableList.of(
44+
"/linux-x64/libh3-java.so",
45+
"/linux-x86/libh3-java.so",
46+
"/linux-arm64/libh3-java.so",
47+
"/linux-armv5/libh3-java.so",
48+
"/linux-armv7/libh3-java.so",
49+
"/linux-ppc64le/libh3-java.so",
50+
"/linux-s390x/libh3-java.so",
51+
"/windows-x64/libh3-java.dll",
52+
"/windows-x86/libh3-java.dll",
53+
"/darwin-x64/libh3-java.dylib",
54+
"/darwin-arm/libh3-java.dylib",
55+
"/freebsd-x64/libh3-java.so",
56+
"/android-arm/libh3-java.so",
57+
"/android-arm64/libh3-java.so");
58+
for (String name : resources) {
59+
assertNotNull(name + " is an included resource", H3CoreLoader.class.getResource(name));
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)