Николай Клебан
11/25/2025, 9:18 AMplugins {} block.Martin
11/25/2025, 9:30 AMplugins {} block is special and evaluated before the rest of the script.Martin
11/25/2025, 9:30 AMНиколай Клебан
11/25/2025, 9:39 AMtype variable in the project build script itself.
I can’t react to this type variable in afterEvaluate in plugin as it’s too late for my purposes. And whatever properties I set through extensions are evaluated after plugin was already applied.Martin
11/25/2025, 9:43 AMPlugin::apply to MyExtension::fooMartin
11/25/2025, 9:43 AMMartin
11/25/2025, 9:44 AMplugins {
id("my.plugin")
}
// You can use regular Kotlin here
val type = "someType"
myExtension {
// foo is a function so you can execute code inside and pass parameters
foo(type)
}Николай Клебан
11/25/2025, 9:56 AMMartin
11/25/2025, 9:58 AMProvider<T> and refer it from all your pluginsMartin
11/25/2025, 9:58 AMНиколай Клебан
11/25/2025, 12:18 PMWhiteLabelExt {
type: Property<Type>
}
And each plugin applies it’s part of setup depending on this type.
But the issue is that actual value is set after I applied plugins. So plugins have no value to work with.
I can’t delay configuration that plugin applies to something like afterEvaluate stage, and I haven’t figured out how I can setup some kind of observer pattern on my type property to execute configuration action as soon as property is set.ephemient
11/25/2025, 12:26 PMWhiteLabelExt {
setType(Type)
}
would be observable as soon as it's calledНиколай Клебан
11/25/2025, 12:33 PMephemient
11/25/2025, 12:36 PMwhiteLabelExt {
type = Type.FOO
}
syntax in consumers, so it might be a simple change to make (not binary compatible of course)Laura Kassovic
11/25/2025, 4:04 PMI need to trigger some action that will be set up in plugin that will be executed as soon as Property<Type> gets it actual value. Basically observer pattern with callbacksWould a custom task in your plugin work for this?
tasks.named("configureWhiteLabel") {
// runs after type is set
}Николай Клебан
11/25/2025, 4:32 PMWould a custom task in your plugin work for this?
Tasks will not help me as I need to configure the project during the configuration phase.
Laura Kassovic
11/25/2025, 4:40 PMafterEvaluate but there are others.Martin
11/25/2025, 4:48 PMНиколай Клебан
11/25/2025, 4:59 PMWould any of the lifecycle callbacks be useful?I don’t think so, callbacks like beforeProject seems like should be executed in settings and I really want to keep my configuration in the module build.gradle.kts
Why do you need that logic to happen during configuration phase?Basically I’m doing Android related configuration, adding flavors, and doing some work with tasks based on formed variants in AndroidComponentsExtension.onVariants
Martin
11/25/2025, 5:39 PMpluginManager.withId