build: prepare subprojects.settings.gradle for kotlin (#5204)

This commit is contained in:
soloturn 2024-01-06 20:12:35 +01:00 committed by GitHub
parent 2f6b32c323
commit f3140efa1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 37 deletions

View file

@ -2,12 +2,12 @@
new File(rootDir, 'facades').eachDir { possibleSubprojectDir ->
if (!possibleSubprojectDir.name.startsWith(".")) {
def subprojectName = 'facades:' + possibleSubprojectDir.name
println "Processing facade $subprojectName, including it as a sub-project"
println("Processing facade $subprojectName, including it as a sub-project")
include subprojectName
def subprojectPath = ':' + subprojectName
def subprojectPath = ":" + subprojectName
def subproject = project(subprojectPath)
subproject.projectDir = possibleSubprojectDir
} else {
println "Ignoring entry $possibleSubprojectDir as it starts with ."
println("Ignoring entry $possibleSubprojectDir as it starts with .")
}
}

View file

@ -1,21 +1,22 @@
// Copyright 2020 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
// This magically allows subdirs to become included builds
// https://docs.gradle.org/6.4.1/userguide/composite_builds.html
file(".").eachDir { possibleIncludedBuildDirectory ->
File buildFile = new File(possibleIncludedBuildDirectory, "build.gradle")
File settingsFile = new File(possibleIncludedBuildDirectory, "settings.gradle")
if (buildFile.exists() && settingsFile.exists()) {
logger.info("{} will be included in the composite build.",
rootDir.relativePath(possibleIncludedBuildDirectory))
includeBuild(possibleIncludedBuildDirectory)
} else {
logger.warn("{} REJECTED as an included build. build.gradle: {}, settings.gradle: {}",
rootDir.relativePath(possibleIncludedBuildDirectory),
buildFile.exists() ? "present" : "MISSING",
settingsFile.exists() ? "present" : "MISSING"
)
// This magically allows subdirs in this subproject to themselves become sub-subprojects in a proper tree structure
// so getting a library and build it should work, e.g.:
// ./groovyw lib get TeraNUI
// ./gradlew :TeraNUI:build
new File(rootDir, 'libs').eachDir { possibleSubprojectDir ->
def subprojectName = ':libs:' + possibleSubprojectDir.name
File buildFile = new File(possibleSubprojectDir, "build.gradle")
File settingsFile = new File(possibleSubprojectDir, "settings.gradle")
if (!buildFile.exists()) {
logger.warn("***** WARNING: Found a lib without a build.gradle, corrupt dir? NOT including {} *****", subprojectName)
return
}
if (!settingsFile.exists()) {
logger.warn("lib {} has build.gradle, but no settings.gradle? NOT including it." subprojectName)
return
}
logger.info("lib {} has a build file so counting it complete and including it.", subprojectName)
includeBuild(possibleSubprojectDir)
}

View file

@ -1,13 +1,13 @@
// This magically allows subdirs in this subproject to themselves become sub-subprojects in a proper tree structure
new File(rootDir, 'metas').eachDir { possibleSubprojectDir ->
new File(rootDir, "metas").eachDir { possibleSubprojectDir ->
if (!possibleSubprojectDir.name.startsWith(".")) {
def subprojectName = 'metas:' + possibleSubprojectDir.name
println "Processing meta module $subprojectName, including it as a sub-project"
include subprojectName
def subprojectPath = ':' + subprojectName
def subprojectName = "metas:" + possibleSubprojectDir.name
println("Processing meta module $subprojectName, including it as a sub-project")
include(subprojectName)
def subprojectPath = ":" + subprojectName
def subproject = project(subprojectPath)
subproject.projectDir = possibleSubprojectDir
} else {
println "Ignoring entry $possibleSubprojectDir as it starts with ."
println("Ignoring entry $possibleSubprojectDir as it starts with .")
}
}

View file

@ -2,19 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
// This magically allows subdirs in this subproject to themselves become sub-subprojects in a proper tree structure
new File(rootDir, 'modules').eachDir { possibleSubprojectDir ->
def subprojectName = ':modules:' + possibleSubprojectDir.name
new File(rootDir, "modules").eachDir { possibleSubprojectDir ->
def subprojectName = ":modules:" + possibleSubprojectDir.name
File buildFile = new File(possibleSubprojectDir, "build.gradle")
File moduleTxt = new File(possibleSubprojectDir, "module.txt")
if (!buildFile.exists()) {
logger.warn("***** WARNING: Found a module without a build.gradle, corrupt dir? NOT including $subprojectName *****")
logger.warn("***** WARNING: Found a module without a build.gradle, corrupt dir? NOT including {} *****", subprojectName)
return
}
if (!moduleTxt.exists()) {
logger.warn("Module $subprojectName has build.gradle, but no module.txt? NOT including $subprojectName")
logger.warn("Module {} has build.gradle, but no module.txt? NOT including it.", subprojectName)
return
}
logger.info("Module {} has a build file so counting it complete and including it", subprojectName)
include subprojectName
logger.info("Module {} has a build file so counting it complete and including it.", subprojectName)
include(subprojectName)
}

View file

@ -2,15 +2,15 @@
// SPDX-License-Identifier: Apache-2.0
// This magically allows subdirs in this subproject to themselves become sub-subprojects in a proper tree structure
new File(rootDir, 'subsystems').eachDir { possibleSubprojectDir ->
new File(rootDir, "subsystems").eachDir { possibleSubprojectDir ->
if (!possibleSubprojectDir.name.startsWith(".")) {
def subprojectName = 'subsystems:' + possibleSubprojectDir.name
logger.info("Including '$subprojectName' as a sub-project")
include subprojectName
def subprojectPath = ':' + subprojectName
def subprojectName = "subsystems:" + possibleSubprojectDir.name
logger.info("Including '{}' as a sub-project.", subprojectName)
include(subprojectName)
def subprojectPath = ":" + subprojectName
def subproject = project(subprojectPath)
subproject.projectDir = possibleSubprojectDir
} else {
logger.info("Ignoring hidden folder '$possibleSubprojectDir'")
logger.info("Ignoring hidden folder '{}'.", possibleSubprojectDir)
}
}