From 43a9cf741b0b7d02239790f7c4d9f9926495b9c3 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Wed, 29 Jul 2026 21:47:07 +0200 Subject: [PATCH] fix(client/android): the build resolves cargo from CARGO_HOME before guessing ~/.cargo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kts resolves cargo by ABSOLUTE path on purpose (a GUI Android Studio launch has no ~/.cargo/bin on PATH), but user.home is the wrong anchor in the CI image, where the shared toolchain lives at CARGO_HOME=/usr/local/cargo — gradle died starting /root/.cargo/bin/cargo. CARGO_HOME/bin is where rustup puts binaries whenever the variable is set, so it wins; the ~/.cargo fallback keeps GUI launches working. Also: android.yml's path filter learns ci/android-ci.Dockerfile — an image change must exercise its consumer instead of needing a manual rerun to prove itself. Co-Authored-By: Claude Fable 5 --- .gitea/workflows/android.yml | 6 ++++++ clients/android/kit/build.gradle.kts | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/android.yml b/.gitea/workflows/android.yml index 92be67dd..d9fa5e8f 100644 --- a/.gitea/workflows/android.yml +++ b/.gitea/workflows/android.yml @@ -26,6 +26,9 @@ on: paths: - 'crates/**' - 'clients/android/**' + # The builder image is part of what this artifact is built from — an image + # change must exercise its consumer. + - 'ci/android-ci.Dockerfile' - 'Cargo.toml' - 'Cargo.lock' - 'rust-toolchain.toml' @@ -39,6 +42,9 @@ on: paths: - 'crates/**' - 'clients/android/**' + # The builder image is part of what this artifact is built from — an image + # change must exercise its consumer. + - 'ci/android-ci.Dockerfile' - 'Cargo.toml' - 'Cargo.lock' - 'rust-toolchain.toml' diff --git a/clients/android/kit/build.gradle.kts b/clients/android/kit/build.gradle.kts index b73f22c3..7d0807b4 100644 --- a/clients/android/kit/build.gradle.kts +++ b/clients/android/kit/build.gradle.kts @@ -47,7 +47,11 @@ dependencies { // /README.md): `cargo install cargo-ndk` + `rustup target add aarch64-linux-android x86_64-linux-android`. // ------------------------------------------------------------------------------------------------ val repoRoot = rootDir.parentFile.parentFile // clients/android -> clients -> repo root -val cargoBin = "${System.getProperty("user.home")}/.cargo/bin" +// CARGO_HOME first: rustup puts every binary in $CARGO_HOME/bin, and the CI image +// (ci/android-ci.Dockerfile) installs the shared toolchain at /usr/local/cargo — the +// historical ~/.cargo fallback is what a GUI Android Studio launch (no env) still needs. +val cargoBin = System.getenv("CARGO_HOME")?.let { "$it/bin" } + ?: "${System.getProperty("user.home")}/.cargo/bin" // SDK location without depending on AGP's DSL (sdkDirectory isn't in AGP 9's library extension): // env first (set by Android Studio and by our CLI shell), then local.properties, then the default.