-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.gradle.kts
50 lines (47 loc) · 1.8 KB
/
settings.gradle.kts
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
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/7.3.3/userguide/multi_project_builds.html
*/
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
val projectName = "schedulerx"
val profile: String by settings
val pools = mutableMapOf(
projectName to arrayOf(":schedulerx", ":event-trigger-jsonschema"),
"sample" to emptyArray(),
"integtest" to emptyArray()
)
val docs = arrayOf(":docs")
val excludeCISonar = docs
val excludeCIBuild = pools["sample"]!! + pools["integtest"]!! + excludeCISonar
pools.putAll(
mapOf(
"$projectName:docs" to pools[projectName]!!.plus(docs)
)
)
fun flatten(): List<String> = pools.values.toTypedArray().flatten().toSet().toList()
rootProject.name = "$projectName-parent"
val pp = when {
profile.isBlank() || profile == "all" -> flatten().toTypedArray()
profile == "ciBuild" -> flatten().filter { !excludeCIBuild.contains(it) }.toTypedArray()
profile == "ciSonar" -> flatten().filter { !excludeCISonar.contains(it) }.toTypedArray()
else -> pools.getOrElse(profile) { throw IllegalArgumentException("Not found profile[$profile]") }
}
pp.forEach { include(it) }
if (pp.contains(":schedulerx")) {
project(":schedulerx").projectDir = file("core")
}
if (gradle is ExtensionAware) {
val extensions = (gradle as ExtensionAware).extensions
extensions.add("BASE_NAME", projectName)
extensions.add("PROJECT_POOL", pools.toMap())
extensions.add("SKIP_PUBLISH", excludeCIBuild + arrayOf(":docs", ":sample", ":integtest"))
}