Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
- Split out libdeepspeech into _android and _jre, for the respective versions
- Moved settings.gradle to both versions, and modified them appropriately
- Removed .so files, which were accidentally included in the previous commit, same goes for Makefile.original
- Updated .gitignore's to work with the new structure
- libdeepspeech_android is exactly as it is currently in mozilla:master
- Updated Makefile to work with the new structure
  • Loading branch information
TheDutchMC committed Feb 2, 2021
1 parent ff12a73 commit 6bbc27a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 85 deletions.
18 changes: 7 additions & 11 deletions native_client/java/.gitignore
Original file line number Diff line number Diff line change
@@ -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=
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
20 changes: 12 additions & 8 deletions native_client/java/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/$*/
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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/
Expand Down
65 changes: 0 additions & 65 deletions native_client/java/Makefile.original

This file was deleted.

1 change: 1 addition & 0 deletions native_client/java/libdeepspeech_android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':libdeepspeech_android'
13 changes: 13 additions & 0 deletions native_client/java/libdeepspeech_jre/.gitignore
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
1 change: 1 addition & 0 deletions native_client/java/libdeepspeech_jre/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':libdeepspeech_jre'
1 change: 0 additions & 1 deletion native_client/java/settings.gradle

This file was deleted.

0 comments on commit 6bbc27a

Please sign in to comment.