generated from jetbrains-academy/kotlin-course-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.gradle.kts
40 lines (34 loc) · 1.28 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
rootProject.name = "JetBrains Academy IntelliJ IDEA Plugin Development 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")
}
}
// 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()))
if (name.toString() == "resources") {
return@forEach
}
}
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",
)