Hi, Please tell me the the way to define project dependencies supported for the CPP projects.
I do see this is supported for Java code, however I tried to use same syntax to define project dependencies for CPP project but its not working. like :
This is working fine when I have projects with some library dependency. However I am not able to solve the below scenario with this approach.
We have multiple projects and those not necessarily library depends on each other, but we need to follow some specific sequence of execution of projects.
As some projects are completely independent but this will publish header files to common folder and that will be referred by the subsequent project. So this scenario I am not able solve using gradle.
Summary is, How to set project dependency without linking dependant library?
I’m not sure I understand what you mean by “execute both projects” - presumably you want to execute some set of tasks from the subprojects using a single task in the root project?
If so, I would inject into each subproject a task that aggregates all tasks that I want to run. For instance, in the root build.gradle:
Then you can just run “gradle compile” from the root and it will run all “compile” tasks in all subprojects. Similarly, you can run the same from a subproject and it will run all compile tasks for that particular project.
You could also create an aggregator task in the root project that depends on individual subproject tasks if you need to be more explicit.
Thanks Gary, It does the compilation only. Actually I want to execute all the default task specified in those projects, not only compile. How do I do this.
Sorry, I forgot that defaultTasks is a list of Strings instead of Task objects. Evaluation order gets in the way a little bit, too. The following will work: