Hello, we are currently in the process of transitioning 250+ java and cpp projects from make scripts to gradle.
We use a custom gradle plugin as a base for a set of cpp projects. Inside the plugin we specify toolChains, platforms, etc. and a set of helper tasks.
From plugin:
@Override
public void apply(Project project) {
project.with {
apply plugin: 'cpp'
[...]
model {
toolChains {
visualCpp(org.gradle.nativeplatform.toolchain.VisualCpp) {
installDir output
windowsSdkDir windowsSdk
}
}
platforms {
win32 {
architecture "x86"
operatingSystem "windows"
}
win64 {
architecture "x86_64"
operatingSystem "windows"
}
}
}
[...]
}
}
Since switching from 2.2.1 to 2.4 we are no longer able to apply our plugin to a project build script and configure the project components.
From build script:
apply plugin: 'standardCppProject'
model {
buildTypes {
debug
release
}
components {
hello(NativeLibrarySpec) {
binaries.all {
sources {
source {
srcDir "src/hello/cpp"
include "**/*.cpp"
}
}
}
}
}
}
We get the following error message:
Cannot add Mutate rule ‘model.buildTypes’ for model element ‘buildTypes’ when element is in state GraphClosed.
Do you have an idea which would give us an oportunity to furthermore use a plugin to specify some parts of the model block in a plugin and other parts in the build script?