Last active
March 17, 2017 16:42
-
-
Save childnode/2f0b22f58ed25a8e4c9d62a93bea8b8b to your computer and use it in GitHub Desktop.
multiproject gradle runDefaultTasks on any subproject
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
// 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' |
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
// 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