Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: continuous integration & automate maven publishing #38

Merged
merged 4 commits into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# https://github.com/mgerhardy/caveexpress/blob/master/.travis.yml
# https://github.com/googlesamples/android-ndk/blob/ba6a5a46cf5c0d4b76e2d56a78f321e4668e6e26/.travis.yml
# https://github.com/travis-ci/travis-ci/issues/8360
# https://github.com/owncloud/android/blob/master/.travis.yml

language: android

jdk:
- oraclejdk8

addons:
apt_packages:
- swig

android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- android-25

before_install:
- cmake --version
- swig -version
- echo "y" | sdkmanager "cmake;3.6.4111459"
- curl -L http://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O
- unzip -oq android-ndk-r16b-linux-x86_64.zip && rm android-ndk-r16b-linux-x86_64.zip
- export ANDROID_NDK_HOME=`pwd`/android-ndk-r16b
- git clone https://github.com/cmusphinx/sphinxbase
- git clone https://github.com/cmusphinx/pocketsphinx
- export POCKETSPHINX_HOME=`pwd`/pocketsphinx
- export SPINXBASE_HOME=`pwd`/sphinxbase

before_deploy:
- mv build/outputs/aar/pocketsphinx-android-5prealpha-release.aar build/outputs/aar/pocketsphinx-android-5prealpha.aar

deploy:
provider: bintray
file: descriptor.json
user: nshmyrev
# TODO ecrypt yours here:
key:
secure: MX/XIxovXXaiQbbtOnUaUS5NxyLmLGJ0ShBBpujJogUtuERs+GdRnymZx/Bprp5s18AozkpI1ekG3AA/rv/BEzoO61lB5xGF/Zvs3G4QB/WAsLiCZ/iBncSsMqS6/Q+uJYZXw1/JJj02rZ9F2ERpCvvbxPQm9zWlXkc/P8s/5DQ=
on:
all_branches: true
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

cmake_minimum_required(VERSION 3.4.1)

set(SPHINXBASE_SRC ../sphinxbase/src/libsphinxbase)
set(POCKETSPHINX_SRC ../pocketsphinx/src/libpocketsphinx)
set(SPHINXBASE_SRC $ENV{SPINXBASE_HOME}/src/libsphinxbase)
set(POCKETSPHINX_SRC $ENV{POCKETSPHINX_HOME}/src/libpocketsphinx)

set(SPHINXBASE_SOURCES
fe/fe_interface.c
Expand Down Expand Up @@ -103,13 +103,13 @@ foreach(source ${POCKETSPHINX_SOURCES})
endforeach()


add_library( pocketsphinx_jni SHARED
add_library( pocketsphinx_jni SHARED
build/generated-src/cpp/pocketsphinx_wrap.c
build/generated-src/cpp/sphinxbase_wrap.c
build/generated-src/cpp/sphinxbase_wrap.c
${SPHINXBASE_SOURCES_ABS} ${POCKETSPHINX_SOURCES_ABS}
)
include_directories(../sphinxbase/include ../sphinxbase/include/android ../sphinxbase/include/sphinxbase ../pocketsphinx/include)

include_directories($ENV{SPINXBASE_HOME}/include $ENV{SPINXBASE_HOME}/include/android $ENV{SPINXBASE_HOME}/include/sphinxbase $ENV{POCKETSPHINX_HOME}/include)

add_definitions(-DHAVE_CONFIG_H)
add_compile_options(-O3)
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ the following command to checkout from repository:
git clone https://github.com/cmusphinx/sphinxbase
git clone https://github.com/cmusphinx/pocketsphinx
git clone https://github.com/cmusphinx/pocketsphinx-android
export POCKETSPHINX_HOME=`pwd`/pocketsphinx
export SPINXBASE_HOME=`pwd`/sphinxbase
```

After checkout you need to update the file 'local.properties' in the
Expand All @@ -43,20 +45,43 @@ sdk.dir=/Users/User/Library/Android/sdk
ndk.dir=/Users/User/Library/Android/sdk/ndk-bundle
```

After everything is set, run `gradle build`. It will create
After everything is set, run `./gradlew build`. It will create
pocketsphinx-android-5prealpha-release.aar and
pocketsphinx-android-5prealpha-debug.aar in build/output.

Using the library
=================

Add bintray maven to your repositories

allprojects {
repositories {
maven {
url "https://dl.bintray.com"
}
jcenter()
google()
}
}


Add `pocketsphinx-android` to your dependencies

dependencies {
implementation 'edu.cmu.pocketsphinx.android:pocketsphinx-android:5prealpha@aar'
}


Using the library locally
=================

Library is distributed as android archive AAR. You can add it to your project
as usual with Android Studio or directly in gradle

dependencies {
compile (name:'pocketsphinx-android-debug', ext:'aar')
}

repositories {
flatDir {
dirs 'libs'
Expand Down
19 changes: 11 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,25 @@ task mkdir {
}
}

def sphinxbase_home = "$System.env.SPINXBASE_HOME"
def pocketsphinx_home = "$System.env.POCKETSPHINX_HOME"

task swigSb(type: Exec) {
commandLine 'swig',
"-I../sphinxbase/include", "-I../sphinxbase/swig",
"-java", "-package", "edu.cmu.pocketsphinx",
"-I$sphinxbase_home/include", "-I$sphinxbase_home/swig",
"-java", "-package", "edu.cmu.pocketsphinx",
"-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/sphinxbase_wrap.c",
"../sphinxbase/swig/sphinxbase.i"
"$sphinxbase_home/swig/sphinxbase.i"
}

task swigPs(type: Exec) {
commandLine 'swig',
"-I../sphinxbase/swig",
"-I../pocketsphinx/include",
"-I../pocketsphinx/swig",
"-I$sphinxbase_home/swig",
"-I$pocketsphinx_home/include",
"-I$pocketsphinx_home/swig",
"-java", "-package", "edu.cmu.pocketsphinx",
"-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/pocketsphinx_wrap.c",
"../pocketsphinx/swig/pocketsphinx.i"
"-outdir", "build/generated-src/java", "-o", "build/generated-src/cpp/pocketsphinx_wrap.c",
"$pocketsphinx_home/swig/pocketsphinx.i"
}

preBuild.dependsOn mkdir, swigSb, swigPs
34 changes: 34 additions & 0 deletions descriptor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"package": {
"subject": "edu.cmu.pocketsphinx",
"repo": "android",
"name": "pocketsphinx-android",
"vcs_url": "https://github.com/cmusphinx/pocketsphinx-android.git",
"licenses": ["BSD 3-Clause"],
"github_use_tag_release_notes": true
},
"version": {
"name": "5prealpha",
"desc": "Testing releases",
"released": "2017-01-28",
"vcs_tag": "5prealpha",
"attributes": [{
"name": "versionName",
"values": ["5prealpha"],
"type": "string"
}, {
"name": "versionCode",
"values": [5],
"type": "number"
}],
"gpgSign": false
},
"files": [{
"includePattern": "build/outputs/aar/(.*)",
"uploadPattern": "pocketsphinx-android/5prealpha/$1",
"matrixParams": {
"override": 1
}
}],
"publish": true
}