forked from fanruan/design
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
712 B
29 lines
712 B
5 years ago
|
def getRootGradle() {
|
||
|
def currentGradle = gradle
|
||
|
while (currentGradle.parent) {
|
||
|
currentGradle = currentGradle.parent
|
||
|
}
|
||
|
return currentGradle
|
||
|
}
|
||
|
|
||
|
def findHookIncludedBuild() {
|
||
|
def rootGradle = getRootGradle()
|
||
|
def hookProject = rootGradle.getIncludedBuilds()
|
||
|
.find({ build -> build.name == 'hook' })
|
||
|
return hookProject
|
||
|
}
|
||
|
|
||
|
def findGlobalConfig() {
|
||
|
def hookProject = findHookIncludedBuild()
|
||
|
if (hookProject) {
|
||
|
def path = hookProject.projectDir.parent + '/globalConfig.gradle'
|
||
|
if (file(path).exists()) {
|
||
|
return path
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
def globalConfigPath = findGlobalConfig()
|
||
|
if (globalConfigPath) {
|
||
|
apply from: globalConfigPath
|
||
|
}
|