-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add better support for code formatting and checking tasks #15616
Comments
For some use-cases there are cyclic dependencies with respect to input and output location of tasks. For example the spotless apply task depends on the output of the spotless analyze task, but also modifies the inputs (the sources) of the spotless analyze task. We don't have a better solution for this use-case, yet, so we don't want to emit a deprecation warning. So as long as there is an order relation in any direction, we do not emit a warning about missing dependencies between tasks. See #15616.
For some use-cases there are cyclic dependencies with respect to input and output location of tasks. For example the spotless apply task depends on the output of the spotless analyze task, but also modifies the inputs (the sources) of the spotless analyze task. We don't have a better solution for this use-case, yet, so we don't want to emit a deprecation warning. So as long as there is an order relation in any direction, we do not emit a warning about missing dependencies between tasks. See #15616.
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution. |
A code formatter does modify its own inputs, since it modifies the sources it checks. Currently, Gradle has poor support for having a cacheable or incremental task doing that.
The spotless plugin has a nice solution for it:
For the spotless plugin there are currently three tasks:
spotless
,spotlessCheck
andspotlessApply
.spotless
is a cacheable incremental task which does the analysis and outputs possible required changes. ThenspotlessCheck
andspotlessApply
depend on it, the first one checking that there are no required changes and the second one actually applying the changes. This allows the check and apply tasks to share expensive analysis.The main use-case for the using the build cache is to store the information that the sources pass the check, aka there is nothing to change.
The solution by the spotless plugin also has its downsides: The
spotless
and thespotlessApply
task have a cyclic dependency regarding their outputs:spotlessApply
consumes the output ofspotless
(the analysis) andspotless
consumes the output ofspotlessApply
(the sources). See #15615.It would be good to have a better way of modeling these kind of idempotent tasks in Gradle.
cc: @gradle/execution
The text was updated successfully, but these errors were encountered: