Skip to content

Commit ce7cf3f

Browse files
authored
set Java cross compile target to Java 8 (#53)
* java cross compile * loosen up distribution req * use 17 in ci * ditto * add back distribution: "temurin" * downgrade to java 8
1 parent bd17fe6 commit ce7cf3f

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
toolchain: stable
2121
components: rustfmt, clippy
2222

23-
- name: Set up JDK 11
23+
- name: Set up JDK 17
2424
uses: actions/setup-java@v2
2525
with:
26-
java-version: "11"
26+
java-version: "17"
2727
distribution: "temurin"
2828

2929
- name: Validate Gradle wrapper
@@ -66,10 +66,10 @@ jobs:
6666
steps:
6767
- uses: actions/checkout@v2
6868

69-
- name: Set up JDK 11
69+
- name: Set up JDK 17
7070
uses: actions/setup-java@v2
7171
with:
72-
java-version: 11
72+
java-version: 17
7373
distribution: "temurin"
7474

7575
- name: Validate Gradle wrapper

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
toolchain: stable
2121
components: rustfmt, clippy
2222

23-
- name: Set up JDK 11
23+
- name: Set up JDK 17
2424
uses: actions/setup-java@v2
2525
with:
26-
java-version: "11"
26+
java-version: "17"
2727
distribution: "temurin"
2828

2929
- name: Validate Gradle wrapper
@@ -66,10 +66,10 @@ jobs:
6666
steps:
6767
- uses: actions/checkout@v2
6868

69-
- name: Set up JDK 11
69+
- name: Set up JDK 17
7070
uses: actions/setup-java@v2
7171
with:
72-
java-version: 11
72+
java-version: 17
7373
distribution: "temurin"
7474

7575
- name: Validate Gradle wrapper

buildSrc/src/main/groovy/datafusion.java-conventions.gradle

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ repositories {
1111

1212
java {
1313
toolchain {
14-
languageVersion = JavaLanguageVersion.of(11)
14+
languageVersion = JavaLanguageVersion.of(15)
1515
}
1616
}
17+
18+
tasks.withType(JavaCompile) {
19+
// down-compile to minimal version
20+
options.release.set(8)
21+
}

datafusion-java/src/main/java/org/apache/arrow/datafusion/JNILoader.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.io.FileOutputStream;
55
import java.io.IOException;
66
import java.io.InputStream;
7-
import java.util.Map;
87
import java.util.concurrent.atomic.AtomicBoolean;
98
import org.slf4j.Logger;
109
import org.slf4j.LoggerFactory;
@@ -23,8 +22,6 @@ private enum OsName {
2322
Linux
2423
}
2524

26-
private static final Map<OsName, String> OS_NAME_STRING_MAP =
27-
Map.of(OsName.Linux, "so", OsName.Osx, "dylib", OsName.Windows, "dll");
2825
private static final String libraryName = "datafusion_jni";
2926

3027
private static final String ERROR_MSG =
@@ -49,7 +46,15 @@ private static String getResourceName() {
4946
}
5047

5148
private static String getExtension() {
52-
return OS_NAME_STRING_MAP.get(getOsName());
49+
OsName osName = getOsName();
50+
if (osName == OsName.Linux) {
51+
return "so";
52+
} else if (osName == OsName.Osx) {
53+
return "dylib";
54+
} else if (osName == OsName.Windows) {
55+
return "dll";
56+
}
57+
throw new IllegalStateException("Cannot determin extension for " + osName);
5358
}
5459

5560
static synchronized void load() {

0 commit comments

Comments
 (0)