I currently have a groovy @Singleton annotation on the object and can thus create the instance in settings.gradle and call MyClass.instance to retrieve it in build.gradle (or the plugin code as is the case here). This is not pretty and with the multi threaded gradle daemon, CI servers, etc going on, using singleton JVM instances seems like a bad idea.
The object instance in question contains meta data about the multi-project structure and needs to be present configuration time, so something like:
//build.gradle
apply plugin: 'myplugin'
allprojects {
pluginConventionMethod {
..
}
}
(where the pluginConventionMethod needs the data from the object created in settings.gradle)
should work.
Any help much appreciated.