Commit 010ef4ca authored by Andrew Twyman's avatar Andrew Twyman

Merge pull request #167 from j4cbo/java7

Support lib: target Java 7, not 8
parents e8b12be1 bc1ed3a1
...@@ -21,6 +21,7 @@ import java.io.IOException; ...@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystem; import java.nio.file.FileSystem;
import java.nio.file.FileSystems; import java.nio.file.FileSystems;
import java.nio.file.Files; import java.nio.file.Files;
...@@ -30,7 +31,6 @@ import java.nio.file.StandardCopyOption; ...@@ -30,7 +31,6 @@ import java.nio.file.StandardCopyOption;
import java.util.Collections; import java.util.Collections;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.stream.Stream;
/** /**
* Utilities for loading native libraries containing djinni interfaces * Utilities for loading native libraries containing djinni interfaces
...@@ -88,14 +88,11 @@ public class NativeLibLoader { ...@@ -88,14 +88,11 @@ public class NativeLibLoader {
if (!localFile.exists()) { return; } if (!localFile.exists()) { return; }
if (localFile.isDirectory()) { if (localFile.isDirectory()) {
log.log(Level.FINE, "Loading all libs in " + localFile.getAbsolutePath()); log.log(Level.FINE, "Loading all libs in " + localFile.getAbsolutePath());
Stream<Path> streamPaths = Files.walk(localFile.toPath(), 1); for (File f : localFile.listFiles()) {
for (Path p : (Iterable<Path>)streamPaths::iterator) {
File f = p.toFile();
if (f.isFile()) { if (f.isFile()) {
loadLibrary(f.getAbsolutePath()); loadLibrary(f.getAbsolutePath());
} }
} }
streamPaths.close();
} else { } else {
loadLibrary(localFile.getAbsolutePath()); loadLibrary(localFile.getAbsolutePath());
} }
...@@ -119,11 +116,17 @@ public class NativeLibLoader { ...@@ -119,11 +116,17 @@ public class NativeLibLoader {
// Walk the directory and load libs // Walk the directory and load libs
FileSystem fs = FileSystem fs =
FileSystems.newFileSystem(libsURL.toURI(), Collections.emptyMap()); FileSystems.newFileSystem(libsURL.toURI(), Collections.<String, String>emptyMap());
Path myPath = fs.getPath(jarPath); Path myPath = fs.getPath(jarPath);
for (Path p : (Iterable<Path>)Files.walk(myPath, 1)::iterator) {
DirectoryStream<Path> directoryStream = Files.newDirectoryStream(myPath);
try {
for (Path p : directoryStream) {
loadLibFromJarPath(p); loadLibFromJarPath(p);
} }
} finally {
directoryStream.close();
}
fs.close(); fs.close();
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<arg value="install"/> <arg value="install"/>
</exec> </exec>
<mkdir dir="build/classes"/> <mkdir dir="build/classes"/>
<javac destdir="build/classes" includeantruntime="false" encoding="UTF-8" debug="on"> <javac destdir="build/classes" includeantruntime="false" encoding="UTF-8" debug="on" target="1.7" source="1.7">
<classpath> <classpath>
<fileset dir="../../deps/java/"><include name="*.jar"/></fileset> <fileset dir="../../deps/java/"><include name="*.jar"/></fileset>
<fileset dir="../../deps/java/test"><include name="*.jar"/></fileset> <fileset dir="../../deps/java/test"><include name="*.jar"/></fileset>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment