forked from SpongePowered/Sponge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
124 lines (110 loc) · 4.05 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import org.spongepowered.gradle.vanilla.repository.MinecraftRepositoryExtension
pluginManagement {
repositories {
maven("https://repo.spongepowered.org/repository/maven-public/") {
name = "sponge"
}
}
plugins {
// Default plugin versions
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("org.spongepowered.gradle.sponge.dev") version "2.1.1"
id("net.kyori.indra.licenser.spotless") version "3.0.1"
id("implementation-structure")
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.6"
id("com.github.ben-manes.versions") version "0.42.0"
}
}
plugins {
id("org.spongepowered.gradle.vanilla")
id("org.gradle.toolchains.foojay-resolver-convention") version("0.3.0")
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) // needed for forge-loom, unfortunately
repositories {
maven("https://repo.spongepowered.org/repository/maven-public/") {
name = "sponge"
}
maven("https://repo.spongepowered.org/repository/quiltmc/") {
name = "quiltmc"
mavenContent { releasesOnly() }
}
}
}
rootProject.name = "Sponge"
extensions.configure(MinecraftRepositoryExtension::class) {
injectRepositories(false)
}
// Set up project structure
if (!file("SpongeAPI/gradle.properties").exists()) {
throw InvalidUserDataException("""
The SpongeAPI submodule required to build does not appear to be set up.
To correct this, run
git submodule update --init --recursive
from the project's checkout directory.
""".trimIndent())
}
includeBuild("build-logic")
includeBuild("SpongeAPI") {
dependencySubstitution {
substitute(module("org.spongepowered:spongeapi")).with(project(":"))
}
}
include(":SpongeVanilla")
project(":SpongeVanilla").projectDir = file("vanilla")
include("modlauncher-transformers")
include("generator")
include("modlauncher-patcher")
val testPlugins = file("testplugins.settings.gradle.kts")
if (testPlugins.exists()) {
apply(from = testPlugins)
} else {
testPlugins.writeText(listOf(
"// Uncomment to enable client module for debugging",
"//include(\":testplugins\")"
).joinToString(separator = System.lineSeparator(), postfix = System.lineSeparator()))
}
val testPluginsEnabledInCi: String = startParameter.projectProperties.getOrDefault("enableTestPlugins", "false")
if (testPluginsEnabledInCi.toBoolean()) {
include(":testplugins")
}
val spongeForge = file("spongeforge.settings.gradle.kts")
if (spongeForge.exists()) {
apply(from = spongeForge)
} else {
spongeForge.writeText(listOf(
"// Uncomment to enable SpongeForge module.",
"// By default only Sponge and SpongeVanilla are made available",
"//include(\":SpongeForge\")",
"//project(\":SpongeForge\").projectDir = file(\"forge\")"
).joinToString(separator = System.lineSeparator(), postfix = System.lineSeparator()))
}
val spongeForgeEnabledInCi: String = startParameter.projectProperties.getOrDefault("enableSpongeForge", "false")
if (spongeForgeEnabledInCi.toBoolean()) {
include(":SpongeForge")
project(":SpongeForge").projectDir = file("forge")
}
// Include properties from API project (with api prefix)
val apiProps = file("SpongeAPI/gradle.properties")
if (apiProps.exists()) {
val props = java.util.Properties()
apiProps.bufferedReader(Charsets.UTF_8).use {
props.load(it)
}
val extraProperties = mutableMapOf<String, String>()
props.stringPropertyNames().forEach { key ->
val value = props.getProperty(key)
if (value != null) {
if (key.startsWith("api")) {
extraProperties[key] = value
} else {
extraProperties["api${key.capitalize()}"] = value
}
}
}
gradle.beforeProject {
val extraExt = project.extensions.extraProperties
extraProperties.forEach { (k, v) -> extraExt.set(k, v) }
}
}