]> sigrok.org Git - libsigrok.git/commitdiff
Java: Move interfaces into org.sigrok.core.interfaces, tidy build system.
authorMartin Ling <redacted>
Sat, 26 Jul 2014 18:11:11 +0000 (19:11 +0100)
committerMartin Ling <redacted>
Sat, 26 Jul 2014 19:41:08 +0000 (20:41 +0100)
Makefile.am
bindings/java/org/sigrok/core/classes/DatafeedCallback.java [deleted file]
bindings/java/org/sigrok/core/classes/LogCallback.java [deleted file]
bindings/java/org/sigrok/core/classes/SourceCallback.java [deleted file]
bindings/java/org/sigrok/core/classes/classes.i
bindings/java/org/sigrok/core/interfaces/DatafeedCallback.java [new file with mode: 0644]
bindings/java/org/sigrok/core/interfaces/LogCallback.java [new file with mode: 0644]
bindings/java/org/sigrok/core/interfaces/SourceCallback.java [new file with mode: 0644]

index 1168bf2074c1246584a702155d433766cb4e2910..e81ead05c931479910f9b615a9d92c3bc948cfac 100644 (file)
@@ -464,28 +464,29 @@ endif
 if BINDINGS_JAVA
 
 JDIR = bindings/java
-JPKG = org/sigrok/core/classes
-JINT = $(JDIR)/$(JPKG)/classes.i
-JSRC = $(JDIR)/$(JPKG)/classes_wrap.cxx
+JPKG = org/sigrok/core
+JCLS = $(JDIR)/$(JPKG)/classes
+JINT = $(JDIR)/$(JPKG)/interfaces
+JSRC = $(JCLS)/*.java $(JINT)/*.java
+JSWG = $(JCLS)/classes.i
+JCXX = $(JCLS)/classes_wrap.cxx
 JLIB = $(JDIR)/libsigrok_java_core_classes.so
 JJAR = $(JDIR)/sigrok-core.jar
 
 java-build: $(JJAR) $(JLIB)
 
-$(JSRC): $(JINT) bindings/swig/classes.i $(library_include_HEADERS)
+$(JCXX): $(JSWG) bindings/swig/classes.i $(library_include_HEADERS)
        $(AM_V_GEN)swig -c++ -java -package org.sigrok.core.classes \
-               -Iinclude -Ibindings/cxx/include \
-               -outdir $(JDIR)/$(JPKG) $(JINT)
+               -Iinclude -Ibindings/cxx/include -outdir $(JCLS) $(JSWG)
 
-$(JJAR): $(JSRC) $(JDIR)/$(JPKG)/*.java
-       $(AM_V_GEN)$(JAVAC) -sourcepath $(JDIR) $(JDIR)/$(JPKG)/*.java
+$(JJAR): $(JCXX)
+       $(AM_V_GEN)$(JAVAC) -sourcepath $(JDIR) $(JSRC)
        $(AM_V_at)jar cf $(JJAR) -C $(JDIR) $(JPKG)
 
-$(JLIB): $(JSRC) bindings/cxx/libsigrokxx.la $(library_include_HEADERS)
+$(JLIB): $(JCXX) bindings/cxx/libsigrokxx.la $(library_include_HEADERS)
        $(AM_V_GEN)$(CXX) $(CXXFLAGS) -L.libs -Lbindings/cxx/.libs \
-               -fno-strict-aliasing -fPIC -shared \
-               $(JDIR)/$(JPKG)/classes_wrap.cxx -lsigrokxx \
-               -o $(JLIB)
+               -fno-strict-aliasing -fPIC -shared $(JCLS)/classes_wrap.cxx \
+               -lsigrokxx -o $(JLIB)
 
 java-install:
        $(INSTALL) -d $(libdir)/jni
@@ -494,8 +495,10 @@ java-install:
        $(INSTALL) $(JJAR) -t $(datadir)/java
 
 java-clean:
-       rm -f $(JSRC)
-       rm -f $(JDIR)/$(JPKG)/*.class
+       rm -f $(JCXX)
+       rm -f $(JCLS)/*.java
+       rm -f $(JCLS)/*.class
+       rm -f $(JINT)/*.class
        rm -f $(JJAR)
        rm -f $(JLIB)
 
diff --git a/bindings/java/org/sigrok/core/classes/DatafeedCallback.java b/bindings/java/org/sigrok/core/classes/DatafeedCallback.java
deleted file mode 100644 (file)
index 82d1171..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.sigrok.core.classes;
-
-public interface DatafeedCallback
-{
-    public void run(Device device, Packet packet);
-}
diff --git a/bindings/java/org/sigrok/core/classes/LogCallback.java b/bindings/java/org/sigrok/core/classes/LogCallback.java
deleted file mode 100644 (file)
index 4a09ab2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.sigrok.core.classes;
-
-public interface LogCallback 
-{
-    public void run(LogLevel loglevel, String message);
-}
diff --git a/bindings/java/org/sigrok/core/classes/SourceCallback.java b/bindings/java/org/sigrok/core/classes/SourceCallback.java
deleted file mode 100644 (file)
index 53f59e3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.sigrok.core.classes;
-
-public interface SourceCallback 
-{
-    public void run(int revents);
-}
index b500dc6b40d1d2d72f5b9b1b80d59bf60c3aa154..5e686dcb079da44c07c59ceb511d2971c0ed01c8 100644 (file)
@@ -7,6 +7,13 @@
   }
 %}
 
+/* Import interfaces. */
+%pragma(java) jniclassimports=%{
+  import org.sigrok.core.interfaces.LogCallback;
+  import org.sigrok.core.interfaces.DatafeedCallback;
+  import org.sigrok.core.interfaces.SourceCallback;
+%}
+
 /* Map Java FileDescriptor objects to int fds */
 %typemap(jni) int fd "jobject"
 %typemap(jtype) int fd "java.io.FileDescriptor"
@@ -210,6 +217,9 @@ MAP_COMMON(const sigrok::ConfigKey *, Glib::VariantBase, ConfigKey, Variant)
 
 /* Support Java log callbacks. */
 
+%typemap(javaimports) sigrok::Context
+  "import org.sigrok.core.interfaces.LogCallback;"
+
 %inline {
 typedef jobject jlogcallback;
 }
@@ -249,6 +259,9 @@ typedef jobject jlogcallback;
 
 /* Support Java datafeed callbacks. */
 
+%typemap(javaimports) sigrok::Session
+  "import org.sigrok.core.interfaces.DatafeedCallback;"
+
 %inline {
 typedef jobject jdatafeedcallback;
 }
@@ -296,6 +309,9 @@ typedef jobject jdatafeedcallback;
 
 /* Support Java event source callbacks. */
 
+%typemap(javaimports) sigrok::EventSource
+  "import org.sigrok.core.interfaces.SourceCallback;"
+
 %inline {
 typedef jobject jsourcecallback;
 }
diff --git a/bindings/java/org/sigrok/core/interfaces/DatafeedCallback.java b/bindings/java/org/sigrok/core/interfaces/DatafeedCallback.java
new file mode 100644 (file)
index 0000000..2c6036a
--- /dev/null
@@ -0,0 +1,9 @@
+package org.sigrok.core.interfaces;
+
+import org.sigrok.core.classes.Device;
+import org.sigrok.core.classes.Packet;
+
+public interface DatafeedCallback
+{
+    public void run(Device device, Packet packet);
+}
diff --git a/bindings/java/org/sigrok/core/interfaces/LogCallback.java b/bindings/java/org/sigrok/core/interfaces/LogCallback.java
new file mode 100644 (file)
index 0000000..24ef4ed
--- /dev/null
@@ -0,0 +1,8 @@
+package org.sigrok.core.interfaces;
+
+import org.sigrok.core.classes.LogLevel;
+
+public interface LogCallback 
+{
+    public void run(LogLevel loglevel, String message);
+}
diff --git a/bindings/java/org/sigrok/core/interfaces/SourceCallback.java b/bindings/java/org/sigrok/core/interfaces/SourceCallback.java
new file mode 100644 (file)
index 0000000..a170fa9
--- /dev/null
@@ -0,0 +1,6 @@
+package org.sigrok.core.interfaces;
+
+public interface SourceCallback 
+{
+    public void run(int revents);
+}