ci(nc-android): fix gradle build

This commit is contained in:
pierre
2023-02-10 12:29:16 +01:00
parent 0baa8b2c92
commit bdc0bcbd56
2 changed files with 19 additions and 12 deletions
+5 -8
View File
@@ -33,6 +33,9 @@ jobs:
libayatana-appindicator3-dev \
librsvg2-dev
- name: Checkout
uses: actions/checkout@v3
- name: Install Java
uses: actions/setup-java@v3
with:
@@ -57,11 +60,6 @@ jobs:
"ndk;$NDK_VERSION" \
"build-tools;$SDK_BUILDTOOLS_VERSION"
- name: Debug
run: |
echo $ANDROID_HOME
ls -la $ANDROID_HOME
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
@@ -82,9 +80,6 @@ jobs:
npm i -g yarn
yarn --version
- name: Checkout
uses: actions/checkout@v3
- name: Build frontend code
run: |
yarn install --frozen-lockfile
@@ -94,8 +89,10 @@ jobs:
- name: Build APK
working-directory: nym-connect-android
env:
ANDROID_SDK_ROOT: ${{ env.ANDROID_HOME }}
WRY_ANDROID_PACKAGE: net.nymtech.nym_connect_android
WRY_ANDROID_LIBRARY: nym_connect_android
NODE_BIN_PATH: ${{ github.workspace }}/nym-connect-android/node_modules/.bin
# TODO build with release profile (--release), it will requires
# to sign the APK. For now build with debug profile to avoid that
run: yarn tauri android build --debug --apk --split-per-abi
@@ -14,8 +14,10 @@ open class BuildTask : DefaultTask() {
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
var rootDirRel: File? = null
@Input
var target: String? = null
@Input
var release: Boolean? = null
@@ -25,12 +27,20 @@ open class BuildTask : DefaultTask() {
val target = target ?: throw GradleException("target cannot be null")
val release = release ?: throw GradleException("release cannot be null")
val home = (System.getenv("HOME") ?: "")
val cargo_home = (System.getenv("CARGO_HOME") ?: "$home/.cargo")
println("gradle Rust plugin: CARGO_HOME $cargo_home")
val nodeBinPath = (System.getenv("NODE_BIN_PATH") ?: "")
val cargoHome = (System.getenv("CARGO_HOME") ?: "$home/.cargo")
val cargoExecutable = "$cargoHome/bin/cargo-tauri";
val nodeExecutable = "$nodeBinPath/tauri";
val tauriCli = when {
File(cargoExecutable).isFile() -> cargoExecutable
File(nodeExecutable).isFile() -> nodeExecutable
else -> throw GradleException("couldn't find tauri-cli executable")
}
println("gradle Rust plugin, using tauri cli executable: $tauriCli")
project.exec {
workingDir(File(project.projectDir, rootDirRel.path))
executable("""$cargo_home/bin/cargo-tauri""")
args(listOf("tauri", "android", "android-studio-script"))
executable(tauriCli)
args(listOf("android", "android-studio-script"))
if (project.logger.isEnabled(LogLevel.DEBUG)) {
args("-vv")
} else if (project.logger.isEnabled(LogLevel.INFO)) {