From 4d79e5e613659d3ccc5e079c178fd1299fa742c0 Mon Sep 17 00:00:00 2001 From: soloturn Date: Sat, 21 Oct 2023 23:09:04 +0200 Subject: [PATCH] convert settings.gradle to kotlin (#5147) Co-authored-by: jdrueckert --- 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..d50b1d33739 --- /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) + } + } + } + } +}