forked from rsmod/rsmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle.kts
50 lines (43 loc) · 1.1 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
import java.nio.file.Files
import java.nio.file.Path
rootProject.name = "rsmod"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement {
plugins {
kotlin("jvm") version "1.9.0"
}
}
include(
"buffer",
"game",
"game:coroutines",
"game:events",
"game:map",
"game:pathfinder",
"game:protocol",
"game:scripts",
"json",
"log",
"plugins",
"toml",
"app"
)
includePlugins(project(":plugins"))
fun includePlugins(pluginProject: ProjectDescriptor) {
val pluginPath = pluginProject.projectDir.toPath()
Files.walk(pluginPath).forEach {
if (!Files.isDirectory(it)) {
return@forEach
}
searchPlugin(pluginProject.name, pluginPath, it)
}
}
fun searchPlugin(parentName: String, pluginRoot: Path, currentPath: Path) {
val hasBuildFile = Files.exists(currentPath.resolve("build.gradle.kts"))
if (!hasBuildFile) {
return
}
val relativePath = pluginRoot.relativize(currentPath)
val pluginName = relativePath.toString().replace(File.separator, ":")
include("$parentName:$pluginName")
}