-
Notifications
You must be signed in to change notification settings - Fork 34
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
Gradle: use new lazy tasks API when supported (Gradle 4.9+) #145
Comments
Hi thanks for opening this issue! I was looking at this API last weekend and decided to defer that until I released the new version. It's too risky to do this now. I'd like to get the Java 11 compatible version out first, including the fixes for sourceSets and the Gradle plugin portal. The current code had some problems with order of initialization, so this brings another lazy evaluation that needs to be thoroughly tested. |
Fwiw, the plugin could also use lazy configuration instead of And wrt the lazy tasks API, I haven't had any issue moving to that in my own plugins and builds; you of course have to be cautious and only do in the configure closures what cannot be done with a I understand you'd rather do a release before making those changes though. |
The convention mappings were the worst piece of code in Gradle. I am glad that it will be replaced. I did not fully understand how it works yet, but that's just a matter of time. Do you have a patch of one of your own plugins migrating to new APIs (including if/ten/else to support older versions)? I can look into it next weekend. |
Understood it. You change all current task properties to be |
The simplest is tbroyer/gradle-errorprone-plugin@eb0f35b but only covers |
See https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
This boils down to:
project.tasks.register
instead ofproject.tasks.create
project.afterEvaluate
anddependsOn
outside the configuration closure, and to act on the task (inproject.afterEvaluate
), usetask.configure { … }
astask
would then actually be aTaskProvider
.configureEach
instead ofall
project.tasks.named(…).configure { … }
instead ofproject.tasks[…].…
This can generally be done quite easily with a couple utility functions using version checks.
The text was updated successfully, but these errors were encountered: