Skip to content

Instantly share code, notes, and snippets.

@NathanHowell
Created June 25, 2019 20:04
Show Gist options
  • Save NathanHowell/ff90272cc2a62b6239394eee27cfde19 to your computer and use it in GitHub Desktop.
Save NathanHowell/ff90272cc2a62b6239394eee27cfde19 to your computer and use it in GitHub Desktop.
Example settings.gradle to dynamically derive projects from build.gradle files
// find all build.gradle files in the expected locations in the build tree
fileTree('.')
.matching {
exclude '**/src/**', '**/build/**', '**/.*'
include '**/build.gradle'
}
.each {
// then convert the file path to a project path
final relative = rootProject.projectDir.relativePath(it.parentFile)
final project = ":${relative.replace('/', ':')}"
// and include it in the build
include project
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment