diff --git a/native_client/java/.gitignore b/native_client/java/.gitignore index ddfec0b1b9..7661a22379 100755 --- a/native_client/java/.gitignore +++ b/native_client/java/.gitignore @@ -1,26 +1,22 @@ #Native libs -libdeepspeech/libs/* -libdeepspeech/*.so +libdeepspeech_android/libs/* +!libdeepspeech_android/libs/.gitignore +libdeepspeech_android/*.so #Gradle .gradle/ -libdeepspeech/build/ #Make/CMake Makefile/ -libdeepspeech/CMakeFiles/ -libdeepspeech/cmake_install.cmake -libdeepspeech/CMakeCache.txt -libdeepspeech/Makefile #SWIG jni/*.cpp jni/*.o -#Setup.sh output +#Collected files by make build/ #Autogenerated java files by SWIG -libdeepspeech/src/main/java/org/deepspeech/libdeepspeech/*.java -!libdeepspeech/src/main/java/org/deepspeech/libdeepspeech/DeepSpeechModel.java -!libdeepspeech/src/main/java/org/deepspeech/libdeepspeech/DeepSpeechStreamingState.java= \ No newline at end of file +libdeepspeech_android/src/main/java/org/deepspeech/libdeepspeech/*.java +!libdeepspeech_android/src/main/java/org/deepspeech/libdeepspeech/DeepSpeechModel.java +!libdeepspeech_android/src/main/java/org/deepspeech/libdeepspeech/DeepSpeechStreamingState.java \ No newline at end of file diff --git a/native_client/java/Makefile b/native_client/java/Makefile index 414f3623c9..cc40ae7406 100644 --- a/native_client/java/Makefile +++ b/native_client/java/Makefile @@ -13,6 +13,14 @@ clean: android-clean jre-clean android-clean: $(GRADLE) clean + rm -rf settings.gradle + +jre-clean: + rm -f build.gradle + rm -f jni/deepspeech_wrap.cpp jni/deepspeech_wrap.o + rm -rf libdeepspeech_jre/cmake_install.cmake libdeepspeech_jre/CMakeCache.txt libdeepspeech_jre/Makefile libdeepspeech_jre/CMakeFiles/ + rm -rf libdeepspeech_jre/build/ + rm -rf settings.gradle libdeepspeech_jre/libs/%/libdeepspeech.so: -mkdir libdeepspeech_jre/libs/$*/ @@ -24,6 +32,7 @@ libdeepspeech_android/libs/%/libdeepspeech.so: android-prepare: cp build.gradle.android build.gradle + cp libdeepspeech_android/settings.gradle settings.gradle android: android-prepare android-clean bindings $(patsubst %,libdeepspeech/libs/%/libdeepspeech.so,$(ARCHS)) $(GRADLE) build @@ -32,6 +41,7 @@ jre: jre-prepare jre-collect jre-restore-makefile jre-clean jre-prepare: $(patsubst %,libdeepspeech_jre/libs/%/libdeepspeech.so,$(ARCHS)) cp Makefile Makefile.original cp build.gradle.standalone build.gradle + cp libdeepspeech_jre/settings.gradle ./settings.gradle sed -i 's|__JAVA_HOME__|'${JAVA_HOME}'|g' libdeepspeech_jre/CMakeLists.txt jre-libdeepspeech-jni: bindings @@ -46,13 +56,7 @@ jre-collect: jre-gradle mkdir -p build mv libdeepspeech_jre/libdeepspeech-jni.so build/ cp libdeepspeech_jre/libs/x86_64/libdeepspeech.so build/ - cp libdeepspeech_jre/build/libs/libdeepspeech.jar build/ - -jre-clean: - rm -f build.gradle - rm -f jni/deepspeech_wrap.cpp jni/deepspeech_wrap.o - rm -rf libdeepspeech_jre/cmake_install.cmake libdeepspeech_jre/CMakeCache.txt libdeepspeech_jre/Makefile libdeepspeech_jre/CMakeFiles/ - rm -rf libdeepspeech_jre/build/ + cp libdeepspeech_jre/build/libs/libdeepspeech_jre.jar build/ jre-restore-makefile: mv Makefile.original Makefile @@ -61,7 +65,7 @@ maven-bundle: android $(GRADLE) uploadArchives $(GRADLE) zipMavenArtifacts -bindings: clean ds-swig +bindings: ds-swig mkdir -p ./tmp $(DS_SWIG_ENV) swig -c++ -java -package org.deepspeech.libdeepspeech -outdir ./tmp -o jni/deepspeech_wrap.cpp jni/deepspeech.i cp ./tmp/* libdeepspeech_android/src/main/java/org/deepspeech/libdeepspeech/ diff --git a/native_client/java/Makefile.original b/native_client/java/Makefile.original deleted file mode 100644 index dc92c7989b..0000000000 --- a/native_client/java/Makefile.original +++ /dev/null @@ -1,65 +0,0 @@ -.PHONY: clean android-clean jre jre-prepare jre-libdeepspeech-jni jre-gradle jre-collect jre-clean android-prepare - -include ../definitions.mk - -ARCHS := $(shell grep 'ABI_FILTERS' libdeepspeech/gradle.properties | cut -d'=' -f2 | sed -e 's/;/ /g') -GRADLE ?= ./gradlew - -all: android jre -standalone: jre - -clean: android-clean jre-clean - rm -rf *.java jni/deepspeech_wrap.cpp - -android-clean: - $(GRADLE) clean - -libdeepspeech_jre/libs/%/libdeepspeech.so: - -mkdir libdeepspeech_jre/libs/$*/ - cp ${TFDIR}/bazel-out/$*-*/bin/native_client/libdeepspeech.so libdeepspeech_jre/libs/$*/ - -libdeepspeech_android/libs/%/libdeepspeech.so: - -mkdir libdeepspeech_android/libs/$*/ - cp ${TFDIR}/bazel-out/$*-*/bin/native_client/libdeepspeech.so libdeepspeech_android/libs/$*/ - -android-prepare: - cp build.gradle.android build.gradle - -android: android-prepare android-clean bindings $(patsubst %,libdeepspeech/libs/%/libdeepspeech.so,$(ARCHS)) - $(GRADLE) build - -jre: jre-prepare jre-collect jre-restore-makefile jre-clean -jre-prepare: $(patsubst %,libdeepspeech_jre/libs/%/libdeepspeech.so,$(ARCHS)) - cp Makefile Makefile.original - cp build.gradle.standalone build.gradle - sed -i 's|__JAVA_HOME__|'${JAVA_HOME}'|g' libdeepspeech_jre/CMakeLists.txt - -jre-libdeepspeech-jni: bindings - cd libdeepspeech_jre; \ - cmake .; \ - $(MAKE) - -jre-gradle: jre-libdeepspeech-jni - $(GRADLE) build - -jre-collect: jre-gradle - mkdir -p build - mv libdeepspeech_jre/libdeepspeech-jni.so build/ - cp libdeepspeech_jre/libs/x86_64/libdeepspeech.so build/ - cp libdeepspeech_jre/build/libs/libdeepspeech.jar build/ - -jre-clean: - rm -f build.gradle - rm -f jni/deepspeech_wrap.cpp jni/deepspeech_wrap.o - rm -rf libdeepspeech_jre/cmake_install.cmake libdeepspeech_jre/CMakeCache.txt libdeepspeech_jre/Makefile libdeepspeech_jre/CMakeFiles/ - rm -rf libdeepspeech_jre/build/ - -jre-restore-makefile: - mv Makefile.original Makefile - -maven-bundle: android - $(GRADLE) uploadArchives - $(GRADLE) zipMavenArtifacts - -bindings: clean ds-swig - $(DS_SWIG_ENV) swig -c++ -java -package org.deepspeech.libdeepspeech -outdir libdeepspeech_android/src/main/java/org/deepspeech/libdeepspeech/ -o jni/deepspeech_wrap.cpp jni/deepspeech.i \ No newline at end of file diff --git a/native_client/java/libdeepspeech_android/settings.gradle b/native_client/java/libdeepspeech_android/settings.gradle new file mode 100644 index 0000000000..8b67f5a445 --- /dev/null +++ b/native_client/java/libdeepspeech_android/settings.gradle @@ -0,0 +1 @@ +include ':libdeepspeech_android' diff --git a/native_client/java/libdeepspeech_jre/.gitignore b/native_client/java/libdeepspeech_jre/.gitignore new file mode 100644 index 0000000000..e4a37c9bbd --- /dev/null +++ b/native_client/java/libdeepspeech_jre/.gitignore @@ -0,0 +1,13 @@ +src/main/java/org/deepspeech/libdeepspeech/*.java +!src/main/java/org/deepspeech/libdeepspeech/DeepSpeechModel.java +!src/main/java/org/deepspeech/libdeepspeech/DeepSpeechStreamingState.java + +CMakeFiles/ +cmake_install.cmake +CMakeCache.txt +Makefile + +build/ + +libs/* +*.so \ No newline at end of file diff --git a/native_client/java/libdeepspeech_jre/libs/x86_64/libdeepspeech.so b/native_client/java/libdeepspeech_jre/libs/x86_64/libdeepspeech.so deleted file mode 100644 index 770c230753..0000000000 Binary files a/native_client/java/libdeepspeech_jre/libs/x86_64/libdeepspeech.so and /dev/null differ diff --git a/native_client/java/libdeepspeech_jre/settings.gradle b/native_client/java/libdeepspeech_jre/settings.gradle new file mode 100644 index 0000000000..764791a121 --- /dev/null +++ b/native_client/java/libdeepspeech_jre/settings.gradle @@ -0,0 +1 @@ +include ':libdeepspeech_jre' \ No newline at end of file diff --git a/native_client/java/settings.gradle b/native_client/java/settings.gradle deleted file mode 100755 index bd2951b7ca..0000000000 --- a/native_client/java/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':libdeepspeech'