E5: package app/shellApp without Gradle (cargo xtask apk)
New xtask/ crate (no deps) runs cargo ndk -> javac -> d8 -> aapt2 -> zipalign -> apksigner directly, signed with the same key build-apk.sh uses. Both pass conditions proved on the ai-app-2 emulator: the xtask APK installs over the Gradle-built shellApp, and the notification service starts and posts a real notification while backgrounded. Adds one printRuntimeClasspathJars task to shellApp/build.gradle.kts (and a matching signingConfig) -- the one disclosed Gradle call the xtask still makes, to resolve the AndroidX/:link dependency graph. That call's Kotlin compilation of :link as a side effect also answers E3's open kotlinc question, so no Java port of ServerStore was needed. Wires a second Apk component into .dev-updater.ron beside the existing one. Full writeup in RUST.md's E5 box. Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
This commit is contained in:
1 parent
32a5256a0d
commit
ceabd00805
11 files changed
+1289
-25
No files matched your search
@@ -88,12 +88,60 @@ android {
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
}
|
||||
// Same reasoning and same key as androidApp's (see that module's comment): E5 (RUST.md)
|
||||
// signs its own, Gradle-free build with this same keystore, and the two can only
|
||||
// `adb install -r` over each other if they carry the same certificate.
|
||||
val keystore = System.getenv("AI_APP_KEYSTORE")
|
||||
signingConfigs {
|
||||
if (keystore != null) {
|
||||
create("release") {
|
||||
storeFile = file(keystore)
|
||||
storePassword = System.getenv("AI_APP_KEYSTORE_PASSWORD")
|
||||
keyAlias = "ai-app"
|
||||
keyPassword = storePassword
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
getByName("release") {
|
||||
isMinifyEnabled = false
|
||||
if (keystore != null) signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
}
|
||||
|
||||
// E5 (RUST.md): the xtask dexes and packages this module's Java sources itself, but it does
|
||||
// not resolve Maven dependencies -- reimplementing a dependency resolver was out of scope for a
|
||||
// packaging step, so this one task is the single place Gradle still runs in that pipeline. It
|
||||
// asks the dependency graph for the *post-transform* jars (AARs already unpacked to a classes
|
||||
// jar, the same artifact type AGP's own dexing task consumes) rather than the raw configuration,
|
||||
// which would hand back .aar files d8 cannot read directly.
|
||||
val artifactType = Attribute.of("artifactType", String::class.java)
|
||||
|
||||
tasks.register("printRuntimeClasspathJars") {
|
||||
description = "Writes the resolved release runtime classpath jars, one per line, for xtask."
|
||||
val outputFile = layout.buildDirectory.file("xtask/runtime-classpath.txt")
|
||||
outputs.file(outputFile)
|
||||
val jars =
|
||||
configurations
|
||||
.getByName("releaseRuntimeClasspath")
|
||||
.incoming
|
||||
.artifactView { attributes.attribute(artifactType, "android-classes-jar") }
|
||||
.files
|
||||
// Captured as a plain FileCollection (not the ArtifactView itself, which the
|
||||
// configuration cache cannot serialize) so this task is still cacheable.
|
||||
inputs.files(jars)
|
||||
doLast {
|
||||
val file = outputFile.get().asFile
|
||||
file.parentFile.mkdirs()
|
||||
file.writeText(jars.joinToString("\n") { it.absolutePath })
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { variant ->
|
||||
variant.sources.java?.addGeneratedSourceDirectory(generatePinnedCa, GeneratePinnedCa::outputDir)
|
||||
|
||||
Reference in new issue
Block a user