Skip to content

Commit

Permalink
Fix paths to Windows resources (#109)
Browse files Browse the repository at this point in the history
* Fix paths to Windows resources

* Add PR number

* Put cross compile assertions in their own file
  • Loading branch information
Isaac Brodsky authored Sep 14, 2022
1 parent e2c5044 commit 06a5f67
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/main/c/h3-java/build-h3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 62 additions & 0 deletions src/test/java/com/uber/h3core/TestH3CoreCrossCompile.java
Original file line number Diff line number Diff line change
@@ -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 <code>h3.use.docker</code> has the value <code>true</code>.
*/
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<String> 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));
}
}
}

0 comments on commit 06a5f67

Please sign in to comment.