-
Notifications
You must be signed in to change notification settings - Fork 3
/
settings.gradle.kts
34 lines (29 loc) · 1000 Bytes
/
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
rootProject.name = "CSC_Kotlin_Course_Part2"
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven(url = "https://packages.jetbrains.team/maven/p/kotlin-test-framework/kotlin-test-framework")
}
}
rootProject.projectDir.walkTopDown().forEach {
if (!isTaskDir(it) || it.path.contains(".idea") || it.path.contains("build") || it.path.contains("node_modules")) {
return@forEach
}
val taskRelativePath = rootDir.toPath().relativize(it.toPath())
val parts = mutableListOf<String>()
for (name in taskRelativePath) {
parts.add(sanitizeName(name.toString()))
}
val moduleName = parts.joinToString("-")
include(moduleName)
project(":$moduleName").projectDir = it
}
fun sanitizeName(name: String) =
name.replace("listOf( /\\\\:<>\"?*|())", "_").replace("(^listOf(.)+)|(listOf(.)+\$)", "")
fun isTaskDir(dir: File) = File(dir, "src").exists()
include(
"common",
"utils",
)