Skip to content

Commit

Permalink
changed extract path in native loader to contain version
Browse files Browse the repository at this point in the history
  • Loading branch information
redrezo committed Jul 27, 2020
1 parent a4e35f5 commit f7ecd6f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
5 changes: 5 additions & 0 deletions org.eclipse.fx.drift.java11/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ plugins {
id 'eclipse'
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}


eclipse {
project {
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.fx.drift.java8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ plugins {
id 'eclipse'
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}


eclipse {
project {
Expand Down
6 changes: 6 additions & 0 deletions org.eclipse.fx.drift/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ plugins {
id 'eclipse'
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}


eclipse {
project {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

public class NativeLoader {

private static final boolean USE_JAVA_LIBRARY_PATH = Boolean.getBoolean("driftfx.use.java.library.path");


private static String OS = null;

public static String getOsName() {
Expand All @@ -32,10 +35,9 @@ public static boolean isMacOs() {

/*package*/ static boolean osgi = false;

private static boolean useJavaLibraryPath = Boolean.getBoolean("driftfx.use.java.library.path");


public static void loadLibrary(Class<?> context, String libname) {
if (useJavaLibraryPath || osgi) {
if (USE_JAVA_LIBRARY_PATH || osgi) {
// osgi will take care of it
System.loadLibrary(libname);
}
Expand All @@ -44,11 +46,11 @@ public static void loadLibrary(Class<?> context, String libname) {

String filename = getFilename(libname);
Path tmpDir = Paths.get(System.getProperty("java.io.tmpdir"));
Path extractPath = tmpDir.resolve("driftfx").resolve(filename);
Path extractPath = tmpDir.resolve("driftfx").resolve(Versioning.getVersion()).resolve(filename);

String resourceName = "/native/" + filename;
URL url = context.getResource(resourceName);
System.err.println("Resource Lookup: name: " + resourceName + ", context: " + context + " => " + url);
Log.debug("Resource Lookup: name: " + resourceName + ", context: " + context + " => " + url);

try (InputStream in = context.getResourceAsStream("/native/" + filename)) {
extract(in, extractPath);
Expand Down
19 changes: 10 additions & 9 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
rootProject.name = 'driftfx'

include 'native'
include 'native:driftfx'
include 'native:driftcpp'

include 'org.eclipse.fx.drift'
include 'org.eclipse.fx.drift.java8'
include 'org.eclipse.fx.drift.java11'
rootProject.name = 'driftfx-root'

include 'native'
include 'native:driftfx'
include 'native:driftcpp'

include 'org.eclipse.fx.drift'
include 'org.eclipse.fx.drift.java8'
include 'org.eclipse.fx.drift.java11'

0 comments on commit f7ecd6f

Please sign in to comment.