Skip to content

Instantly share code, notes, and snippets.

@childnode
Last active March 17, 2017 16:42
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 childnode/2f0b22f58ed25a8e4c9d62a93bea8b8b to your computer and use it in GitHub Desktop.
Save childnode/2f0b22f58ed25a8e4c9d62a93bea8b8b to your computer and use it in GitHub Desktop.
multiproject gradle runDefaultTasks on any subproject
// inspired by https://discuss.gradle.org/t/how-to-run-defaults-tasks-of-sub-project-rather-than-default-tasks-of-root-project/6575/6
task runDefaultTasks {
gradle.projectsEvaluated {
subprojects.each { subproject ->
//println subproject.path
subproject.defaultTasks.each {
//println subproject.path + ":" + it
dependsOn subproject.path + ":" + it
}
}
}
}
defaultTasks 'runDefaultTasks'
// some different module include handlings
def prefixInclude(String... submodules) {
def prefix = rootProject.name
submodules.each {
include it
project(':'+it).name = "${prefix}-${it}"
}
}
def includeAs(directory, moduleName) {
include moduleName
project(moduleName).projectDir = new File(directory)
}
prefixInclude(
'module1',
'module2'
)
includeAs('module3', ':module-three')
include ':commons',
'jenkins'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment