Context: I have some code which builds up a multi-project structure. The code is called from settings.gradle. Part of the code needs to export custom properties both to the settings.gradle file (i.e. the code after the call which sets the properties should be able to access it) and to gradle build files.
This used to work by just using the “this” pointer available in the settings context (some mix between Script and Settings I assume) and setting properties on that.
With m9 however, running code like the following in settings.gradle:
ext.properties['foo'] = 'bar'
println "The value of foo is ${foo}"
results in:
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/mbjarland/tmp/extra_properties/settings.gradle' line: 3
* What went wrong:
A problem occurred evaluating settings 'extra_properties'.
> Could not find property 'foo' on settings 'extra_properties'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
How should I go about modifying the extra properties in settings.gradle?