M12 — the Android client, end to end #2

Merged
bvandeusen merged 86 commits from dev into main 2026-08-21 08:53:58 -04:00
Showing only changes of commit 3d3df1beb0 - Show all commits
+17 -14
View File
@@ -187,25 +187,28 @@ android {
compose = true
}
sourceSets {
getByName("main") {
// The .so and the bindings are build outputs, not checked-in sources.
// Passing the TASK PROVIDERS, not plain paths: Gradle reads each
// task's @OutputDirectory and infers the build ordering itself. A
// bare path would compile Kotlin before the bindings exist, and the
// usual fix — depending on KotlinCompile by type — cannot be written
// here, because AGP 9's built-in Kotlin means that class is not on
// the buildscript classpath.
jniLibs.srcDir(cargoNdkDebug)
java.srcDir(generateBindings)
}
}
packaging {
resources.excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
/**
* Register the `.so` and the generated bindings as GENERATED sources.
*
* NOT `sourceSets { ... srcDir(task) }`: AGP 9 rejects a Provider there outright,
* because it cannot tell whether the directory holds generated (read-only) or
* hand-written (read-write) files — a distinction the IDE needs. The Variant API
* is the supported route and, unlike a bare path, `addGeneratedSourceDirectory`
* carries the task dependency, so Kotlin cannot compile before the bindings
* exist and the APK cannot package a stale `.so`.
*/
androidComponents {
onVariants { variant ->
variant.sources.kotlin?.addGeneratedSourceDirectory(generateBindings, UniffiBindgen::outputDir)
variant.sources.jniLibs?.addGeneratedSourceDirectory(cargoNdkDebug, CargoNdkBuild::jniLibsDir)
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)