From ec34e39a9a5151e20a43658f7e33a6be54d5b3b9 Mon Sep 17 00:00:00 2001 From: Joel Menchavez Date: Fri, 24 Jul 2026 12:40:01 +0800 Subject: [PATCH] ADFA-4762: Restore per-ABI assets zip generation for generate_assets workflow PR #1441 (ADFA-4423) removed createAssetsZip() while extracting the AI plugins, so assembleV8Assets/assembleV7Assets stopped producing app/build/outputs/assets/assets-.zip and the "Generate Assets Zips and Upload to Google Drive" workflow has failed at the Drive upload step ever since. Debug APKs still need these zips on-device (SplitAssetsInstaller). Restore a trimmed createAssetsZip(arch) - the original repackaging logic minus the llama.aar/D8 handling the installer no longer expects - and wire it back into assembleV8Assets/assembleV7Assets. Entry names match the installer contract in AssetsInstallationHelper.expectedEntries. Co-Authored-By: Claude Fable 5 --- app/build.gradle.kts | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f227db508a..bcf090a7d9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -8,6 +8,7 @@ import java.io.BufferedOutputStream import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream import java.io.Closeable +import java.io.FileNotFoundException import java.io.FileOutputStream import java.io.InputStream import java.net.HttpURLConnection @@ -411,11 +412,63 @@ tasks.register("createPluginArtifactsZip") { destinationDirectory.set(rootProject.file("assets")) } +// Packages the on-device installer payload (assets-.zip) consumed by +// SplitAssetsInstaller on debug builds. Entry names must match the installer +// contract in AssetsInstallationHelper.expectedEntries. +fun createAssetsZip(arch: String) { + val outputDir = + project.layout.buildDirectory + .dir("outputs/assets") + .get() + .asFile + if (!outputDir.exists()) { + outputDir.mkdirs() + } + val zipFile = outputDir.resolve("assets-$arch.zip") + + val sourceDir = project.rootDir.resolve("assets") + val bootstrapName = "bootstrap-$arch.zip" + val androidSdkName = "android-sdk-$arch.zip" + ZipOutputStream(zipFile.outputStream()).use { zipOut -> + arrayOf( + androidSdkName, + "localMvnRepository.zip", + "gradle-8.14.3-bin.zip", + "gradle-api-8.14.3.jar.zip", + "documentation.db", + bootstrapName, + "plugin-artifacts.zip", + "core.cgt", + ).forEach { fileName -> + val filePath = sourceDir.resolve(fileName) + if (!filePath.exists()) { + throw FileNotFoundException(filePath.absolutePath) + } + + project.logger.lifecycle("Zipping $fileName from ${filePath.absolutePath}") + val entryName = + when (fileName) { + bootstrapName -> "bootstrap.zip" + androidSdkName -> "android-sdk.zip" + else -> fileName + } + + zipOut.putNextEntry(ZipEntry(entryName)) + filePath.inputStream().use { input -> input.copyTo(zipOut) } + zipOut.closeEntry() + } + } + project.logger.lifecycle("Created ${zipFile.name} at ${zipFile.parentFile.absolutePath}") +} + tasks.register("assembleV8Assets") { dependsOn("createPluginArtifactsZip") if (!isCiCd) { dependsOn("assetsDownloadDebug") } + doLast { + createAssetsZip("arm64-v8a") + } } tasks.register("assembleV7Assets") { @@ -423,6 +476,9 @@ tasks.register("assembleV7Assets") { if (!isCiCd) { dependsOn("assetsDownloadDebug") } + doLast { + createAssetsZip("armeabi-v7a") + } } tasks.register("assembleAssets") {