-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Standalone Java bindings #3503
base: master
Are you sure you want to change the base?
Standalone Java bindings #3503
Changes from all commits
8d515f5
662de59
2d8f9ee
86a3c52
a15aed6
07ba928
ff12a73
6bbc27a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,22 @@ | ||
| *.iml | ||
| .gradle | ||
| /local.properties | ||
| /.idea/caches/build_file_checksums.ser | ||
| /.idea/libraries | ||
| /.idea/modules.xml | ||
| /.idea/workspace.xml | ||
| .DS_Store | ||
| /build | ||
| /captures | ||
| .externalNativeBuild | ||
| #Native libs | ||
| libdeepspeech_android/libs/* | ||
| !libdeepspeech_android/libs/.gitignore | ||
| libdeepspeech_android/*.so | ||
|
|
||
| #Gradle | ||
| .gradle/ | ||
|
|
||
| #Make/CMake | ||
| Makefile/ | ||
|
|
||
| #SWIG | ||
| jni/*.cpp | ||
| jni/*.o | ||
|
|
||
| #Collected files by make | ||
| build/ | ||
|
|
||
| #Autogenerated java files by SWIG | ||
| 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 |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,73 @@ | ||
| .PHONY: clean apk-clean | ||
| .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') | ||
| ARCHS := $(shell grep 'ABI_FILTERS' libdeepspeech_android/gradle.properties | cut -d'=' -f2 | sed -e 's/;/ /g') | ||
| GRADLE ?= ./gradlew | ||
|
|
||
| all: apk | ||
| all: android jre | ||
| standalone: jre | ||
|
|
||
| clean: apk-clean | ||
| clean: android-clean jre-clean | ||
| rm -rf *.java jni/deepspeech_wrap.cpp | ||
|
|
||
| apk-clean: | ||
| android-clean: | ||
| $(GRADLE) clean | ||
| rm -rf settings.gradle | ||
|
|
||
| libs-clean: | ||
| rm -fr libdeepspeech/libs/*/libdeepspeech.so | ||
| 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/libs/%/libdeepspeech.so: | ||
| -mkdir libdeepspeech/libs/$*/ | ||
| cp ${TFDIR}/bazel-out/$*-*/bin/native_client/libdeepspeech.so libdeepspeech/libs/$*/ | ||
| libdeepspeech_jre/libs/%/libdeepspeech.so: | ||
| -mkdir libdeepspeech_jre/libs/$*/ | ||
| cp ${TFDIR}/bazel-out/$*-*/bin/native_client/libdeepspeech.so libdeepspeech_jre/libs/$*/ | ||
|
|
||
| apk: apk-clean bindings $(patsubst %,libdeepspeech/libs/%/libdeepspeech.so,$(ARCHS)) | ||
| 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 | ||
| cp libdeepspeech_android/settings.gradle settings.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 | ||
| cp libdeepspeech_jre/settings.gradle ./settings.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 | ||
|
|
||
| maven-bundle: apk | ||
| jre-collect: jre-gradle | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this one? |
||
| 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_jre.jar 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/src/main/java/org/deepspeech/libdeepspeech/ -o jni/deepspeech_wrap.cpp jni/deepspeech.i | ||
| 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/ | ||
| cp ./tmp/* libdeepspeech_jre/src/main/java/org/deepspeech/libdeepspeech/ | ||
| rm -rf ./tmp | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,17 @@ | ||
| # Java bindings | ||
| Full project description and documentation on GitHub: [https://github.com/mozilla/DeepSpeech](https://github.com/mozilla/DeepSpeech). | ||
|
|
||
| ## Android bindings | ||
| For use with Android | ||
|
|
||
| ``make android`` | ||
|
|
||
| >Note: The current example app in `./App` is not up to date with the latest changes to the bindings! | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this ? |
||
|
|
||
| ## Standalone Java Bindings for DeepSpeech | ||
| For use with standalone Java | ||
|
|
||
| ``make standalone`` | ||
|
|
||
| ### Usage information: | ||
| See [standalone.md](standalone.md) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
|
||
| buildscript { | ||
|
|
||
| repositories { | ||
| google() | ||
| jcenter() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what we can do about that. Will need to check out which dependencies are from jcenter, I dont think we have any since the Android stuff is pulled from Google |
||
| } | ||
| dependencies { | ||
| } | ||
| } | ||
|
|
||
|
|
||
| allprojects { | ||
| repositories { | ||
| jcenter() | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| } | ||
|
|
||
| task clean(type: Delete) { | ||
| delete rootProject.buildDir | ||
| } | ||
|
|
||
| ext { | ||
| dsVersionString = rootProject.file('../../VERSION').text.trim() | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we avoid updating |
||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same