-
Notifications
You must be signed in to change notification settings - Fork 41
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
Support incremental processing #256
Comments
Interesting suggestion; would you happen to know which version of Gradle support We support Gradle versions all the way back to 4.10, which restricts us quite a bit unfortunately. |
If you want to support 4.10, you could ship two classes for the tasks: one that uses 4.10 API only, and another one that is Gradle 5+ or 6+ or whatever. Then you could register the relevant class based on the runtime Gradle version. It would enable incremental processing for the ones who have Gradle 5.4+ (released Apr 16, 2019) |
Gradle 5.4 was released almost 5 years ago. Most Gradle plugins I am familiar with tend to focus on supporting the latest two major versions or even only the latest. |
For non-scanning recipes which only need to visit the modified sources, this should indeed be doable. |
It takes openrewrite ~15sec to scan the classpath when searching for the recipes, so I excluded Unfortunately, the current Then, to implement incremental processing, OpenRewrite should track "which files used which classes". Here's what I get with per-project openrewrite processing in Apache JMeter:
"add a space to a private Java method in "add a space to a private Kotlin method in |
@vlsi Gradle Java plugin supports incremental compilation, so I assume it should be doable here as well. |
Another approach is proposed at #77. |
#77 is an approach to estimate "which files were changed", however, it does not solve the case when its dependency changes (see #256 (comment) regarding |
We should distinguish between incremental builds (running OpenRewrite on an delta changed set of files) and up-to-date checking. For up-to-date checking you just need to declare the inputs (which can be done via api). Outputs should already be declared actually. Though the value is a bit questionable given that it would be all or none. https://docs.gradle.org/current/userguide/incremental_build.html#sec:task_input_output_runtime_api |
What problem are you trying to solve?
Currently,
rewriteRun
andrewriteDryRun
can take noticeable time (e.g. 30 seconds for not-so-big pgjdbc/pgjdbc) even when running back-to-back.It is inconvenient when using OpenRewrite as the main code formatter.
Describe the solution you'd like
I want to make OpenRewrite process files incrementally, so it uses changed files as entry points. Then OpenRewrite could skip processing the files that have already been processed.
Gradle provides
@Incremental
machinery (see https://docs.gradle.org/current/userguide/custom_tasks.html#sec:implementing_an_incremental_task) for task inputs, so it should be feasible to make the task incremental and build cacheable.See sample implementation at https://github.com/autostyle/autostyle/blob/0ebc8855d62a20b347fd1d1655977ebf25e4bf9b/plugin-gradle/src/main/kotlin/com/github/autostyle/gradle/AutostyleTask.kt#L84-L105
The text was updated successfully, but these errors were encountered: