-
Notifications
You must be signed in to change notification settings - Fork 22
/
settings.gradle.kts
42 lines (35 loc) · 1.32 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
rootProject.name = "KTP-Course"
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
// To be able to use the Kotlin test framework for the tests - https://github.com/jetbrains-academy/kotlin-test-framework
maven(url = "https://packages.jetbrains.team/maven/p/kotlin-test-framework/kotlin-test-framework")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
plugins {
id("org.jetbrains.compose").version(extra["compose.version"] as String)
}
}
// Mark all task folders as a Gradle module
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 other common resources
include(
"common",
)