I am trying to use gradle to both build my c-source and to do some pre and post build tasks (run a few scripts).
How can I use dependOn with the NativeExecutableSpec tasks of my software model?
More conrete, let’s assume I have the gradle.build file as in Example 72.32 in Native Software with an additional task “preBuild” defined outside the model closure. If I write mainExecutable.dependsOn preBuild, I get an error:
Could not find property ‘mainExecutable’ on root project
Is it possible to use dependencies on these tasks or is there some other way to achieve the same thing?
If I do this I seem to hide the task mainExecutable that is created by the model-dsl (runing gradle mainExecutable does not build my source code anymore)
Aha, will try this.
I ended up having a compile.gradle file containing the sw-model and another build.gradle file. In the build.gradle I have a task of BuildType that runs the mainExecutable task in the compile.gradle file. It works, but I prefer your way.
No, but I do find I have a tendency to do my model blocks in smaller chunks. I find it more clear than scrolling up through a long model block to see the structure. Just a preference. Is there a reason not to? Would there be any significant performance penalty during parsing?