From f2bafe28e47f3ffd2376547ec5abe4bbe9df3896 Mon Sep 17 00:00:00 2001 From: David Schachter Date: Mon, 24 Aug 2026 18:07:01 -0700 Subject: [PATCH] ADFA-5263: Delete copyToTestDir, which copied a jar nothing reads The task copied tooling-api-model.jar to /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: 2a841748b (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 --- .gitignore | 2 -- subprojects/tooling-api-model/build.gradle.kts | 13 ------------- 2 files changed, 15 deletions(-) diff --git a/.gitignore b/.gitignore index af44d5bf1c..dec603ee97 100755 --- a/.gitignore +++ b/.gitignore @@ -104,8 +104,6 @@ sentry.properties .DS_Store # Generated files for tooling API -tests/test-home -/tests/**/.cg/init/model.jar /composite-builds/build-deps-common/constants/build/ /composite-builds/build-deps/build/ diff --git a/subprojects/tooling-api-model/build.gradle.kts b/subprojects/tooling-api-model/build.gradle.kts index 2c85462c59..49620778b5 100644 --- a/subprojects/tooling-api-model/build.gradle.kts +++ b/subprojects/tooling-api-model/build.gradle.kts @@ -31,16 +31,3 @@ dependencies { implementation(libs.common.jkotlin) } - -tasks.register("copyToTestDir") { - from(project.layout.buildDirectory.file("libs/tooling-api-model.jar")) - into(project.rootProject.mkdir("tests/test-home/.cg/init")) - rename { "model.jar" } - - outputs.upToDateWhen { false } -} - -project.tasks.jar { - finalizedBy("copyToTestDir") - outputs.upToDateWhen { false } -}