egordorichev/LastTry

View on GitHub
mods/subprojects.gradle

Summary

Maintainability
Test Coverage
// This magically allows subdirs in this subproject to themselves become sub-subprojects in a proper tree structure
new File(rootDir, 'mods').eachDir { possibleSubprojectDir ->
    def subprojectName = 'mods:' + possibleSubprojectDir.name
    //println "Gradle is reviewing module $subprojectName for inclusion as a sub-project"
    File buildFile = new File(possibleSubprojectDir, "build.gradle")
    if (buildFile.exists()) {
        println "mods $subprojectName has a build file so counting it complete and including it"
        include subprojectName
        def subprojectPath = ':' + subprojectName
        def subproject = project(subprojectPath)
        subproject.projectDir = possibleSubprojectDir
    } else {
        println "***** WARNING: Found a module without a build.gradle, corrupt dir? NOT including $subprojectName *****"
    }
}