In my plugin I use RuleSource to override native toolchain (for C++ plugins, e.g. gcc/clang) and version via command line:
But in Gradle 9.x I have got runtime error: The following model rules could not be applied due to unbound inputs and/or subjects: PluginImpl.Rules#validateToolChains(NativeToolChainRegistry, ModelMap<Task>) subject: - <no path> NativeToolChainRegistry (parameter 1) [*] inputs: - tasks ModelMap<Task> (parameter 2) [*] - indicates that a model item could not be found for the path or type.
Same as in the other thread, don’t miss the release notes and upgrade notes.
This time it is Upgrading to Gradle 9.0.0 where you learn that those plugins no longer use the delegated model infrastructure, so for Gradle 9 you need to adapt your logic and either have a version switch or publish two variants of your plugin (if done right, the according variant is selected automatically).
Usually, you should also have gotten deprecation warnings latest with 8.14.3. Gradle folks usually do breaking changes only in major versions and only after a deprecation cycle.
I have read about Upgrading Gradle 9.0 and Implementing model rules in a plugin , but still have no ideas how I can change toolChains and project version without RuleSource on validation stage.
Could you please advise some proper way?
Let me explain what my question about.
I already know how to change toolchain and project version, but I need do it before project has been configured. The RuleSource allow to add handler on validation stage:
static class Rules extends RuleSource {
@Validate
public void validateToolChains(NativeToolChainRegistry toolChains, ModelMap<Task> tasks) {
// Here project validation handler
}
How can I add handler on project for validation stage without RuleSource?