2

I'm trying to use gradle to build simple native application. The below is an example code from Gradle documentation of native plugins.

model {
    components {
        main(NativeLibrarySpec) {
            sources {
                cpp {
                    source {
                        srcDirs "src/main/cpp", "src/shared/c++"
                        include "**/*.cpp"
                    }
                    exportedHeaders {
                        srcDirs "src/main/include", "src/shared/include"
                    }
                }
            }
        }
    }
}

I have several questions:

  1. 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?

  2. 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?

  3. Where from does cpp name go on? I see that NativeLibrarySpec has the sources method has prototype void sources(Action<? super ModelMap<LanguageSourceSet>> 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?

Gradle is a nightmare for me..

sandye51
  • 91
  • 9
  • Hi, I am also new to gradle, and struggling with a lot of the same questions. While I cannot answer all your questions, here is some advice. There are two diffrent ways to do gradle builds: the "project" way and the "model" way, and the two differ significantly. The model way is the new approach that will be used in gradle 3, which is why the new (and still experimental!) c/++ plugins are using it. Look at [this](https://docs.gradle.org/current/userguide/nativeBinaries.html) and [this](https://docs.gradle.org/current/userguide/new_model.html) for more info. Good Luck! – Kapenaar Dec 18 '15 at 08:03

0 Answers0