From 3e89240147fc0ed9230c6209b4a2bd52d14e7b3f Mon Sep 17 00:00:00 2001 From: Bin Li Date: Fri, 13 Jul 2018 17:57:37 +0800 Subject: [PATCH] add build android demo to CI --- .gitlab-ci.yml | 6 ++++++ mace/examples/android/app/build.gradle | 4 ++++ mace/examples/android/build.sh | 7 ++++++- mace/examples/android/macelibrary/CMakeLists.txt | 8 ++++---- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e49a7dc0..3fab7500 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ stages: - ops_test - api_test - python_tools_tests + - build_android_demo - ops_benchmark - extra_tests @@ -111,3 +112,8 @@ python_tools_tests: python tools/converter.py run --config=${CONF_FILE} --round=1 --validate --model_graph_format=file --model_data_format=file || exit 1; python tools/converter.py run --config=${CONF_FILE} --example --round=1 --validate --model_graph_format=file --model_data_format=file || exit 1; - rm -rf mace-models + +build_android_demo: + stage: build_android_demo + script: + - pushd mace/examples/android/ && bash build.sh build && popd diff --git a/mace/examples/android/app/build.gradle b/mace/examples/android/app/build.gradle index a1f68ed3..3bd3b6c7 100644 --- a/mace/examples/android/app/build.gradle +++ b/mace/examples/android/app/build.gradle @@ -10,6 +10,10 @@ android { versionName "1.0" } + lintOptions { + abortOnError false + } + signingConfigs { release { storeFile file("mace_demo.jks") diff --git a/mace/examples/android/build.sh b/mace/examples/android/build.sh index b7b08eed..46a6e4c2 100755 --- a/mace/examples/android/build.sh +++ b/mace/examples/android/build.sh @@ -9,8 +9,13 @@ cp -rf builds/mobilenet/include mace/examples/android/macelibrary/src/main/cpp/ cp -rf builds/mobilenet/model mace/examples/android/macelibrary/src/main/cpp/ bash tools/build-standalone-lib.sh +cp -rf builds/include mace/examples/android/macelibrary/src/main/cpp/ cp -rf builds/lib mace/examples/android/macelibrary/src/main/cpp/ popd -./gradlew installAppRelease +if [ $# -eq 1 ] && [ $1 == "build" ]; then + ./gradlew build +else + ./gradlew installAppRelease +fi diff --git a/mace/examples/android/macelibrary/CMakeLists.txt b/mace/examples/android/macelibrary/CMakeLists.txt index 76c5e30e..fbdb60c5 100644 --- a/mace/examples/android/macelibrary/CMakeLists.txt +++ b/mace/examples/android/macelibrary/CMakeLists.txt @@ -14,12 +14,12 @@ cmake_minimum_required(VERSION 3.4.1) include_directories(${CMAKE_SOURCE_DIR}/) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include) -set(mace_file ${CMAKE_SOURCE_DIR}/src/main/cpp/lib/arm64-v8a/libmace.a) -set(mobilenet_file ${CMAKE_SOURCE_DIR}/src/main/cpp/model/mobilenet.a) +set(mace_lib ${CMAKE_SOURCE_DIR}/src/main/cpp/lib/arm64-v8a/libmace.a) +set(mobilenet_lib ${CMAKE_SOURCE_DIR}/src/main/cpp/model/arm64-v8a/mobilenet.a) add_library (mace_lib STATIC IMPORTED) -set_target_properties(mace_lib PROPERTIES IMPORTED_LOCATION ${mace_file}) +set_target_properties(mace_lib PROPERTIES IMPORTED_LOCATION ${mace_lib}) add_library (mobilenet_lib STATIC IMPORTED) -set_target_properties(mobilenet_lib PROPERTIES IMPORTED_LOCATION ${mobilenet_file}) +set_target_properties(mobilenet_lib PROPERTIES IMPORTED_LOCATION ${mobilenet_lib}) add_library( # Sets the name of the library. mace_mobile_jni -- GitLab