-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathsettings.gradle.kts
More file actions
219 lines (189 loc) · 6.19 KB
/
Copy pathsettings.gradle.kts
File metadata and controls
219 lines (189 loc) · 6.19 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
@file:Suppress("PropertyName")
pluginManagement {
repositories {
maven("https://maven.kikugie.dev/snapshots")
mavenLocal()
// Default
gradlePluginPortal()
mavenCentral()
}
plugins {
kotlin("jvm") version ("2.3.20")
}
}
plugins {
id("dev.kikugie.stonecutter") version "0.9"
id("org.gradle.toolchains.foojay-resolver-convention") version ("1.0.0")
}
interface ModLoader {
val name: String
fun buildFile(version: String): String
fun versionName(version: String): String
}
val stonecutterExt = stonecutter
val FABRIC: ModLoader = object : ModLoader {
override val name: String = "fabric"
override fun versionName(version: String) = "$version-fabric"
override fun buildFile(version: String) = if (stonecutterExt.eval(version, ">= 26.1")) {
"fabric.gradle.kts"
} else {
"fabric.obf.gradle.kts"
}
}
val NEO_FORGE: ModLoader = object : ModLoader {
override val name: String = "neoforge"
override fun versionName(version: String) = "$version-neoforge"
override fun buildFile(version: String) = "neoforge.gradle.kts"
}
val versions = buildList {
fun fabric(version: String) = add(version to listOf(FABRIC))
fun neoforge(version: String) = add(version to listOf(NEO_FORGE))
fun both(version: String) {
add(version to listOf(FABRIC))
}
both("26.2")
both("26.1")
both("1.21.11")
both("1.21.10")
both("1.21.8")
both("1.21.5")
both("1.21.4")
both("1.21.1")
}
stonecutter {
create("minecraft") {
versions.forEach { (version, loaders) ->
loaders.forEach { loader ->
version(loader.versionName(version), version).buildscript = loader.buildFile(version)
}
}
}
// The bootstrap tree mirrors every Fabric node of the minecraft tree. Each
// node JiJ-includes the matching platform jar plus all modules and deps.
create("bootstrap") {
versions.forEach { (version, loaders) ->
loaders.filter { it == FABRIC }.forEach { loader ->
version(loader.versionName(version), version).buildscript = loader.buildFile(version)
}
}
}
}
dependencyResolutionManagement {
versionCatalogs {
create("fabric") {
from(files(rootProject.projectDir.resolve("gradle/fabric.versions.toml")))
}
create("neoforge") {
from(files(rootProject.projectDir.resolve("gradle/neoforge.versions.toml")))
}
versions.forEach { (version, loaders) ->
val common = "common$version".replace(".", "")
create(common) {
println("creating version catalogue $common")
val file = rootProject.projectDir.resolve("gradle/common/$version.versions.toml")
if (!file.exists()) {
file.parentFile.mkdirs()
file.createNewFile()
}
from(files(file))
}
loaders.forEach { loader ->
val name = "${loader.name}$version".replace(".", "")
create(name) {
println("creating version catalogue $name")
val file = rootProject.projectDir.resolve("gradle/${loader.name}/$version.versions.toml")
if (!file.exists()) {
file.parentFile.mkdirs()
file.createNewFile()
}
from(files(file))
}
}
}
}
}
include(":modules")
project(":modules").apply {
buildFileName = "root.gradle.kts"
}
listOf(
"config",
"config-impl",
"commands",
"hud",
"events",
"notifications",
"ui",
"internal",
"dependencies",
//"dependencies:legacy",
"utils",
"relocator",
"poly-compose",
"compose-bundle",
).forEach { module ->
include(":modules:$module")
}
/*
val projectName: String = extra["project.name"]?.toString()
?: throw MissingPropertyException("mod.name has not been set.")
rootProject.name = projectName
if (rootDir.name != projectName) {
logger.error("""
Root directory name (${rootDir.absolutePath}) does not match project name ($projectName)!
This may cause issues with indexing and other tools (see https://youtrack.jetbrains.com/issue/IDEA-317606#focus=Comments-27-7257761.0-0 and https://stackoverflow.com/questions/77878944 ).
If you are experiencing issues, please rename the root directory to match the project name, re-import the project, and invalidate caches if you are on IntelliJ.
""".trimIndent())
}
// FOR ALL NEW VERSIONS MAKE SURE TO INCLUDE THEM IN root.gradle.kts !
include(":minecraft")
project(":minecraft").buildFileName = "root.gradle.kts"
/*
include(":bootstrap")
project(":bootstrap").buildFileName = "root.gradle.kts"
listOf(
"1.21.1-neoforge",
"1.21.1-fabric",
"1.21.4-neoforge",
"1.21.4-fabric",
"1.21.5-neoforge",
"1.21.5-fabric",
"1.21.8-neoforge",
"1.21.8-fabric",
"1.21.10-neoforge",
"1.21.10-fabric",
"1.21.11-neoforge",
"1.21.11-fabric",
"26.1-fabric"
).forEach { version ->
val proj = ":minecraft:$version"
include(proj)
project(proj).apply {
projectDir = file("minecraft/versions/$version").also {
if (!it.exists() && !it.mkdirs()) {
throw IllegalStateException("Could not create project directory: ${it.absolutePath}")
}
}
buildFileName = "../../build.gradle.kts"
}
val bootstrapProj = ":bootstrap:bootstrap-$version"
if (listOf(
"1.21.1-fabric",
"1.21.4-fabric",
"1.21.5-fabric",
"1.21.8-fabric",
"1.21.10-fabric",
"1.21.11-fabric",
// "26.1-fabric"
).contains(version)) {
include(bootstrapProj)
project(bootstrapProj).apply {
projectDir = file("bootstrap/versions/$version").also {
if (!it.exists() && !it.mkdirs()) {
throw IllegalStateException("Could not create project directory: ${it.absolutePath}")
}
}
buildFileName = "../../build.gradle.kts"
}
}
}*/