Skip to content

Instantly share code, notes, and snippets.

@mediavrog
Created February 10, 2023 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediavrog/1b8aa51b8e273405cc0d1276bd92d5d7 to your computer and use it in GitHub Desktop.
Save mediavrog/1b8aa51b8e273405cc0d1276bd92d5d7 to your computer and use it in GitHub Desktop.
Include gradle modules from a directory automatically
/**
* Include all modules in a directory at once.
*/
def includeAllModules(def modulesDirName, def modulePrefix = '') {
file("$rootDir/$modulesDirName").eachDir { dir ->
if (file("$dir/build.gradle").exists() || file("$dir/build.gradle.kts").exists()) {
include "${modulePrefix}:${dir.name}"
project("${modulePrefix}:${dir.name}").projectDir = dir
}
}
}
include(":app")
includeAllModules("feature-modules")
includeAllModules("sdk/ads', ":ads")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment