From 2098a093183a82b3194eb499f20c1cd57d90bfdc Mon Sep 17 00:00:00 2001 From: Jeff Wallace <wallace.je@husky.neu.edu> Date: Wed, 20 Nov 2013 14:29:07 -0500 Subject: [PATCH] rebuild tsk datamodel jar file if necessary. Conflicts: bindings/java/build-unix.xml --- bindings/java/Makefile.am | 5 +++-- bindings/java/build-unix.xml | 29 ++++++++++++++++++++--------- bindings/java/build-windows.xml | 15 ++++++++++++++- bindings/java/build.xml | 18 +++++++++++++++++- 4 files changed, 54 insertions(+), 13 deletions(-) diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am index 1007a3e60..4fe909497 100644 --- a/bindings/java/Makefile.am +++ b/bindings/java/Makefile.am @@ -17,9 +17,10 @@ tsk_jar = $(top_builddir)/bindings/java/dist/Tsk_DataModel.jar jardir = $(prefix)/share/java jar_DATA = $(tsk_jar) +$(tsk_jar): -$(tsk_jar): - ant dist $(ANT_PROPS) +all-local: + ant dist $(ANT_PROPS) -Dcalled.from=all-local CLEANFILES = $(tsk_jar) diff --git a/bindings/java/build-unix.xml b/bindings/java/build-unix.xml index 371f69f17..b9c0872f0 100644 --- a/bindings/java/build-unix.xml +++ b/bindings/java/build-unix.xml @@ -23,6 +23,17 @@ </java> </target> + <target name="check-native-build" depends="check-native-build-mac,check-native-build-unix"/> + + <target name="check-native-build-mac" depends="testTSKLibs" if="tsk_dylib.present"> + <uptodate property="native-up-to-date" srcfile="./jni/.libs/libtsk_jni.dylib" + targetfile="${amd64}/mac/libtsk_jni.jnilib" /> + </target> + + <target name="check-native-build-unix" depends="testTSKLibs" if="tsk_so.present"> + <uptodate property="native-up-to-date" srcfile="./jni/.libs/libtsk_jni.so" + targetfile="${amd64}/linux/libtsk_jni.so"/> + </target> <target name="testTSKLibs"> <property environment="env"/> @@ -35,7 +46,7 @@ <!-- OS X --> <target name="copyTskLibs_dylib" depends="testTSKLibs" if="tsk_dylib.present"> <property environment="env"/> - <copy file="./jni/.libs/libtsk_jni.dylib" tofile="./libtsk_jni.jnilib"/> + <copy file="./jni/.libs/libtsk_jni.dylib" tofile="./libtsk_jni.jnilib" overwrite="true"/> </target> <target name="copyMacLibs" depends="testTSKLibs" if="tsk_dylib.present"> @@ -45,30 +56,30 @@ <!-- x86_64 --> <copy file="${jni.dylib}" tofile="${x86_64}/mac/${jni.jnilib}"/> <!-- amd64 --> - <copy file="${jni.dylib}" tofile="${amd64}/mac/${jni.jnilib}"/> + <copy file="${jni.dylib}" tofile="${amd64}/mac/${jni.jnilib}" overwrite="true"/> </target> <!-- Non-OS X --> <target name="copyTskLibs_so" depends="testTSKLibs" if="tsk_so.present"> <property environment="env"/> - <copy file="./jni/.libs/libtsk_jni.so" tofile="./libtsk_jni.so"/> + <copy file="./jni/.libs/libtsk_jni.so" tofile="./libtsk_jni.so" overwrite="true"/> </target> <target name="copyLinuxLibs" depends="testTSKLibs" if="tsk_so.present"> <property environment="env"/> <property name="jni.so" location="${basedir}/jni/.libs/libtsk_jni.so" /> <!-- x86_64 --> - <copy file="${jni.so}" tofile="${x86_64}/linux/libtsk_jni.so"/> + <copy file="${jni.so}" tofile="${x86_64}/linux/libtsk_jni.so" overwrite="true"/> <!-- amd64 --> - <copy file="${jni.so}" tofile="${amd64}/linux/libtsk_jni.so"/> + <copy file="${jni.so}" tofile="${amd64}/linux/libtsk_jni.so" overwrite="true"/> <!-- x86 --> - <copy file="${jni.so}" tofile="${x86}/linux/libtsk_jni.so"/> + <copy file="${jni.so}" tofile="${x86}/linux/libtsk_jni.so" overwrite="true"/> <!-- i386 --> - <copy file="${jni.so}" tofile="${i386}/linux/libtsk_jni.so"/> + <copy file="${jni.so}" tofile="${i386}/linux/libtsk_jni.so" overwrite="true"/> <!-- i586 --> - <copy file="${jni.so}" tofile="${i586}/linux/libtsk_jni.so"/> + <copy file="${jni.so}" tofile="${i586}/linux/libtsk_jni.so" overwrite="true"/> <!-- i686 --> - <copy file="${jni.so}" tofile="${i686}/linux/libtsk_jni.so"/> + <copy file="${jni.so}" tofile="${i686}/linux/libtsk_jni.so" overwrite="true"/> </target> <target name="copyLibs" depends="copyLinuxLibs,copyMacLibs" /> diff --git a/bindings/java/build-windows.xml b/bindings/java/build-windows.xml index f382803d8..5bc4a69fc 100644 --- a/bindings/java/build-windows.xml +++ b/bindings/java/build-windows.xml @@ -33,7 +33,20 @@ <sysproperty key="types" value="${test-types}"/> </java> </target> - + + <target name="check-build-native" depends="check-build-32,check-build-64"/> + + <target name="check-build-32" depends="checkLibDirs" if="win32.exists"> + <uptodate property="native-up-to-date" srcfile="${basedir}/../../win32/Release/libtsk_jni.dll" + targetfile="${x86}/win/libtsk_jni.dll"/> + </target> + + + <target name="check-build-64" depends="checkLibDirs" if="win32.exists"> + <uptodate property="native-up-to-date" srcfile="${basedir}/../../win32/Release/libtsk_jni.dll" + targetfile="${amd64}/win/libtsk_jni.dll"/> + </target> + <target name="copyLibs" depends="copyWinLibs" description="Copy native libs to the correct folder"> <property name="tsk.config" value="Release"/> <antcall target="copyWinLibs" /> diff --git a/bindings/java/build.xml b/bindings/java/build.xml index f01f162a9..5f3725ce4 100755 --- a/bindings/java/build.xml +++ b/bindings/java/build.xml @@ -115,7 +115,23 @@ pattern="lib/[artifact]-[revision](-[classifier]).[ext]" /> </javac> </target> - <target name="dist" depends="init-ivy, compile, copyLibs" + <target name="dist" depends="check-build" unless="up-to-date"> + <antcall target="dist-do"/> + </target> + + <target name="check-build" depends="check-native-build"> + <uptodate property="java-up-to-date" targetfile="${dist}/Tsk_DataModel.jar" > + <srcfiles dir="${src}" includes="**/*.java"/> + </uptodate> + <condition property="up-to-date"> + <and> + <isset property="java-up-to-date"/> + <isset property="native-up-to-date"/> + </and> + </condition> + </target> + + <target name="dist-do" depends="init-ivy, compile, copyLibs" description="generate the distribution" > <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> <jar jarfile="${dist}/Tsk_DataModel.jar" basedir="${build}"/> -- GitLab