Created
April 28, 2013 04:45
-
-
Save moksamedia/5475917 to your computer and use it in GitHub Desktop.
Gradle: to automatically discover subprojects and include them in your root project, put this in your settings.gradle file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Here we iterate over the directories found in the root directory of the | |
* main project, and if the subdirectory contains a build.gradle file, it | |
* is added to the main project as a subproject. | |
*/ | |
Closure discoverSubprojects = { | |
def list = [] | |
rootDir.eachDir(){ dir -> | |
dir.eachFileMatch({it == 'build.gradle'}, { list += [dir.name] }) | |
} | |
list.toArray(new java.lang.String[0]) | |
} | |
include discoverSubprojects() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! This is exactly what I want. I am about to implement an improved solution with Gradle, which includes all the required subprojects according the build.gradle compile project directives in the dependencies section.
Update: it works like a charm. https://github.com/nagypet/spvitamin