-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.gradle.kts
64 lines (59 loc) · 2.34 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* 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/6.7/userguide/multi_project_builds.html
*/
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
val projectName = "qwe"
val profile: String by settings
val pools = mutableMapOf(
projectName to arrayOf(":core"),
"http" to arrayOf("http:shared", "http:client", "http:server", "http:openapi"),
"sql" to arrayOf(/*"sql", "sql:api", "sql:type"*/),
"micro" to arrayOf(
":micro:config",
":micro:metadata",
":micro:circuit-breaker",
":micro:discovery",
":micro:rpc"
),
"storage" to arrayOf("storage:json"),
"validator" to arrayOf("validator"),
"examples" to arrayOf(
"examples:shared",
"examples:systemd",
"examples:docker",
"examples:fatjar",
"examples:cluster-node"
),
"integtest" to emptyArray()
)
val docs = arrayOf(":docs")
val excludeCISonar = docs
val excludeCIBuild = pools["examples"]!! + pools["integtest"]!! + excludeCISonar
pools.putAll(mapOf("$projectName:docs" to pools[projectName]!!.plus(docs)))
fun flatten(): List<String> = pools.values.toTypedArray().flatten()
rootProject.name = "$projectName-parent"
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]") }
}.forEach { include(it) }
//project(":micro:micro-config").projectDir = file("micro/config")
//project(":micro:micro-metadata").projectDir = file("micro/metadata")
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"))
}