forked from SpongePowered/Sponge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
123 lines (108 loc) · 3.95 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
import org.spongepowered.gradle.vanilla.repository.MinecraftRepositoryExtension
pluginManagement {
repositories {
mavenLocal()
maven("https://repo.spongepowered.org/repository/maven-public/") {
name = "sponge"
}
maven("https://maven.fabricmc.net/")
maven("https://maven.architectury.dev/")
gradlePluginPortal()
}
plugins {
// Default plugin versions
id("org.spongepowered.gradle.vanilla") version "0.2"
id("org.cadixdev.licenser") version "0.6.0"
id("com.github.johnrengelman.shadow") version "7.0.0"
id("org.spongepowered.gradle.sponge.dev") version "1.0.3"
id("implementation-structure")
id("org.jetbrains.gradle.plugin.idea-ext") version "1.0"
id("com.github.ben-manes.versions") version "0.39.0"
id("fabric-loom") version "0.9-SNAPSHOT"
id("com.github.logicfan.gradle.shadow.json-transformer") version "1.0.1"
}
}
plugins {
id("org.spongepowered.gradle.vanilla")
id("fabric-loom")
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) // needed for forge-loom, unfortunately
repositories {
maven("https://repo.spongepowered.org/repository/maven-public/") {
name = "sponge"
}
mavenLocal()
}
}
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("generator")
include(":SpongeFabric")
project(":SpongeFabric").projectDir = file("fabric")
val testPlugins = file("testplugins.settings.gradle.kts")
if (testPlugins.exists()) {
apply(from = testPlugins)
} else {
testPlugins.writeText("// Uncomment to enable client module for debugging\n//include(\":testplugins\")\n")
}
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("// Uncomment to enable SpongeForge module.\n" +
"// By default only Sponge and SpongeVanilla are made available\n" +
"//include(\":SpongeForge\")\n" +
"//project(\":SpongeForge\").projectDir = file(\"forge\")\n")
}
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) }
}
}