aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason Penilla <[email protected]>2023-12-06 15:57:51 -0700
committerJason Penilla <[email protected]>2023-12-06 15:57:51 -0700
commit3b94cc35460c1a3135682325c241758d54f210fb (patch)
treeec8abd6f76b8c1a7a1151b81f76aa601eea34bb2
parentada77b3a3b3d1109d960b3f31121c9d0903874d5 (diff)
downloadPaper-3b94cc35460c1a3135682325c241758d54f210fb.tar.gz
Paper-3b94cc35460c1a3135682325c241758d54f210fb.zip
Clean up settings script
-rw-r--r--settings.gradle.kts24
1 files changed, 13 insertions, 11 deletions
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 9d90b914d6..f3117284e8 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -44,19 +44,21 @@ for (name in listOf("Paper-API", "Paper-Server", "Paper-MojangAPI")) {
findProject(":$projName")!!.projectDir = file(name)
}
-mapOf("test-plugin.settings.gradle.kts" to """
- // Uncomment to enable the test plugin module
- // include(":test-plugin")
- """.trimIndent(),
- "paper-api-generator.settings.gradle.kts" to """
- // Uncomment to enable the api generator module
- // include(":paper-api-generator")
- """.trimIndent()
-).forEach { (fileName, text) ->
- val settingsFile = file(fileName)
+optionalInclude("test-plugin")
+optionalInclude("paper-api-generator")
+
+fun optionalInclude(name: String, op: (ProjectDescriptor.() -> Unit)? = null) {
+ val settingsFile = file("$name.settings.gradle.kts")
if (settingsFile.exists()) {
apply(from = settingsFile)
+ findProject(":$name")?.let { op?.invoke(it) }
} else {
- settingsFile.writeText(text + "\n")
+ settingsFile.writeText(
+ """
+ // Uncomment to enable the '$name' project
+ // include(":$name")
+
+ """.trimIndent()
+ )
}
}