Sharing configuration across many tasks

I have a plugin where I’d like to share configuration information across different instances of tasks using the plugin. My initial, naive attempt was to use a singleton object. That works, but of course, that singleton persists in the daemon so the settings “bleed” across different builds.

Is there a canonical right way to do this? Should I extend the project object somehow or something?

Sounds like you need an extension object

See the flyway plugin for inspiration where there’s a “flyway” extension object used to configure the database url, username, password etc. All the tasks (flywayMigrate, flywayBaseline etc) use the extension object values (with the option to override in specific tasks by configuring the task)

You can use lazy configuration to avoid timing issues

Sounds perfect. Thank you!

Ironically, I had all the right pieces in place, I’d just failed to compose them in a rational way.