Skip to content

Scripts and CI find the Gradle build through one location - #523

Merged
ramesh130 merged 2 commits into
mainfrom
issue-520-gradle-location
Oct 14, 2026
Merged

ramesh130 merged 2 commits into
mainfrom
issue-520-gradle-location

Conversation

@ramesh130

Copy link
Copy Markdown
Owner

Closes #520

Scripts and CI now find the Gradle build through one location per script family. Today that location is the repository root, so nothing behaves differently. #521 flips one value per family.

What changed

  • devicelab: lib/common.sh defines GRADLE_DIR="" (relative to the repo root) and GRADLE_ROOT beside REPO_ROOT. Everything that touches the Gradle build goes through GRADLE_ROOT:

    • lab (publish, demo build, APK path, and the gradle() log label)
    • moq-smoke
    • catalog_version's default catalog
    • sdk_root's local.properties

    Git operations (tree_state, the commit, the dirty check) stay at REPO_ROOT, because a run records the whole tree.

  • Plants: a new plant_git_apply runs git apply --directory=$GRADLE_DIR when GRADLE_DIR is non-empty. That covers check, apply, the -R revert, and selftest's --cached check of every shipped plant. The a/demo/… patches need no rewrite at the move. The git status cleanliness checks around a plant are repo-wide, so they need no change.

  • benchmark/bench: the Gradle build is derived from the script's own location as dirname $BENCH_HOME, so it moves with benchmark/ and has nothing to flip. The repository root now comes from git rev-parse --show-toplevel, so the dirty-tree warning still covers the whole repo after the move. It is resolved after argument parsing, so --help still works outside a checkout.

  • CI:

    • ci.yml and device-run.yml each carry one workflow-level env.GRADLE_DIR: ..
    • Every ./gradlew step in ci.yml uses working-directory: ${{ env.GRADLE_DIR }}, and the demo and benchmark steps use ${{ env.GRADLE_DIR }}/demo and ${{ env.GRADLE_DIR }}/benchmark.
    • setup-android-sdk takes a gradle-dir input with no default. A caller that omits it fails, naming the input.
    • The iOS change filter derives its superplayer-testmedia/ path from GRADLE_DIR. It produces the identical regex today; I checked it locally for both . and android.
  • Leak hunt: leak-hunt.yml reaches Gradle only through device-run.yml → devicelab/lab, so it is covered by the two values above. I checked this by inspection, since it needs a device.

What #521 must flip

  1. devicelab/lib/common.sh: GRADLE_DIR="" → GRADLE_DIR="android"
  2. .github/workflows/ci.yml: env.GRADLE_DIR: . → android
  3. .github/workflows/device-run.yml: env.GRADLE_DIR: . → android
  4. benchmark/bench: nothing, because it derives the location from where it sits.

Out of this unit and left for #521: .github/dependabot.yml's directories and .gitignore's /demo/build/.

Tests

  • New devicelab selftest cases:
    • the Gradle-location invariant: the wrapper and catalog exist where GRADLE_DIR says
    • the catalog and local.properties are read from a nested build when GRADLE_ROOT differs from the repo root
    • a plant applies and reverts cleanly under GRADLE_DIR=android in a nested scratch repo
    • control: the same plant is refused with GRADLE_DIR empty
  • devicelab/test/selftest: devicelab 161, jank 20, leak-hunt 34, startup 16, all passed.
  • ./gradlew assemble check --max-workers=1: green, verifyDevicelab included.
  • benchmark/bench --help and an argument refusal both work. I also ran a copy of bench placed at android/benchmark/bench in a scratch git repo with stub gradlews. It published from android/, ran the matrix from android/benchmark/, and the dirty-tree warning saw an untracked file at the repo root.
  • No emulator or device run. The device workflow and moq-smoke changes were checked by inspection.

Review

  • Standards: no hard findings. Fixed: the composite action's comment overclaimed that required is enforced, so it now names a missing gradle-dir explicitly; its stale description; and bench dying on --help outside a checkout. Left as is:
    • . in the workflows versus "" in shell. Each is idiomatic for its own setting.
    • One value per family rather than a single value across families. The issue asks for one per family, and a workflow cannot source common.sh before checkout or setup.
    • An unescaped GRADLE_DIR in the path ERE. android has no metacharacters.
    • The devicelab README and plants README do not mention GRADLE_DIR. That is Documents describe the android/ layout #522's docs work.
  • Spec: every criterion is met, with no scope creep. The plant rebasing is needed so the patches survive the move. The reviewer noted dependabot.yml, which is recorded above as Move the Android builds under android/ #521's.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe

ramesh130 and others added 2 commits October 14, 2026 12:39
…k runner and CI

devicelab reads GRADLE_DIR from lib/common.sh beside REPO_ROOT, and publishes, builds the demo, reads
the catalog and local.properties, runs the MoQ smoke and applies a plant under it, while git stays at
the repository root. bench derives the root build from its own place and the repository from git.
ci.yml and device-run.yml each carry one GRADLE_DIR, and setup-android-sdk takes it as an input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe
@ramesh130
ramesh130 merged commit 69fc30d into main Oct 14, 2026
3 checks passed
@ramesh130
ramesh130 deleted the issue-520-gradle-location branch October 14, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scripts and CI find the Gradle build through one location

1 participant