Skip to content
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

Open
wolfs opened this issue Dec 17, 2020 · 1 comment
Open

Add better support for code formatting and checking tasks #15616

wolfs opened this issue Dec 17, 2020 · 1 comment
Labels
a:feature A new functionality in:execution-engine incremental, up-to-date, overlapping outputs in:writing-tasks task option

Comments

@wolfs
Copy link
Member

wolfs commented Dec 17, 2020

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 and spotlessApply. spotless is a cacheable incremental task which does the analysis and outputs possible required changes. Then spotlessCheck and spotlessApply 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 the spotlessApply task have a cyclic dependency regarding their outputs: spotlessApply consumes the output of spotless (the analysis) and spotless consumes the output of spotlessApply (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

wolfs added a commit that referenced this issue Jan 11, 2021
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.
wolfs added a commit that referenced this issue Jan 12, 2021
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.
@stale
Copy link

stale bot commented Apr 17, 2022

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.

@stale stale bot added the stale label Apr 17, 2022
@wolfs wolfs removed the stale label Apr 19, 2022
@lptr lptr added in:execution-engine incremental, up-to-date, overlapping outputs in:writing-tasks task option labels Jun 7, 2022
@ov7a ov7a added the a:feature A new functionality label Aug 10, 2023
@lptr lptr removed the @execution label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:execution-engine incremental, up-to-date, overlapping outputs in:writing-tasks task option
Projects
None yet
Development

No branches or pull requests

4 participants