Skip to content

ADFA-5263: Delete copyToTestDir, which copied a jar nothing reads - #1739

Merged
davidschachterADFA merged 2 commits into
stagefrom
task/ADFA-5263-copytotestdir
Aug 26, 2026
Merged

ADFA-5263: Delete copyToTestDir, which copied a jar nothing reads#1739
davidschachterADFA merged 2 commits into
stagefrom
task/ADFA-5263-copytotestdir

Conversation

@davidschachterADFA

@davidschachterADFA davidschachterADFA commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

:subprojects:tooling-api-model:copyToTestDir copied the module's jar to <root>/tests/test-home/.cg/init/model.jar. Nothing reads that file, and nothing reads that directory.

The only consumer of a "test home" is gradle-plugin's test helper, and it resolves FileProvider.testHomeDir()testing/resources/test-home, a different directory — then writes its own init script there from PluginUnderTestMetadataReading.readImplementationClasspath(). It never asks for a model jar. A grep for model.jar across the repo returns only the task that produced it.

The destination has drifted before: 2a841748b (Feb 2023) is literally "fix: invalid path specified in copyToTestDir", and #1161 renamed .androidide.cg inside it.

Three problems leave with it

  • into(rootProject.mkdir(...)) ran at configuration time. Merely realizing the task created directories in the source tree — on --dry-run, and again after every clean. That is why tests/test-home kept reappearing when nothing had run.
  • outputs.upToDateWhen { false } on both the copy and jar meant any build touching this module re-jarred and re-copied unconditionally.
  • Its output being a directory inside the source tree is what tripped Gradle's implicit-dependency validation against Spotless — ADFA-5244, which I worked around at the consumer by excluding the directory from the Spotless walk (ADFA-5244: Make CI able to catch the Spotless/source-tree failure #1730).

Verified

  • The jar still builds.
  • tests/ is no longer created at configuration time — deleted it, ran a configuration pass, it stayed gone.
  • :app:assembleV8Debug succeeds with the task absent from the graph.
  • :common:compileV8DebugKotlin spotlessCheck — the exact invocation ADFA-5244 was filed for — passes on this branch, which carries no Spotless exclude at all. That is the point: fixing the producer removes the need for the workaround rather than making it permanent.

Relationship to #1730

#1730 excludes tests/ from the Spotless walk to stop the symptom. If this lands, that exclude is dead weight and should be reverted; if #1730 lands first, this makes it removable. Whichever goes second should drop it — I'll do that as soon as the order is known. The CI guard #1730 adds (running a compile task together with spotlessCheck) is worth keeping either way, since it catches this whole class of failure.

The task copied tooling-api-model.jar to <root>/tests/test-home/.cg/init/model.jar.
Nothing reads that file, and nothing reads that directory.

The only consumer of a "test home" is gradle-plugin's test helper, which resolves
FileProvider.testHomeDir() -- testing/resources/test-home, a different directory
-- and then *writes its own* init script there, with a classpath from Gradle's
PluginUnderTestMetadataReading. It never asks for a model jar. A grep for
model.jar across the repo returned only the task that produced it.

The destination had drifted before: 2a84174 (Feb 2023) is "fix: invalid path
specified in copyToTestDir", and #1161 renamed .androidide to .cg inside it.

Removing it takes three problems with it:

- into(rootProject.mkdir(...)) ran at configuration time, so merely realizing the
  task created directories in the source tree -- on --dry-run, and again after
  every clean. That is why tests/test-home kept reappearing.
- outputs.upToDateWhen { false } on both the copy and jar meant any build
  touching this module re-jarred and re-copied unconditionally.
- Its output being a directory inside the source tree is what tripped Gradle's
  implicit-dependency validation against Spotless (ADFA-5244). That was worked
  around at the consumer by excluding the directory from the Spotless walk.

Verified: the jar still builds; tests/ is no longer created at configuration
time; :app:assembleV8Debug succeeds with the task absent from the graph; and
`:common:compileV8DebugKotlin spotlessCheck` -- the exact invocation ADFA-5244
was filed for -- now passes on this branch, which carries no Spotless exclude at
all. The two .gitignore entries that existed only for this task's output go too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae72e223-a36c-4c75-ab28-18fb3c470954

📥 Commits

Reviewing files that changed from the base of the PR and between 113b57f and f316abb.

📒 Files selected for processing (2)
  • .gitignore
  • subprojects/tooling-api-model/build.gradle.kts
💤 Files with no reviewable changes (2)
  • subprojects/tooling-api-model/build.gradle.kts
  • .gitignore

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough
  • Removed the unused copyToTestDir task and its JAR copy configuration.
  • Removed related .gitignore entries.
  • Prevented unnecessary test-directory creation and unconditional copy execution.
  • Preserved JAR generation.
  • Verified :app:assembleV8Debug and :common:compileV8DebugKotlin spotlessCheck.
  • Risk: Consumers that depend on tests/test-home/.cg/init/model.jar must provide the file through another mechanism.

Walkthrough

The change removes test artifact ignore rules from .gitignore and removes Gradle tasks that copied the tooling API model JAR into the test directory.

Changes

Test artifact cleanup

Layer / File(s) Summary
Remove test artifact handling
.gitignore, subprojects/tooling-api-model/build.gradle.kts
The repository no longer ignores test artifact paths. The Gradle build no longer copies the model JAR into the test directory or disables related up-to-date checks.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to f316a

This change removes an unused test-home jar copy and its configuration-time directory side effects while preserving the jar build and affected checks; no actionable merge-blocking risk remains.

Poem

A rabbit hops past files once ignored
Test artifacts now stand unhidden
The copy task rests in its burrow
Gradle checks its work as written
Clean paths guide the moonlit build

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: removal of the unused copyToTestDir task that copied a JAR.
Description check ✅ Passed The description directly explains the task removal, unused output, build issues, related Spotless behavior, and verification results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/ADFA-5263-copytotestdir

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@davidschachterADFA
davidschachterADFA merged commit 0596292 into stage Aug 26, 2026
4 checks passed
@davidschachterADFA
davidschachterADFA deleted the task/ADFA-5263-copytotestdir branch August 26, 2026 01:23
@davidschachterADFA

Copy link
Copy Markdown
Collaborator Author

Heads-up for anyone with a clone that predates this merge: you likely have a stale tests/ directory that nothing ignores any more.

rm -rf tests

Why it appears: copyToTestDir wrote tests/test-home/.cg/init/model.jar, and the two .gitignore rules this PR removed were what kept it out of git status. Deleting the task stops it being created; it does not delete what earlier builds already wrote. So a fresh clone is clean, and an existing one shows an untracked build artifact — one git add -A away from being committed, which is how ADFA-5264 happened.

I checked that this is only a leftover and not still being produced, since I initially suspected the opposite. On a fresh stage worktree:

  • :subprojects:tooling-api-model:jar (the task that used to be finalizedBy copyToTestDir) — BUILD SUCCESSFUL, no tests/
  • :common:testV8DebugUnitTest — BUILD SUCCESSFUL, no tests/
  • git status afterwards: no untracked files at all
  • git grep model.jar / tests/ on stage: no references

So the premise of this PR holds. The only residue is on disk in existing checkouts, and the fix is the one-liner above.

(For the record on how I misread it: a jar dated after this merge turned up in one of my worktrees, which looked like live creation. It was built ~9 minutes after this PR merged, but by a branch whose own stage merge predated it by 11 minutes — so copyToTestDir still existed in that tree. Timestamps on a build artifact say when the build ran, not which code it ran.)

davidschachterADFA added a commit that referenced this pull request Aug 27, 2026
Brings in ADFA-5263 (#1739), which deleted copyToTestDir independently,
and ADFA-5264 (#1740), which ignores the test project's .cg/ cache. With
both in, this branch's diff is the three files it actually changes.

Conflict was in .gitignore: stage removed both tests/ entries as part of
#1739. Kept this branch's tests/test-home line -- the gradle-plugin tests
still refill that directory -- and left the model.jar entry deleted,
since the task that wrote it is gone. Moved the entry out from under the
"Generated files for tooling API" header, which heads the composite-build
output dirs and not this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M4sTwYg47aK8VB9kRKZicU
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.

2 participants