Hi. I’m migrating the old plugin gradle-pitest-plugin created in the times of Gradle 1.0 to the Provider/Property API.
One of the main case is a user ability to change the PIT (the tool I call from my plugin) version by overriding default value in the plugin extension. In the past I’ve been just call:
project.afterEvaluate {
project.rootProject.buildscript.dependencies
.add(PITEST_CONFIGURATION_NAME, "org.pitest:pitest-command-line:$extension.pitestVersion")
...
}
From the guide I know that it could be converted into:
Configuration pitestConfiguration = project.rootProject.buildscript.configurations
.create(PITEST_CONFIGURATION_NAME) {
...
}
pitestConfiguration.defaultDependencies { dependencies ->
dependencies.add(project.dependencies
.create("org.pitest:pitest-command-line:${extension.pitestVersion.get()}"))
}
However, the problem is to get the value defined by the user in build.gradle
(a default value is used).
What is a recommended way/place to create a plugin dependency that depends on a version provided by a user in a plugin configuration?