Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
e6b2e26
ADFA-7138 Add sqlite-rewrite-runtime, the helpers the requery rewrite…
davidschachterADFA Nov 16, 2026
e392fe9
ADFA-7138 Rewrite android.database.sqlite to requery in the Gradle pl…
davidschachterADFA Nov 16, 2026
0c28568
ADFA-7138 Code on the Go injects the rewrite runtime AAR and checks t…
davidschachterADFA Nov 16, 2026
b65e593
ADFA-7138 Add the SQLite debugger AAR to debuggable variants when opt…
davidschachterADFA Nov 16, 2026
2a5cb6d
ADFA-7138 Apply the rewrite and the debugger from one opt-in property
davidschachterADFA Nov 16, 2026
9dc56f0
ADFA-7138 Do not apply or provision Quick Build for a project that op…
davidschachterADFA Nov 16, 2026
dd570d4
ADFA-7138 Add a script that checks an APK carries no SQLite debugger
davidschachterADFA Nov 16, 2026
4a9bc95
ADFA-7138 Docs: describe the SQLite rewrite and the Gradle wiring
davidschachterADFA Nov 16, 2026
2c78e0a
ADFA-7138 Quick Build opt-in check reads the sources Gradle's findPro…
davidschachterADFA Nov 16, 2026
4e4718f
ADFA-7138 Fail the build when a variant's runtime classpath cannot be…
davidschachterADFA Nov 16, 2026
3605133
ADFA-7138: Merge ADFA-7135 (with #2244's sqlite-js 1.4.3) up the stack
davidschachterADFA Nov 16, 2026
627aa94
ADFA-7138: Say how to turn the SQLite debugger on in an app
davidschachterADFA Nov 16, 2026
2394a80
ADFA-7138: Say how to build when the rewrite fails on a library class
davidschachterADFA Nov 16, 2026
810fe1c
ADFA-7138: Merge ADFA-7135 (README corrections) up the stack
davidschachterADFA Nov 16, 2026
efc07f7
ADFA-7138: Stub the module directory in the Quick Build provisioner f…
davidschachterADFA Nov 17, 2026
1407eae
ADFA-7138: Check a module's SQLite debugger opt-in after the sync too
davidschachterADFA Nov 17, 2026
7a22763
ADFA-7138: Require androidx.core in the rewrite's classpath check
davidschachterADFA Nov 17, 2026
1573878
ADFA-7138: Make every missing-member entry name its descriptors
davidschachterADFA Nov 17, 2026
9eb00a2
ADFA-7138: Merge ADFA-7135 (F18 one-statement check, F19 tool deadlin…
davidschachterADFA Nov 17, 2026
bc4889b
ADFA-7138: Merge ADFA-7135 (F37 backstop rollback, F38 get_schema tru…
davidschachterADFA Nov 17, 2026
57f7b08
ADFA-7138: Merge ADFA-7135 (F51 app functions, F52 get_schema limits)…
davidschachterADFA Nov 17, 2026
acab926
ADFA-7138: Quick Build status line says "off", not "setup failed", fo…
davidschachterADFA Nov 17, 2026
19c80cd
ADFA-7138: Merge ADFA-7135 (F108 integrity_check app functions, F109 …
davidschachterADFA Nov 17, 2026
0550b88
ADFA-7138 End a live Quick Build session in the refused state when th…
davidschachterADFA Nov 17, 2026
babc5fe
ADFA-7138 Drop the unused sqliteDebuggerMessage and share the AAR-pro…
davidschachterADFA Nov 17, 2026
b93bf8e
ADFA-7138 Document that the SQLite debugger opt-in is decided from al…
davidschachterADFA Nov 17, 2026
541a706
ADFA-7138 Watch every gradle.properties the SQLite debugger opt-in reads
davidschachterADFA Nov 17, 2026
5ebd1fc
ADFA-7138 Name the Quick Build refusal that replaced sqliteDebuggerMe…
davidschachterADFA Nov 17, 2026
b843c60
ADFA-7138 Describe the opt-in rule: the first file that defines it de…
davidschachterADFA Nov 17, 2026
875ec57
Merge sqlite-debugger/ADFA-7135 into sqlite-debugger/ADFA-7138
davidschachterADFA Nov 17, 2026
0e61956
ADFA-7138: Merge ADFA-7135 (F149 consumer rules, F151 recheck path, F…
davidschachterADFA Nov 17, 2026
90266f2
ADFA-7138 Narrow the watchedFiles KDoc to the modules the scan finds
davidschachterADFA Nov 17, 2026
a569ee8
ADFA-7138: Merge ADFA-7135 (F168 batch bound KDoc, F169 README batch …
davidschachterADFA Nov 17, 2026
98c2eb7
ADFA-7138: Merge ADFA-7135 (F172 first-row exception to the 4 MiB cap…
davidschachterADFA Nov 17, 2026
ebe4eda
ADFA-7138: Merge ADFA-7135 (F181 half-deadline KDoc, and stage with #…
davidschachterADFA Nov 17, 2026
27e004b
ADFA-7138 Run the release-APK guard on every push
davidschachterADFA Nov 18, 2026
298071c
ADFA-7138 Document that COPY_FRAMES cannot weaken another instrumenta…
davidschachterADFA Nov 18, 2026
61104a7
ADFA-7138 Warn about strings that name a class the rewrite moves to r…
davidschachterADFA Nov 18, 2026
9ca47ff
ADFA-7138 Run the release-APK guard without the Maven signing key
davidschachterADFA Nov 18, 2026
22d390f
ADFA-7138 Do not warn about a string that only contains a renamed cla…
davidschachterADFA Nov 18, 2026
6fd1fdc
ADFA-7138 Docs: say SqliteReleaseApkTest skips without its AAR paths …
davidschachterADFA Nov 18, 2026
9fedd91
ADFA-7138 Fail the build for a SQLiteQueryBuilder override of query w…
davidschachterADFA Nov 18, 2026
7e38a3f
ADFA-7138 Fail a call a rule could match when its owner cannot be res…
davidschachterADFA Nov 18, 2026
3bdeb36
ADFA-7138 Fail the build for an SQLite cursor used as an Android curs…
davidschachterADFA Nov 18, 2026
183a69f
ADFA-7138 Check the SQLite debugger opt-in again after the model wait…
davidschachterADFA Nov 18, 2026
1648b5a
ADFA-7138 Do not refuse Quick Build from the root opt-in before the m…
davidschachterADFA Nov 18, 2026
6259246
ADFA-7138 Replace the SQLite AARs in one rename when app init extract…
davidschachterADFA Nov 18, 2026
72e44e8
ADFA-7138 Accept an instanceof guard only when it holds on every path…
davidschachterADFA Nov 18, 2026
abf7002
ADFA-7138 Cancel every query that shares an Android CancellationSignal
davidschachterADFA Nov 18, 2026
68bf024
ADFA-7138 Docs: say a cancelled query throws androidx.core's Operatio…
davidschachterADFA Nov 18, 2026
ade142c
ADFA-7138 Look up the SQLite rewrite tests' jars in the active Gradle…
davidschachterADFA Nov 18, 2026
bf86cdd
ADFA-7138 Do not inherit constructors when the tests resolve a reference
davidschachterADFA Nov 18, 2026
0cab2d4
ADFA-7138 Bound the release-APK check script by its timeout before re…
davidschachterADFA Nov 18, 2026
7572ece
ADFA-7138 Check this run's helper in the transform test, not any cach…
davidschachterADFA Nov 18, 2026
5a2fd6e
ADFA-7138: Tapping the "Quick Build: off" status line shows the refus…
davidschachterADFA Nov 18, 2026
5ad480d
ADFA-7138 Delete a failed SQLite AAR copy's temp file, and sync it be…
davidschachterADFA Nov 18, 2026
586a9b9
ADFA-7138 Fail the build for an SQLite cursor stored into an Android …
davidschachterADFA Nov 18, 2026
db7781c
ADFA-7138 Docs: list getWindow() on an unresolvable SQLiteCursor subc…
davidschachterADFA Nov 18, 2026
229feb0
ADFA-7138 Say to retry when an SQLite AAR is missing right after Code…
davidschachterADFA Nov 18, 2026
f556c0c
ADFA-7138 Test that the SQLite rewrite tests find requery in a non-de…
davidschachterADFA Nov 18, 2026
85c3068
ADFA-7138: Warn, not fail, for an unresolvable owner unless the membe…
claude Nov 19, 2026
d392bf6
ADFA-7138 Fix the rewriter tests' comments about getUniqueId after th…
davidschachterADFA Nov 19, 2026
56e26ff
ADFA-7138 Docs: say which rule-table matches on an unresolvable class…
davidschachterADFA Nov 19, 2026
36bdf96
ADFA-7138 Pin the SQLite descriptor tokens and which unresolved-owner…
davidschachterADFA Nov 19, 2026
fbd4451
ADFA-7138 Check in a real AGP build that the unresolved-owner warning…
davidschachterADFA Nov 19, 2026
6e16bdb
ADFA-7138 Hold CancelForwarders weakly so a dropped signal's forwarde…
davidschachterADFA Nov 19, 2026
b0ceebe
ADFA-7138 Warn, not fail, for an unresolvable owner's setWindow(Curso…
davidschachterADFA Nov 19, 2026
d362637
ADFA-7138 Fail the build for an SQLite cursor stored into an Android …
davidschachterADFA Nov 19, 2026
30e7820
ADFA-7138 Keep an Android cursor array's tag across a merge with null…
davidschachterADFA Nov 19, 2026
9f84175
ADFA-7138 Log any exception from an SQLite AAR extraction, so the res…
davidschachterADFA Nov 19, 2026
f6c8bf0
ADFA-7138 Warn, not fail, for an SQLite cursor stored into an Android…
davidschachterADFA Nov 20, 2026
dbe5411
ADFA-7138 Treat a row loaded from a null array as null, so a merge ke…
davidschachterADFA Nov 20, 2026
95f1c49
ADFA-7138 Say an SQLiteCursor[] stored into an array of Android curso…
davidschachterADFA Nov 20, 2026
a91559d
ADFA-7138 Merge sqlite-debugger/ADFA-7135 into sqlite-debugger/ADFA-7…
davidschachterADFA Nov 20, 2026
e723fd8
ADFA-7138 Flash why Quick Build is greyed out when its status line is…
davidschachterADFA Nov 21, 2026
542307f
ADFA-7138 Count a row of an SQLiteCursor[] as an SQLite cursor in the…
davidschachterADFA Nov 21, 2026
e7d0da9
ADFA-7138 Test and document that a row of an SQLiteCursor[] is an SQL…
davidschachterADFA Nov 21, 2026
6858c9f
ADFA-7138 Follow a row of an SQLiteCursor[][] as an SQLiteCursor[] fo…
davidschachterADFA Nov 21, 2026
b68446b
ADFA-7138 Call onQuickBuildStatusLineTapped directly in the greyed-ou…
davidschachterADFA Nov 21, 2026
2ae43d2
ADFA-7138 Keep the cursor-array tag when a merge mixes SQLiteCursor[]…
davidschachterADFA Nov 21, 2026
f77079c
ADFA-7138 Test a 3D SQLite cursor array, and name the 1D merge test a…
davidschachterADFA Nov 21, 2026
b9e037f
ADFA-7138 Test that an SQLiteCursor[] merged with an Object[] or a 2D…
davidschachterADFA Nov 21, 2026
7b270b4
ADFA-7138 Test that merge keeps the cursor-array tag only for the sam…
davidschachterADFA Nov 21, 2026
b2d7bbe
ADFA-7138 Name the opt-out that works with property precedence
davidschachterADFA Nov 21, 2026
ece7a67
ADFA-7138 Find COLLATE UNICODE through comments and quotes, and not i…
davidschachterADFA Nov 21, 2026
6f0ee16
ADFA-7138 Reject a driver that declares both query overloads
davidschachterADFA Nov 21, 2026
cb95693
ADFA-7138 Check the missing-member descriptors by rebuilding them
davidschachterADFA Nov 21, 2026
e2690c8
ADFA-7138 Throw the NullPointerException for a null Context in delete…
davidschachterADFA Nov 21, 2026
d1f8094
ADFA-7138 Keep the status-line tap with the text it was bound for
davidschachterADFA Nov 21, 2026
bd26c30
ADFA-7138 Docs: name four rare false positives of the rewrite checks
davidschachterADFA Nov 21, 2026
918e5f7
ADFA-7138 Test the status-line tap wiring in EditorBottomSheet
davidschachterADFA Nov 22, 2026
5407497
ADFA-7138 README: name the opt-out that works with property precedence
davidschachterADFA Nov 22, 2026
f4cf4c3
ADFA-7138 COLLATE rule: a quoted name must end at its closing character
davidschachterADFA Nov 22, 2026
eec3d54
ADFA-7138 Docs: correct the cast and subclass false-positive sentences
davidschachterADFA Nov 22, 2026
c284f2c
ADFA-7138 Status-line tap: bind again when the refusal text is writte…
davidschachterADFA Nov 22, 2026
4bb66f7
ADFA-7138 Merge sqlite-debugger/ADFA-7135 into sqlite-debugger/ADFA-7…
davidschachterADFA Nov 22, 2026
9ff51c2
ADFA-7138 Docs: a cast to a non-SQLite cursor type can be a false pos…
davidschachterADFA Nov 22, 2026
f532ce6
ADFA-7138 Status-line tap test: place the sheet in a CoordinatorLayou…
davidschachterADFA Nov 22, 2026
3dc0d01
ADFA-7138 Merge sqlite-debugger/ADFA-7135 into sqlite-debugger/ADFA-7…
davidschachterADFA Nov 22, 2026
3412fe0
ADFA-7138 Quick Build tap: no "Replace the installed app?" when the S…
davidschachterADFA Nov 23, 2026
6926346
ADFA-7138 Quick Build SQLite debugger opt-in: decide it for the modul…
davidschachterADFA Nov 23, 2026
33c9bac
ADFA-7138 Reject OpenParams in array instructions (MULTIANEWARRAY, ar…
davidschachterADFA Nov 23, 2026
ae88e4f
ADFA-7138 COLLATE rule: a quoted or bracketed collation name needs no…
davidschachterADFA Nov 23, 2026
650d1fc
ADFA-7138 COLLATE rule: a block comment ends at its first star-slash
davidschachterADFA Nov 23, 2026
1651a0c
ADFA-7138 COLLATE LOCALIZED warning: say what happens to existing ind…
davidschachterADFA Nov 23, 2026
0a7a0b2
ADFA-7138 Runtime openOrCreateDatabase: throw for world-access modes …
davidschachterADFA Nov 23, 2026
bb6194e
ADFA-7138 sqlite-rewrite.md: an inherited query(CursorFactory, Object…
davidschachterADFA Nov 23, 2026
87f3017
ADFA-7138 SQLite debugger opt-out wording: name parent projects in th…
davidschachterADFA Nov 23, 2026
4ff13a5
ADFA-7138 COLLATE check: take each comment and whitespace run whole, …
davidschachterADFA Nov 23, 2026
7570c49
ADFA-7138 Merge sqlite-debugger/ADFA-7135 into sqlite-debugger/ADFA-7…
davidschachterADFA Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,21 @@ jobs:
exit "$status"
fi

# ADFA-7138: builds the minified release and the debug variant of a sample app that opted into the
# SQLite debugger, with the real debugger, rewrite runtime and requery AARs, and runs
# scripts/check-release-apk-no-sqlite-debugger.sh on both. The release must pass; the debug APK must
# fail, which shows the check still sees the debugger. The AARs it builds are the ones the assemble
# below bundles, so they are not built twice.
- name: Check that an opted-in app's release APK carries no SQLite debugger
run: |
command -v unzip || { sudo apt-get update && sudo apt-get install -y unzip; }
# The test stages :logger, :logsender and :build-info into build-local Maven repositories, which
# needs no signing. With the job's signing key present MavenPublishConf runs the Sign tasks, and
# they fail, so the key is left out of this step.
env -u ORG_GRADLE_PROJECT_signingInMemoryKey -u ORG_GRADLE_PROJECT_signingInMemoryKeyId \
-u ORG_GRADLE_PROJECT_signingInMemoryKeyPassword \
flox activate -d flox/base -- ./gradlew :gradle-plugin:sqliteReleaseApkTest --no-daemon

- name: Install advancecomp (advzip, used by recompressApk)
run: |
command -v advzip || { sudo apt-get update && sudo apt-get install -y advancecomp; }
Expand Down
5 changes: 3 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Strategy: **layer-and-subsystem based**, not feature-by-feature. The Gradle buil

- **`app` depends inward; libraries never depend on `app`.** Subsystems are consumed by `app`, not vice versa.
- **Vendored forks are substituted, not imported ad hoc.** `composite-builds/build-deps` and `build-deps-common` provide forked `javac`/`jdt`/`layoutlib`/etc.; `settings.gradle.kts` substitutes them in for `com.itsaky.androidide.build:*`. Don't add a Maven coordinate for something already substituted. Pebble is likewise built from source, as `subprojects:pebble`, for a lexer fix Android needs (its `NOTICE` says what changed); depend on `projects.subprojects.pebble`, not `io.pebbletemplates:pebble`.
- **All module config flows through `composite-builds/build-logic`.** Every Android module gets the `v7`/`v8` ABI flavors centrally (`AndroidModuleConf.kt`) — there is no flavorless `assembleDebug`. `:plugin-api`, `:subprojects:sqlite-js` and `:subprojects:sqlite-debugger`, libraries for other projects that need one artifact, are intentionally excluded from flavors.
- **All module config flows through `composite-builds/build-logic`.** Every Android module gets the `v7`/`v8` ABI flavors centrally (`AndroidModuleConf.kt`) — there is no flavorless `assembleDebug`. `:plugin-api`, `:subprojects:sqlite-js`, `:subprojects:sqlite-debugger` and `:subprojects:sqlite-rewrite-runtime`, libraries for other projects that need one artifact, are intentionally excluded from flavors.
- **`RepositoriesMode.FAIL_ON_PROJECT_REPOS`** — repositories are declared once in `settings.gradle.kts`; modules must not declare their own.
- **Avoid new dependencies.** Check `gradle/libs.versions.toml` first; the build almost certainly already has it.

Expand All @@ -104,11 +104,12 @@ Strategy: **layer-and-subsystem based**, not feature-by-feature. The Gradle buil
These structural facts shape every module. Day-to-day build *commands* live in `CLAUDE.md`; the rules that produce them live here.

- **Centralized convention logic.** All Android module setup flows through `composite-builds/build-logic` (`conf/AndroidModuleConf.kt`). Modules stay thin and share configuration, so understanding any module's setup starts here.
- **ABI product flavors.** Every Android module *except* `:plugin-api`, `:subprojects:sqlite-js` and `:subprojects:sqlite-debugger` gets two flavors on the `abi` dimension — `v7` (`armeabi-v7a`) and `v8` (`arm64-v8a`) — defined centrally. There is no flavorless variant; tasks are `assembleV8Debug`, `assembleV7Release`, etc.
- **ABI product flavors.** Every Android module *except* `:plugin-api`, `:subprojects:sqlite-js`, `:subprojects:sqlite-debugger` and `:subprojects:sqlite-rewrite-runtime` gets two flavors on the `abi` dimension — `v7` (`armeabi-v7a`) and `v8` (`arm64-v8a`) — defined centrally. There is no flavorless variant; tasks are `assembleV8Debug`, `assembleV7Release`, etc.
- **SDK levels** (`build-logic/.../build/config/BuildConfig.kt`): `COMPILE_SDK=36`, `MIN_SDK=28`, `TARGET_SDK=28`. **`TARGET_SDK` is deliberately pinned at 28:** higher targets enforce W^X (write-xor-execute), which blocks executing code from app-writable files. That is fatal for an on-device IDE that compiles and runs code (Gradle, `javac`, Termux binaries), so it is a hard requirement, not tech debt. `MIN_SDK_FOR_APPS_BUILT_WITH_COGO=16` is the floor for the apps a *user* builds with CoGo — distinct from CoGo's own `MIN_SDK`.
- **Native asset bundling.** The on-device LLM (`llama-impl`) ships as a per-flavor native AAR, wired through the root `build.gradle.kts` (`bundleLlamaV8Assets` / `assembleV8Assets`, …); prebuilt per-flavor assets live under `assets/release/v7/` and `assets/release/v8/`.
- **sqlite-js for apps built with CoGo** (ADFA-7082). `subprojects:sqlite-js` builds the AAR that the JavaScript-in-SQLite project template depends on: the sqlite-js release vendored (see its README), for arm64-v8a and armeabi-v7a, minSdk 26, without core-library desugaring. Nothing in CoGo depends on it. Its default entry point runs no code stored in a database; loading stored functions is a separate entry point, only for databases the app made, since loading runs their code. `test-sqlite-js.yml` runs its host tests on pull requests. The manual `release-sqlite-js.yml` publishes it to the moving `sqlite-js-latest` release, from which dev-assets fetches it into the template, as it fetches `plugin-api-latest` for the plugin template.
- **SQLite debugger for apps built with CoGo** (ADFA-7131). `subprojects:sqlite-debugger` builds an AAR with a debug-only SQLite debugger and MCP server for apps built with CoGo: a native extension on requery's SQLite plus a loopback HTTP server. Like sqlite-js it has no ABI flavors, and nothing in CoGo depends on it; see its README.
- **AARs bundled for apps built with CoGo.** `:logsender`, `:subprojects:sqlite-debugger` and `:subprojects:sqlite-rewrite-runtime` are built as AARs and bundled into the IDE's assets (`AndroidIDEAssetsPlugin`). Code on the Go extracts them and passes their paths to Gradle as properties, and its Gradle plugin injects each into the app: logsender and the debugger into debuggable variants, the rewrite runtime into every variant of a project with `cogo.sqliteDebugger=true`. `:subprojects:sqlite-rewrite-runtime` is Java-only, has no ABI flavors and holds the helpers the build-time rewrite to requery redirects to (ADFA-7138); see `gradle-plugin/docs/sqlite-rewrite.md`.
- **Native lib compression** (ADFA-2306, ADFA-4729). The app manifest hard-codes `android:extractNativeLibs="true"` (required: the installer must materialize libs in `nativeLibraryDir`, e.g. `libshizuku.so` is an executable the adb shell runs from there). That attribute overrides the `jniLibs.useLegacyPackaging` DSL, so AGP packages `lib/<abi>/*.so` deflate-compressed in **every** APK — ~5.9 MB smaller (`libtree-sitter-kotlin.so` alone is 4.18 MB → 339 kB). The trap is the `recompressApk` post-step (release always, debug in CI only): its no-compress lists in `app/build.gradle.kts` must NOT contain `"so"`, or it silently re-stores the libs and undoes the saving — which is what ADFA-2306 fixed for release and ADFA-4729 for CI debug. Locally built debug APKs (including the e2e farm's) never run that step and were always fine.
- **Quick Build shares the Gradle distribution's toolchain** (ADFA-4931). `:app`'s `quickBuildDaemonZip` leaves the Kotlin compiler and eight other jars out of the daemon zip, because the on-device Gradle distribution already carries them; `QuickBuildArtifactStager` links them in at provision time. That makes the daemon's Kotlin version the distribution's, so `:quickbuild:daemon` takes its Kotlin artifacts at `org.adfa.constants.GRADLE_DISTRIBUTION_KOTLIN_VERSION`, and `:app:quickBuildDistJarCheck` fails the build when the distribution it packages lacks a linked jar. See [ADR 0016](docs/adr/0016-quick-build-compiles-outside-gradle.md).
- **`app` package layout is by concern, not feature:** `activities`, `fragments`, `services`, `di`, `agent`, `viewmodel(s)`, `repositories`, `roomData`, `localWebServer`, `preferences`, `ui` (Compose screens live under `ui/compose`), `templates/manager` (the Manager screen's `.cgt`-parsing data layer, with direct filesystem access to `Environment.TEMPLATES_DIR` — distinct from the plugin-facing `IdeTemplateService` in `plugin-api`/`plugin-manager`), `utils`, ….
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ flox activate -d flox/local -- ./gradlew <task>
```

- **Debug APK (arm64, the usual target):** `flox activate -d flox/local -- ./gradlew :app:assembleV8Debug --parallel --max-workers=6`
- **Module unit tests:** `flox activate -d flox/local -- ./gradlew :editor:testV7DebugUnitTest` - unit tests are per-flavor, there is no plain `test` task. `:plugin-api`, `:subprojects:sqlite-js` and `:subprojects:sqlite-debugger` are the modules without flavors: `:plugin-api:testDebugUnitTest`.
- **Module unit tests:** `flox activate -d flox/local -- ./gradlew :editor:testV7DebugUnitTest` - unit tests are per-flavor, there is no plain `test` task. `:plugin-api`, `:subprojects:sqlite-js`, `:subprojects:sqlite-debugger` and `:subprojects:sqlite-rewrite-runtime` are the modules without flavors: `:plugin-api:testDebugUnitTest`.
- **Single unit test:** append `--tests "com.itsaky.androidide.SomeTest"` to the flavored task above.
- **Fast iteration:** during multi-file/multi-module changes, verify with targeted `:module:compileV8DebugKotlin`/`compileV8DebugJavaWithJavac` invocations (batch several modules into one Gradle call) rather than a full assemble. Reserve `:app:assembleV8Debug` for final end-to-end verification — it's slow (multi-minute) in this multi-module project, and running it after every small change adds up.
- **Long-running commands: narrate them, and background only the read-only ones.** Anything that can exceed ~60s — `assembleV8Debug`, a full test sweep, a cold Gradle invocation of any kind (daemon start plus configuring this many modules is ~20s before any task runs, and far worse under memory pressure), and `git push`, which runs Spotless through the hook — gets a line before it starts saying what is running and roughly how long it takes, and a status line every couple of minutes while it runs: elapsed time, the last output line, whether it is still progressing. A silent terminal is indistinguishable from a hang, and saying which it is is your job, not the user's to ask.
Expand All @@ -26,7 +26,7 @@ When the user names a CI/CD job ("the sonar job", "the analyze workflow"), read

### ABI product flavors (v7 / v8)

Every module except `:plugin-api`, `:subprojects:sqlite-js` and `:subprojects:sqlite-debugger` carries `v7` (`armeabi-v7a`) and `v8` (`arm64-v8a`) flavors, so build tasks are `assembleV8Debug`, `assembleV7Release`, etc. — there is **no** flavorless `assembleDebug`. Those three build one artifact for other projects. See [ARCHITECTURE.md](ARCHITECTURE.md) (Build & Module Configuration) for flavors, native asset bundling, and SDK levels.
Every module except `:plugin-api`, `:subprojects:sqlite-js`, `:subprojects:sqlite-debugger` and `:subprojects:sqlite-rewrite-runtime` carries `v7` (`armeabi-v7a`) and `v8` (`arm64-v8a`) flavors, so build tasks are `assembleV8Debug`, `assembleV7Release`, etc. — there is **no** flavorless `assembleDebug`. Those four build one artifact for other projects. See [ARCHITECTURE.md](ARCHITECTURE.md) (Build & Module Configuration) for flavors, native asset bundling, and SDK levels.

### Emulator / device

Expand Down
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ dependencies {
// (QuickBuildArtifactStager).
evaluationDependsOn(":quickbuild:runtime")
evaluationDependsOn(":quickbuild:daemon")
// The assets plugin bundles its release AAR (ADFA-7131).
evaluationDependsOn(":subprojects:sqlite-debugger")
evaluationDependsOn(":subprojects:sqlite-rewrite-runtime")

// ADFA-4931: jars the daemon loads from the on-device Gradle distribution instead of shipping its
// own copy, since `gradle-dists/` and `quickbuild/` both sit under <ANDROIDIDE_HOME>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.appdevforall.cotg.quickbuild.domain.session.QuickBuildTone
import org.appdevforall.cotg.quickbuild.domain.session.toTone
import org.appdevforall.cotg.quickbuild.service.session.QuickBuildSessionManager
Expand Down Expand Up @@ -150,10 +151,13 @@ class QuickBuildAction(
private val tapInFlight = AtomicBoolean(false)

/**
* Runs a Quick Build tap: save the open files, confirm replacing an installed app, then
* hand the tap to [sessionManager]. The toolbar button and the plugin API both start
* Quick Build here, so they cannot drift apart.
* Runs a Quick Build tap: save the open files, confirm replacing an installed app unless the
* SQLite debugger will refuse the build, then hand the tap to [sessionManager]. The toolbar
* button, the status line's "tap for details" and the plugin API all start Quick Build here,
* so they cannot drift apart.
*
* @param refusedForSqliteDebugger read off the main thread after the save: true when the
* provisioner will refuse the build because the project turns the SQLite debugger on.
* @param beforeSession asked on the main thread just before the tap reaches the session;
* false drops it, for a caller that cancelled while the tap was saving or asking.
* @param onOutcome told once how the tap ended, unless the activity is destroyed or
Expand All @@ -163,20 +167,22 @@ class QuickBuildAction(
internal fun launchTap(
activity: EditorHandlerActivity,
sessionManager: QuickBuildSessionManager,
refusedForSqliteDebugger: () -> Boolean = { GradleQuickBuildProvisioner.refusesForSqliteDebugger() },
beforeSession: () -> Boolean = { true },
onOutcome: (TapOutcome) -> Unit = {},
): Job? {
if (!tapInFlight.compareAndSet(false, true)) {
log.info("Quick Build: a tap is already in flight; dropping this one")
return null
}
return startTap(activity, sessionManager, beforeSession, onOutcome)
return startTap(activity, sessionManager, refusedForSqliteDebugger, beforeSession, onOutcome)
.also { it.invokeOnCompletion { tapInFlight.set(false) } }
}

private fun startTap(
activity: EditorHandlerActivity,
sessionManager: QuickBuildSessionManager,
refusedForSqliteDebugger: () -> Boolean,
beforeSession: () -> Boolean,
onOutcome: (TapOutcome) -> Unit,
): Job =
Expand Down Expand Up @@ -209,6 +215,19 @@ class QuickBuildAction(
onOutcome(TapOutcome.SAVE_FAILED)
return@launch
}
// Read after the save, which can write a gradle.properties the user just edited, and
// before the activity check, since it leaves the main thread.
val refused =
withContext(Dispatchers.IO) {
try {
refusedForSqliteDebugger()
} catch (e: Exception) {
// Unknown, so ask about the installed app as a tap always did; the provisioner
// still makes its own check.
log.warn("Quick Build: could not read the SQLite debugger opt-in; asking about the installed app", e)
false
}
}
if (activity.isDestroyed || activity.isFinishing) {
log.info("Quick Build: the activity went away during the save; dropping the tap")
onOutcome(TapOutcome.ACTIVITY_GONE)
Expand All @@ -218,7 +237,7 @@ class QuickBuildAction(
// project's real applicationId. If the Standard Run build currently occupies that
// id, a tap replaces it, so the activity confirms the clobber first and the build
// proceeds only on accept.
if (!activity.awaitQuickBuildClobberConfirmed()) {
if (!replaceConfirmedUnlessRefused(refused) { activity.awaitQuickBuildClobberConfirmed() }) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: the replace question is skipped on the tap's own refusal check, but the provisioner decides again after it waits for the model. If the two disagree, the tap installs over the Standard Run app without asking.

Not reproduced (PLAUSIBLE): the tap reads a stale model whose first app module opts in (refused = true, no question). A sync then publishes a model whose Quick Build module does not opt in, or the line is removed before provisioning. sqliteDebuggerRefusal after the wait returns null, and the proxy app replaces the installed app under the same applicationId with no "Replace the installed app?" (ADFA-4128).

Have the provisioner ask for the confirmation itself when the tap skipped it and its own check says "not refused", or pass the tap's decision through so the provisioner refuses instead of installing.

onOutcome(TapOutcome.DECLINED)
return@launch
}
Expand All @@ -235,6 +254,21 @@ class QuickBuildAction(
onOutcome(TapOutcome.STARTED)
}

/**
* Whether a tap may go on to the session, as far as replacing the installed app goes. Not
* asked when the SQLite debugger will refuse the build: the provisioner refuses before
* anything is staged or installed, so the question would be about a replacement that cannot
* happen, and its Cancel would hide the refusal that explains why Quick Build is off. The
* session then shows that refusal, as the banner and as the status line's "tap for details".
*
* @param refused whether the SQLite debugger will refuse the build.
* @param confirm asks the user, on the main thread; true to replace the installed app.
*/
internal suspend fun replaceConfirmedUnlessRefused(
refused: Boolean,
confirm: suspend () -> Boolean,
): Boolean = refused || confirm()

/**
* The one bit the tap carries across the save/watch boundary: whether the save-all
* will write anything. SaveResult does not say, but saveAllResult only writes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,13 +799,7 @@ open class EditorHandlerActivity :
// path's tint and disabled dim here.
icon = toolbarIcon(action.icon, action.createColorFilter(data), action.enabled),
hint = getToolbarContentDescription(action, data),
onClick = {
if (action.enabled) {
registry.executeAction(action, data)
} else if (action.id == QuickBuildAction.ID) {
QuickBuildAction.disabledReason(this)?.let(::flashInfoLong)
}
},
onClick = { tapToolbarAction(registry, action, data) },
onLongClick = {
// Quick Build is a split button: long-press opens the
// Quick Build / Restart session / Help dropdown instead of the
Expand Down Expand Up @@ -881,9 +875,7 @@ open class EditorHandlerActivity :
popup.setOnMenuItemClickListener { item ->
when (item.itemId) {
R.id.action_quick_build -> {
// Through the registry, same as Standard Run below, so the menu entry
// and the toolbar tap share one code path (incl. the analytics event).
if (quickBuild != null && quickBuild.enabled) registry.executeAction(quickBuild, data)
runQuickBuildAction(data)
true
}

Expand All @@ -909,6 +901,37 @@ open class EditorHandlerActivity :
popup.show()
}

/**
* A tap on a toolbar button: runs its action through the registry, or, while the Quick Build
* button is greyed out, flashes why (ADFA-6574).
*/
private fun tapToolbarAction(
registry: DefaultActionsRegistry,
action: ActionItem,
data: ActionData,
) {
if (action.enabled) {
registry.executeAction(action, data)
} else if (action.id == QuickBuildAction.ID) {
QuickBuildAction.disabledReason(this)?.let(::flashInfoLong)
}
}

/**
* Taps the toolbar's Quick Build button, through the button's own tap, so the dropdown row and a
* status line that asks for a tap do what the button does (including the analytics event): run
* Quick Build, or, while the button is greyed out, flash the reason the button gives.
*/
private fun runQuickBuildAction(data: ActionData) {
val registry = getInstance() as DefaultActionsRegistry
val quickBuild = registry.findAction(EDITOR_TOOLBAR, QuickBuildAction.ID) ?: return
tapToolbarAction(registry, quickBuild, data)
}

override fun onQuickBuildStatusLineTapped() {
runQuickBuildAction(createToolbarActionData())
}

private fun createToolbarActionData(): ActionData {
val data = ActionData.create(this)
val currentEditor = getCurrentEditor()
Expand Down
Loading
Loading