Reputation: 377
I'm interested in using gradle in a multi-module project, I can re-use this question Gradle nested multi-projects with project compile dependencies and also illustrate on its dependencies
Root
|__ P1
| |_ PP1
| |_ PP2
|
|__ P2
|_PP3
|_PP4
As in the original question, I want to compile PP1 - but I only on-demand, otherwise I want to use the latest build jar-dependency.
dependencies {
compile(project(":P1:PP1"))
}
So ideally I want something like
dependencies {
compile(compileFromSourceCodeOrLoadJar(project(":P1:PP1"), 'P1:PP1'))
}
where it will be compiled if the source files in PP1 directory are newer than the latest built jar. The idea is to compile only if it is strictly necessary. The decision can be made from last modified timestamps of source files vs jar file.
To make it even more complicated and potentially efficient, the decision should be made based on Version Control System output - if there are any changes since time X or revision R - then checkout and compile; otherwise use the jar dependency.
Has anyone solved this problem? I guess it can be solved with a custom gradle/groovy plug-in, but someone must have solved it already?
Thanks.
Upvotes: 0
Views: 255
Reputation: 123890
There are plans for Gradle to support a distributed build cache, but it's not yet available. Implementing this well without touching the Gradle codebase will probably be difficult (I'm not aware of any such effort). A regular Maven/Ivy repo may not be the best place to keep cached build results.
Upvotes: 1