mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Merge branch 'jnotify-multiarch' into 'master'
Upgrade jnotify to 0.94 to support 64-bit
This upgrades to 0.94 and selects the correct native lib via ${os.arch}. The binaries are from the jnotify sourceforge download page, you can verify them. Also patched up build.xml to display stack trace when exceptions are thrown inside a test.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<classpathentry kind="lib" path="libs/bluecove-2.1.1-SNAPSHOT-briar.jar"/>
|
||||
<classpathentry kind="lib" path="libs/bluecove-gpl-2.1.1-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="libs/jna-3.5.2-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="libs/jnotify-0.93.jar"/>
|
||||
<classpathentry kind="lib" path="libs/jnotify-0.94.jar"/>
|
||||
<classpathentry kind="lib" path="libs/jssc-0.9-briar.jar" sourcepath="libs/source/jssc-0.9-briar-source.jar"/>
|
||||
<classpathentry kind="lib" path="libs/platform-3.5.2-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
|
||||
Binary file not shown.
BIN
briar-desktop/libs/jnotify-0.94.jar
Normal file
BIN
briar-desktop/libs/jnotify-0.94.jar
Normal file
Binary file not shown.
BIN
briar-desktop/libs/jnotify-x86.dll
Normal file
BIN
briar-desktop/libs/jnotify-x86.dll
Normal file
Binary file not shown.
BIN
briar-desktop/libs/jnotify-x86_64.dll
Normal file
BIN
briar-desktop/libs/jnotify-x86_64.dll
Normal file
Binary file not shown.
BIN
briar-desktop/libs/libjnotify-amd64.so
Normal file
BIN
briar-desktop/libs/libjnotify-amd64.so
Normal file
Binary file not shown.
BIN
briar-desktop/libs/libjnotify-i386.so
Normal file
BIN
briar-desktop/libs/libjnotify-i386.so
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,36 @@ JNotifyListener {
|
||||
|
||||
protected abstract String[] getPathsToWatch();
|
||||
|
||||
private static boolean triedLoad = false;
|
||||
private static Throwable loadError = null;
|
||||
|
||||
private static Throwable tryLoad() {
|
||||
try {
|
||||
Class.forName("net.contentobjects.jnotify.JNotify");
|
||||
return null;
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
return e;
|
||||
} catch (ClassNotFoundException e) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void checkEnabled() throws IOException {
|
||||
if (!triedLoad) {
|
||||
loadError = tryLoad();
|
||||
triedLoad = true;
|
||||
}
|
||||
if (loadError != null) {
|
||||
// gymnastics due to having to support earlier Android APIs
|
||||
// TODO(infinity0): add a utility that does this and convert other exceptions too
|
||||
IOException e = new IOException("JNotify not loaded");
|
||||
e.initCause(loadError);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void start(Callback callback) throws IOException {
|
||||
checkEnabled();
|
||||
List<Integer> watches = new ArrayList<Integer>();
|
||||
int mask = JNotify.FILE_CREATED;
|
||||
for(String path : getPathsToWatch()) {
|
||||
@@ -36,6 +65,7 @@ JNotifyListener {
|
||||
}
|
||||
|
||||
public void stop() throws IOException {
|
||||
checkEnabled();
|
||||
List<Integer> watches;
|
||||
synchronized(this) {
|
||||
assert started;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/briar-core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/briar-desktop"/>
|
||||
<classpathentry kind="lib" path="/briar-api/libs/guice-3.0-no_aop.jar"/>
|
||||
<classpathentry kind="lib" path="/briar-desktop/libs/jnotify-0.93.jar"/>
|
||||
<classpathentry kind="lib" path="/briar-desktop/libs/jnotify-0.94.jar"/>
|
||||
<classpathentry kind="lib" path="/briar-desktop/libs/jssc-0.9-briar.jar" sourcepath="/briar-desktop/libs/source/jssc-0.9-briar-source.jar"/>
|
||||
<classpathentry kind="lib" path="libs/hamcrest-core-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="libs/hamcrest-library-1.1.jar"/>
|
||||
|
||||
@@ -76,10 +76,11 @@
|
||||
</javac>
|
||||
</target>
|
||||
<target name='test' depends='compile'>
|
||||
<junit printsummary='on' fork='yes' forkmode='once'>
|
||||
<junit printsummary='on' fork='yes' forkmode='once' haltonfailure='yes' showoutput='true'>
|
||||
<assertions>
|
||||
<enable/>
|
||||
</assertions>
|
||||
<formatter type="plain" usefile="false"/>
|
||||
<classpath>
|
||||
<fileset refid='test-jars'/>
|
||||
<fileset refid='desktop-jars'/>
|
||||
@@ -90,7 +91,7 @@
|
||||
<path refid='core-classes'/>
|
||||
<path refid='api-classes'/>
|
||||
</classpath>
|
||||
<jvmarg value='-Djava.library.path=../briar-desktop/libs'/>
|
||||
<sysproperty key='java.library.path' value='../briar-desktop/libs'/>
|
||||
<test name='org.briarproject.LockFairnessTest'/>
|
||||
<test name='org.briarproject.ProtocolIntegrationTest'/>
|
||||
<test name='org.briarproject.crypto.FortunaGeneratorTest'/>
|
||||
@@ -153,7 +154,7 @@
|
||||
<path refid='core-classes'/>
|
||||
<path refid='api-classes'/>
|
||||
</classpath>
|
||||
<jvmarg value='-Djava.library.path=../briar-desktop/libs'/>
|
||||
<sysproperty key='java.library.path' value='../briar-desktop/libs'/>
|
||||
<test name='org.briarproject.db.H2DatabaseTest'/>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
@@ -82,7 +82,8 @@ public class UnixRemovableDriveMonitorTest extends BriarTestCase {
|
||||
TestUtils.deleteTestDirectory(testDir);
|
||||
}
|
||||
|
||||
private RemovableDriveMonitor createMonitor(final File dir) {
|
||||
private RemovableDriveMonitor createMonitor(final File dir) throws IOException {
|
||||
UnixRemovableDriveMonitor.checkEnabled();
|
||||
return new UnixRemovableDriveMonitor() {
|
||||
@Override
|
||||
protected String[] getPathsToWatch() {
|
||||
|
||||
113
jnotify-0.94.patch
Normal file
113
jnotify-0.94.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
briar-desktop/libs/jnotify-0.94.jar is built via:
|
||||
$ wget "http://downloads.sourceforge.net/project/jnotify/jnotify/jnotify-0.94/jnotify-lib-0.94.zip?r=&ts=$(date +%s)"
|
||||
$ unzip -d jnotify-lib-0.94 jnotify-lib-0.94.zip && cd jnotify-lib-0.94
|
||||
$ unzip -d src jnotify-0.94-src.zip
|
||||
$ wget -O build.xml "http://jnotify.cvs.sourceforge.net/viewvc/jnotify/jnotify/build.xml?revision=1.7&pathrev=HEAD"
|
||||
$ wget -O build.properties "http://jnotify.cvs.sourceforge.net/viewvc/jnotify/jnotify/build.properties?revision=1.13"
|
||||
$ patch -lp1 < /path/to/this/patch
|
||||
$ ant build_java # if this fails with invalid flag: -g:{lines,vars,source}, try removing the debug attributes from <javac>
|
||||
|
||||
diff -ru jnotify-0.94/net/contentobjects/jnotify/linux/JNotify_linux.java jnotify-0.94-briar/net/contentobjects/jnotify/linux/JNotify_linux.java
|
||||
--- jnotify-0.94/net/contentobjects/jnotify/linux/JNotify_linux.java 2012-04-25 00:03:54.000000000 +0100
|
||||
+++ jnotify-0.94-briar/net/contentobjects/jnotify/linux/JNotify_linux.java 2014-01-30 12:31:41.959082350 +0000
|
||||
@@ -37,6 +37,7 @@
|
||||
package net.contentobjects.jnotify.linux;
|
||||
|
||||
import net.contentobjects.jnotify.JNotifyException;
|
||||
+import net.contentobjects.jnotify.Util;
|
||||
|
||||
public class JNotify_linux
|
||||
{
|
||||
@@ -45,7 +46,7 @@
|
||||
|
||||
static
|
||||
{
|
||||
- System.loadLibrary("jnotify");
|
||||
+ Util.loadNative();
|
||||
int res = nativeInit();
|
||||
if (res != 0)
|
||||
{
|
||||
diff -ru jnotify-0.94/net/contentobjects/jnotify/macosx/JNotify_macosx.java jnotify-0.94-briar/net/contentobjects/jnotify/macosx/JNotify_macosx.java
|
||||
--- jnotify-0.94/net/contentobjects/jnotify/macosx/JNotify_macosx.java 2010-01-26 19:43:42.000000000 +0000
|
||||
+++ jnotify-0.94-briar/net/contentobjects/jnotify/macosx/JNotify_macosx.java 2014-01-30 12:31:41.959082350 +0000
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.contentobjects.jnotify.macosx;
|
||||
|
||||
import net.contentobjects.jnotify.JNotifyException;
|
||||
+import net.contentobjects.jnotify.Util;
|
||||
|
||||
public class JNotify_macosx
|
||||
{
|
||||
@@ -10,7 +11,7 @@
|
||||
|
||||
static
|
||||
{
|
||||
- System.loadLibrary("jnotify"); //$NON-NLS-1$
|
||||
+ Util.loadNative();
|
||||
Thread thread = new Thread("FSEvent thread") //$NON-NLS-1$
|
||||
{
|
||||
public void run()
|
||||
diff -ru jnotify-0.94/net/contentobjects/jnotify/Util.java jnotify-0.94-briar/net/contentobjects/jnotify/Util.java
|
||||
--- jnotify-0.94/net/contentobjects/jnotify/Util.java 2006-02-14 08:18:10.000000000 +0000
|
||||
+++ jnotify-0.94-briar/net/contentobjects/jnotify/Util.java 2014-01-30 12:31:41.959082350 +0000
|
||||
@@ -30,4 +30,26 @@
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public static void loadNative() throws UnsatisfiedLinkError {
|
||||
+ try
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ System.loadLibrary("jnotify");
|
||||
+ }
|
||||
+ catch (UnsatisfiedLinkError e) {
|
||||
+ System.loadLibrary("jnotify-" + System.getProperty("os.arch"));
|
||||
+ }
|
||||
+ }
|
||||
+ catch (UnsatisfiedLinkError e)
|
||||
+ {
|
||||
+ // add some extra debugging info
|
||||
+ String msg = "Error loading library, os.arch=" + System.getProperty("os.arch") +
|
||||
+ ", java.library.path=" + System.getProperty("java.library.path");
|
||||
+ UnsatisfiedLinkError e2 = new UnsatisfiedLinkError(msg);
|
||||
+ e2.initCause(e);
|
||||
+ throw e2;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff -ru jnotify-0.94/net/contentobjects/jnotify/win32/JNotify_win32.java jnotify-0.94-briar/net/contentobjects/jnotify/win32/JNotify_win32.java
|
||||
--- jnotify-0.94/net/contentobjects/jnotify/win32/JNotify_win32.java 2012-04-25 00:04:50.000000000 +0100
|
||||
+++ jnotify-0.94-briar/net/contentobjects/jnotify/win32/JNotify_win32.java 2014-01-30 12:31:41.959082350 +0000
|
||||
@@ -39,28 +39,13 @@
|
||||
package net.contentobjects.jnotify.win32;
|
||||
|
||||
import net.contentobjects.jnotify.JNotifyException;
|
||||
-
|
||||
+import net.contentobjects.jnotify.Util;
|
||||
|
||||
public class JNotify_win32
|
||||
{
|
||||
static
|
||||
{
|
||||
- try
|
||||
- {
|
||||
- if (System.getProperty("os.arch").equals("amd64"))
|
||||
- {
|
||||
- System.loadLibrary("jnotify_64bit");
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- System.loadLibrary("jnotify");
|
||||
- }
|
||||
- }
|
||||
- catch (UnsatisfiedLinkError e)
|
||||
- {
|
||||
- System.err.println("Error loading library, java.library.path=" + System.getProperty("java.library.path"));
|
||||
- throw e;
|
||||
- }
|
||||
+ Util.loadNative();
|
||||
int res = nativeInit();
|
||||
if (res != 0)
|
||||
{
|
||||
Reference in New Issue
Block a user