Skip to content

Commit

Permalink
android: ndk build in Gradle fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
JaCzekanski committed Aug 1, 2019
1 parent eaa4f67 commit 4d887ea
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 39 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Expand Up @@ -6,7 +6,6 @@ matrix:
sudo: required sudo: required
dist: trusty dist: trusty
cache: ccache cache: ccache
install: "./.travis/linux/pull-container.sh"
script: "./.travis/linux/run-container.sh" script: "./.travis/linux/run-container.sh"
after_success: "./.travis/notify-discord.sh success $WEBHOOK_URL" after_success: "./.travis/notify-discord.sh success $WEBHOOK_URL"
after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL" after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL"
Expand All @@ -16,7 +15,6 @@ matrix:
dist: trusty dist: trusty
cache: ccache cache: ccache
before_install: openssl aes-256-cbc -K $encrypted_7333c7dd5b15_key -iv $encrypted_7333c7dd5b15_iv -in android/avocado.keystore.enc -out android/avocado.keystore -d before_install: openssl aes-256-cbc -K $encrypted_7333c7dd5b15_key -iv $encrypted_7333c7dd5b15_iv -in android/avocado.keystore.enc -out android/avocado.keystore -d
install: "./.travis/android/pull-container.sh"
script: "./.travis/android/run-container.sh" script: "./.travis/android/run-container.sh"
after_success: "./.travis/notify-discord.sh success $WEBHOOK_URL" after_success: "./.travis/notify-discord.sh success $WEBHOOK_URL"
after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL" after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL"
Expand All @@ -30,7 +28,7 @@ matrix:
after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL" after_failure: "./.travis/notify-discord.sh failure $WEBHOOK_URL"


notifications: notifications:
- email: false email: false


deploy: deploy:
provider: script provider: script
Expand Down
6 changes: 0 additions & 6 deletions .travis/android/build.sh
Expand Up @@ -23,12 +23,6 @@ find $ASSETS_DIR -type f -name .gitignore -exec rm {} \;


# Build # Build
pushd android pushd android

# Native code
NDK_PROJECT_PATH=`pwd`/app ndk-build PM5_CONFIG=release_x64 -j4 avocado NDK_DEBUG=0
ccache -s

# Java code
./gradlew assembleRelease ./gradlew assembleRelease
popd popd


Expand Down
4 changes: 0 additions & 4 deletions .travis/android/pull-container.sh

This file was deleted.

7 changes: 6 additions & 1 deletion .travis/android/run-container.sh
Expand Up @@ -3,4 +3,9 @@


mkdir -p "$HOME/.ccache" mkdir -p "$HOME/.ccache"


docker run -v $(pwd):/home/build -v "$HOME/.ccache":/root/.ccache avocadoemu/android /bin/bash -ex /home/build/.travis/android/build.sh docker run \
-v $(pwd):/home/build \
-v "$HOME/.ccache":/root/.ccache \
-e keystore_password="$keystore_password" \
avocadoemu/android \
/bin/bash -ex /home/build/.travis/android/build.sh
5 changes: 0 additions & 5 deletions .travis/linux/pull-container.sh

This file was deleted.

6 changes: 5 additions & 1 deletion .travis/linux/run-container.sh
Expand Up @@ -3,5 +3,9 @@


mkdir -p "$HOME/.ccache" mkdir -p "$HOME/.ccache"


docker run -v $(pwd):/home/build -v "$HOME/.ccache":/root/.ccache avocadoemu/linux-clang6 /bin/bash -ex /home/build/.travis/linux/build.sh docker run \
-v $(pwd):/home/build \
-v "$HOME/.ccache":/root/.ccache \
avocadoemu/linux-clang6 \
/bin/bash -ex /home/build/.travis/linux/build.sh


3 changes: 2 additions & 1 deletion android/.gitignore
Expand Up @@ -146,4 +146,5 @@ fastlane/report.xml
fastlane/README.md fastlane/README.md




app/obj app/obj
app/.externalNativeBuild/
30 changes: 15 additions & 15 deletions android/app/build.gradle
@@ -1,7 +1,8 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'


def signingPassword = System.getenv("keystore_password") def signingPassword = System.getenv("keystore_password")
def signingEnabled = System.getenv("CI") == "true" def signingEnabled = signingPassword != null
println "App signing: $signingEnabled"


android { android {
compileSdkVersion 28 compileSdkVersion 28
Expand All @@ -13,13 +14,10 @@ android {
versionName "0.1.0" versionName "0.1.0"
externalNativeBuild { externalNativeBuild {
ndkBuild { ndkBuild {
arguments 'PM5_CONFIG=release_x64 NDK_DEBUG=0' arguments 'PM5_CONFIG=release_x64', '-j4'
targets "libavocado.so" targets "avocado"
} }
} }
ndk {
abiFilters "x86_64", "arm64-v8a"
}
} }
signingConfigs { signingConfigs {
if (signingEnabled) { if (signingEnabled) {
Expand All @@ -39,18 +37,20 @@ android {
if (signingEnabled) { if (signingEnabled) {
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
}
debug {
ndk {
abiFilters "x86_64"
}
} }
} }



externalNativeBuild {
// externalNativeBuild { ndkBuild {
// ndkBuild { path 'jni/Android.mk'
// path 'jni/Android.mk'
// }
// }
sourceSets{
main {
jniLibs.srcDirs = ['obj/local']
} }
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0-beta02' classpath 'com.android.tools.build:gradle:3.4.2'
} }
} }


Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
2 changes: 1 addition & 1 deletion premake5.lua
Expand Up @@ -7,7 +7,7 @@ workspace "Avocado"
startproject "avocado" startproject "avocado"
defaultplatform "x86" defaultplatform "x86"


ndkabi "arm64-v8a" ndkabi "arm64-v8a armeabi-v7a"
ndkstl "c++_static" ndkstl "c++_static"
ndkplatform "android-24" ndkplatform "android-24"


Expand Down

0 comments on commit 4d887ea

Please sign in to comment.