I’m building a project which has 2 sub projects: 1 shared lib and 1 exe.
The exe build.gradle has the following line:
lib project: “:lib_project”, library: “lib”, linkage: "static"
Each sub project has its own build.gradle.
I’m building on Windows 7.
When I run an install task on the exe project, the library project DLL isn’t installed in the install directory.
When I tried to change linkage to “shared” the link step fails, because lib.lib is missing.
I’m now trying to add my own tasks to the exe project to copy the shared lib artifacts when the exe project install tassks are called.
However I can’t access any of the tasks in the native plugin.
E.g. Adding the following code to the exe build.gradle causes a build error:
task installLibrary << {
println(“installLibrary”)
} // end of task installAplLibrary
Yes I’ve taken a look at the multi project sample. I’m now changing my project to match.
However what I want is the ability to have a multi project setup, where each component has it’s build.gradle.
The current multi project setup is not scale-able in my opinion.
It’s good for a limited number of components, but it becomes messy if you have multiple libraries and multiple apps, where each client depends on a some of the libraries. You will end up with a very large build.gradle file that will hold all the data for all the projects. This will become harder and harder to maintain as the number of projects increases.
I think it would be better to have the components of a build.gradle based not just of the contents in that file, but also in any project file it depends on.
One more suggestion - add some tasks (even empty ones) that will allow hooking additional tasks that do custom build steps.
E.g.
Add a preBuild task that will allow code generation tasks.
Add a postBuild task that will allow some custom tests, or file copies