I'm new to writing plugins for gradle and am following the examples here:
https://docs.gradle.org/current/userguide/structuring_software_products.html
Under "build-logic/commons/src/main/groovy" there are gradle files which I want to pass a value to for when the file is compiled and a value for when the plugin is being run. How do you do this?
So here is the sample code:
plugins {
id('java')
}
group = 'com.example.myproduct'
dependencies {
implementation(platform("com.example.platform:product-platform:${build_version}"))
testImplementation(platform("com.example.platform:test-platform:${run_version}"))
}
The idea is to specify the value ${build_version} when the "groovy-gradle-plugin" is being run (so the value is compiled into the plugin) and allow the ${run_version} to be specified when the generated plugin is run.
It's not clear to me how to set either of these values (even after lots of searching). Also, as a note, if I hard code values in, the generated plugin works as expected.
I have tried using
ext {
build_version = "1.0"
}
but nothing seems to work