From 4c75c5c3a0e33a7fecda4bde55cb6a58a10b2e69 Mon Sep 17 00:00:00 2001 From: soloturn Date: Sun, 8 Oct 2023 09:03:46 +0200 Subject: [PATCH] convert settings.gradle to kotlin --- settings.gradle | 16 ---------------- settings.gradle.kts | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 2fb04fd5bd6..00000000000 --- a/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -import groovy.io.FileType - -rootProject.name = 'Terasology' - -includeBuild("build-logic") -include 'engine', 'engine-tests', 'facades', 'metas', 'libs', 'modules' - -// Handy little snippet found online that'll "fake" having nested settings.gradle files under /modules, /libs, etc -rootDir.eachDir { possibleSubprojectDir -> - - // First scan through all subdirs that has a subprojects.gradle in it and apply that script (recursive search!) - possibleSubprojectDir.eachFileMatch FileType.FILES, ~/subprojects\.settings\.gradle/, { subprojectsSpecificationScript -> - //println "Magic is happening, applying from " + subprojectsSpecificationScript - apply from: subprojectsSpecificationScript - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000000..0ed3f557895 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,18 @@ +rootProject.name = "Terasology" + +includeBuild("build-logic") +include("engine", "engine-tests", "facades", "metas", "libs", "modules") + +// Handy little snippet found online that'll "fake" having nested settings.gradle files under /modules, /libs, etc +rootDir.listFiles()?.forEach { possibleSubprojectDir -> + if (possibleSubprojectDir.isDirectory && possibleSubprojectDir.name != ".gradle") { + possibleSubprojectDir.walkTopDown().forEach { + it.listFiles { file -> file.isFile && file.name == "subprojects.settings.gradle" }?.forEach { subprojectsSpecificationScript -> + //println("Magic is happening, applying from $subprojectsSpecificationScript") + apply { + from(subprojectsSpecificationScript) + } + } + } + } +} \ No newline at end of file