What do model, component words mean? I read about the model rules, but I don’t get the idea and new syntax. Model looks like the method invocation, but there is not such method in Project class. The same for components, where is it from?
The second questions is about syntax main(NativeLibrarySpec) { .. }. What does it mean? It looks like method invocation, but why do we use the NativeLibrarySpec interface name as a parameter?
Where from does cpp name go on? I see that NativeLibrarySpec has the sources method has prototype void sources(Action<? super ModelMap> action) and what does ? super … mean? I don’t understand why do we use the name cpp? How can I find out this in documentation?
The model { } block represents the Gradle model, which is the future way of configuring Gradle projects, separate from “legacy” configuration based around Project. You can inspect the model by running the model report with gradle model. You can find some definitions of the different types of the software model in the latest use guide.
This syntax means “create a new NativeLibrarySpec named main”.
Here cpp is a CppSourceSet which is added by the ‘cpp’ plugin. The <? super ModelMap> is just Java generics for “I expect an Action that requires a ModelMap (or a super of ModelMap)”. In general, anywhere you see Action<? super SomeType> you can pass a Groovy closure that delegates to that type. So in this the sources { } block configures a ModelMap<LanguageSourceSet>. In this case this collection has a single source set, cpp.
Many thanks for the response. Could you add documentation link where I can find the answers by myself?
This syntax means “create a new NativeLibrarySpec named main”.
About this
Here cpp is a CppSourceSet which is added by the ‘cpp’ plugin
And this.
I read all the docs and probably I missed something. How can I understand what do plugins add to the model or project? I want to understand all the stuff that I able to configure.
The model { } block represents the Gradle model
Does it mean that all script block must be located in model? What does model mean in terms of OOP? Is it method, variable, script block or what?