build(android): unify the 4 helper build/package scripts behind one parameterized pair - #1466
Merged
Conversation
Replace the four ~75%-duplicated shell scripts with one parameterized build script and one parameterized package script, mirroring scripts/build-xcuitest-apple.sh's env-var-driven pattern. The helper is selected via AGENT_DEVICE_ANDROID_HELPER or a first positional arg; per-helper differences (HELPER_DIR/PACKAGE_NAME, snapshot's test-compile+run step, ime's aapt2 resource-compile step, and the manifest JSON fields) live in small case blocks. All package.json entry points keep their names and output paths. Verified byte-level equivalence between main and this branch: identical unzip -l listings, identical classes.dex SHA-256 for both helpers, and identical manifest fields (only the per-signing-run sha256 differs). Fixes #1461
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
The multitouch helper was consolidated away in #1281; these two lines were never cleaned up.
Member
Author
|
Reviewed clean at The shared Android helper scripts retain each helper’s distinct compile/test/resource/package behavior and preserve public package-script names and output paths. The PR includes real Android SDK builds for both selectors plus artifact-equivalence evidence; checks are green. Ready for human review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/build-android-snapshot-helper.sh/build-android-ime-helper.sh/package-android-snapshot-helper.sh/package-android-ime-helper.sh(366 lines, ~75% duplicated) withscripts/build-android-helper.sh(158 lines) +scripts/package-android-helper.sh(136 lines), net −72 LOC.AGENT_DEVICE_ANDROID_HELPER=snapshot|ime(used bypackage.json/CI) or a first positional arg, mirroringscripts/build-xcuitest-apple.sh'sAGENT_DEVICE_XCUITEST_PLATFORMpattern.HELPER_DIR/PACKAGE_NAME, snapshot's test-compile+run step, ime'saapt2 compileresource step, and the manifest JSON field sets) live in plaincaseblocks — no shared abstraction over the divergent bits.package.jsonentry points (build:android-snapshot-helper,package:android-snapshot-helper[:npm],build:android-ime-helper,package:android-ime-helper[:npm],build:android,prepack) keep their names and output paths — only their bodies now set the env var and point at the shared script names..github/workflows/release-android-snapshot-helper.yml(only workflow referencing the old filenames) and both helper READMEs.Closes #1461
Verification
Ran locally with a real Android SDK (
ANDROID_HOMEset, build-tools 36.0.0,android-36platform, JDK 17).Build + package succeeded on both
mainand this branch for both helpers, including via both selection forms (AGENT_DEVICE_ANDROID_HELPER=snapshot ...andsh build-android-helper.sh snapshot ...).classes.dexSHA-256 — identical on main vs. branch:unzip -llisting — snapshot-helper, main:unzip -llisting — snapshot-helper, this branch:Only the
META-INF/*timestamps differ (each signing run stamps its own signature files) — entry names, sizes, and file count are identical. Same result for the ime-helper (7 entries, all sizes/names matched, only signature timestamps differ).Manifest JSON — identical on main vs. branch except
sha256(expected: the APK signature, and therefore its hash, differs per signing run since the debug key produces a different signature each run). All other fields (packageName,versionCode,instrumentationRunner/serviceComponent,minSdk/targetSdk,outputFormat/statusProtocol/installArgsfor snapshot,broadcastProtocolfor ime) matched exactly.Gates:
pnpm check:tooling— green (lint, typecheck, layering, depgraph, production-exports, mcp-metadata, build, bundle-owner-files all pass).pnpm build:android— succeeds locally end-to-end, producingandroid/snapshot-helper/dist/*andandroid/ime-helper/dist/*at the unchanged paths.Android SDK was available in this environment, so both the byte-level comparison and
pnpm build:androidwere run directly rather than deferred — no additional CI/human verification should be needed for the build itself, though therelease-android-snapshot-helper.ymlworkflow change is still worth a real CI run before the next release to confirm theAGENT_DEVICE_ANDROID_HELPER: snapshotenv var wiring works end-to-end in Actions.Test plan
pnpm check:toolingpnpm build:android(local, real Android SDK)release-android-snapshot-helper.ymlworkflow run in real CI (not exercised here — recommend confirming on the next release)