-
Notifications
You must be signed in to change notification settings - Fork 23
/
settings.gradle
87 lines (75 loc) · 2.54 KB
/
settings.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright (c) 2016, Project Haystack Corporation
// Licensed under the Academic Free License version 3.0
//
// History:
// 10 Mar 2016 Richard McElhinney Creation
import groovy.io.FileType
import groovy.io.FileVisitResult
pluginManagement {
apply from: 'environment.gradle'
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == 'com.tridium') {
useModule('com.tridium.tools:niagara-plugins:4.1.5')
}
}
}
repositories {
maven {
url "${gradle.ext.niagara_home}/etc/m2/repository"
}
gradlePluginPortal()
}
}
def discoveredProjects = [:] as Map<String, File>
ext {
// CONFIGURE your sub-project folders here.
// This will include ALL sub-folders as sub-projects.
niagaraRoots = ['.']
// To explicitly define sub-project folders, name them in the array like this
//niagaraRoots = ['componentLinks', 'envCtrlDriver']
// CONFIGURE any directories to exclude from search for nested sub-projects
excludeDirs = ['.hg', 'build', 'out', 'src', 'srcTest', 'lib', 'test', 'libJar', 'docs']
}
// OR set the 'userRepos' gradle property.
//
if (hasProperty('userRepos')) {
settings.ext.niagaraRoots += userRepos.split(",").collect()
}
// my-settings.gradle.
//
def mySettings = file('my-settings.gradle')
if (mySettings.exists()) {
apply from: mySettings
}
def environment = file('environment.gradle')
if (environment.exists()) {
apply from: environment
}
// DO NOT MODIFY the niagaraRoots configuration
niagaraRoots.collect({ file(it) }).findAll({ it.exists() }).each { File projectRoot ->
projectRoot.traverse(
type: FileType.DIRECTORIES,
preRoot: true,
preDir: { File projectDir ->
def projectName = projectDir.name
if (excludeDirs.contains(projectName)) {
return FileVisitResult.SKIP_SUBTREE
}
File buildScript = new File(projectDir, "${projectName}.gradle")
if (buildScript.exists()) {
discoveredProjects[projectName] = projectDir
include projectName
return FileVisitResult.SKIP_SUBTREE
}
}
)
}
// Can we change the rootproject.name?
rootProject.name = 'nhaystack'
rootProject.children.each { project ->
project.projectDir = discoveredProjects[project.name]
project.buildFileName = "${project.name}.gradle"
assert project.projectDir.isDirectory()
assert project.buildFile.isFile()
}