ci(android): keep the cached libmpv and Rust target trees

Gradle deletes the declared outputs of a task it has no history for, so
on every fresh checkout buildLibmpvAndroid threw away the libmpv tree just
restored from the cache and rebuilt it from source (~14 min per job). The
task no longer declares outputs; the script's STAMP decides.

rust-cache treats target/android/<triple> as a profile directory and
deletes its release tree before saving, so both cargo-ndk ABIs were
rebuilt from scratch on every run (~6 min per job). It now caches only the
registry and helpers; the target directory goes through actions/cache,
keyed on toolchain and lockfile and restoring from the last lockfile.
This commit is contained in:
nvrl committed 2026-10-03 23:00:19 +02:00
1 parent 22425e0bad
commit 66eb1b49a1
2 files changed
+56 -18

No files matched your search

+4 -8
View File
@@ -180,20 +180,16 @@ val uniffiSourceDir = layout.buildDirectory.dir("generated/source/uniffi")
val hostRustLibrary = repositoryRoot.resolve(
"target/debug/${System.mapLibraryName("pstr_android")}",
)
val stagedMpvDir = layout.buildDirectory.dir("generated/mpv")
val buildLibmpvAndroid by tasks.registering(Exec::class) {
group = "native"
description = "Builds the pinned GPL libmpv and stages both Android ABIs."
workingDir(repositoryRoot)
commandLine("bash", repositoryRoot.resolve("scripts/build-libmpv-android.sh").absolutePath)
inputs.file(repositoryRoot.resolve("scripts/build-libmpv-android.sh"))
outputs.files(
stagedMpvDir.map { it.file("jniLibs/arm64-v8a/libmpv.so") },
stagedMpvDir.map { it.file("jniLibs/x86_64/libmpv.so") },
stagedMpvDir.map { it.file("include/mpv/client.h") },
stagedMpvDir.map { it.file("REVISION") },
)
// No declared outputs: the script's STAMP is the up-to-date check. Gradle
// deletes the declared outputs of a task it has no history for, which on a
// fresh CI checkout threw away the tree just restored from the cache and
// rebuilt libmpv from source on every run.
}
val buildRustHost by tasks.registering(Exec::class) {