Sub-project as part of two root projects

(Ganesh) #1

Can I configure a sub-project to be part of two root projects in Gradle Multi-Project builds?

I am trying to perform Unit Tests on my system. (neither CUnit nor Google Tests Framework). I have a Unit test file in C and some dependencies (“stub files”) also in C. Lets call this as test files. My sources are compiled into partially linked objects using one of the root projects (respective component’s (module) sources are sub-projects to this root project). Now I have another root project which contains the configuration for creating an executable out of my test files and sources (in the .o form). The sub-projects for this root project is within the respective test directories. Now when I want to compile the test executable, I need to first create partially linked objects of my source files, create objects of my test files and then link all these objects together to form the executable.

For this purpose, I would need to have the gradle build file under test directory as a sub-project for both the root projects. Is it possible?