Skip to content

Skip apply and check when their format task is excluded - #3225

Open
Asimmirzac wants to merge 1 commit into
diffplug:mainfrom
Asimmirzac:skip-apply-when-format-task-excluded
Open

Asimmirzac wants to merge 1 commit into
diffplug:mainfrom
Asimmirzac:skip-apply-when-format-task-excluded

Conversation

@Asimmirzac

Copy link
Copy Markdown

Fixes #2097

spotlessApply copies the files from the output of the format task over the sources. With gradlew compileJava -x spotlessJava, the format task does not run, so spotlessJavaApply used the output of an earlier build and could overwrite newer edits.

The apply and check tasks of a format are now disabled when their format task is not in the task graph, as suggested in the issue. The check uses task paths, so no tasks are realized, and it works with the configuration cache.

ExcludedSpotlessTaskTest covers apply and check with the format task excluded (with and without the configuration cache), and apply when it is not excluded. The changelog entry is in plugin-gradle/CHANGES.md.

This change was prepared with AI assistance (Claude Code).

🤖 Generated with Claude Code

`spotlessApply` copies the files in the output of the format task over the
sources. With `-x spotlessJava` the format task does not run, so apply used
the output of an earlier build and could overwrite newer edits. Now the
apply and check tasks of a format are disabled when the format task is not
in the task graph.

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

This branch has not been deployed

No deployments
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.

gradle: excluding spotlessJava should also exclude spotlessApply

1 participant