This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
build.gradle
329 lines (264 loc) · 9.16 KB
/
build.gradle
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'fabric-loom' version '0.11-SNAPSHOT' apply false
id 'com.matthewprenger.cursegradle' version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
}
class MinecraftVersion {
String mcVersion
String yarnVersion
String apiVersion
Origin origin
boolean oldLwjgl
MinecraftVersion(String mcVersion, String yarnVersion, String apiVersion, Origin origin = Origin.FABRIC, boolean oldLwjgl = false) {
this.mcVersion = mcVersion
this.yarnVersion = yarnVersion
this.apiVersion = apiVersion
this.origin = origin
this.oldLwjgl = oldLwjgl
}
MinecraftVersion(String mcVersion, String yarnVersion, Origin origin = Origin.FABRIC, boolean oldLwjgl = false) {
this(mcVersion, yarnVersion, "", origin, oldLwjgl)
}
}
enum Origin {
FABRIC,
LEGACY_FABRIC('https://maven.legacyfabric.net/net/fabricmc/intermediary/%1$s/intermediary-%1$s-v2.jar');
String customIntermediaryURL
Origin(url = "") {
this.customIntermediaryURL = url
}
}
class Globals {
static def baseVersion = "0.10.8"
static def changelog = "Fix reply not being sent to minecraft."
static def apiVersion = "0.1.2"
static def loaderVersion = "0.12.12"
static def versionInfo = [
new MinecraftVersion("22w03a", "4", "0.46.2+1.18"),
new MinecraftVersion("1.17.1", "65", "0.46.1+1.17"),
new MinecraftVersion("1.16.5", "10", "0.42.0+1.16"),
new MinecraftVersion("1.15.2", "17", "0.28.5+1.15"),
new MinecraftVersion("1.13.2", "202201182041", Origin.LEGACY_FABRIC),
new MinecraftVersion("1.12.2", "202201182040", /*"1.1.1+1.12.2",*/ Origin.LEGACY_FABRIC),
new MinecraftVersion("1.8.9", "202201182040", /*"1.1.0+1.8.9",*/ Origin.LEGACY_FABRIC, true),
new MinecraftVersion("1.7.10", "202201182040", Origin.LEGACY_FABRIC, true),
new MinecraftVersion("1.6.4", "202201182040", Origin.LEGACY_FABRIC, true)
]
static def supportedVersions = [
"1.18.2", "1.18.1", "1.18", // 1.18.x
"1.17.1", "1.17", // 1.17.x
"1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16", // 1.16.x
"1.15.2", "1.15.1", "1.15", // 1.15.x
"1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14", // 1.14.x
"1.12.2", "1.8.9", "1.7.10", "1.6.4" // Legacy Fabric
]
static def supportedVersionsCurseforge = [
"1.18-Snapshot",
"1.17-Snapshot",
"1.16-Snapshot",
"1.15-Snapshot",
"1.14-Snapshot"
]
static def supportedVersionsModrinth = [
// 1.18.x
'22w03a',
'1.18.1-rc3', '1.18.1-rc2', '1.18.1-rc1', '1.18.1-pre1',
'1.18-rc4', '1.18-rc3', '1.18-rc2', '1.18-rc1',
'1.18-pre8', '1.18-pre7', '1.18-pre6',
'1.18-pre5', '1.18-pre4', '1.18-pre3', '1.18-pre2', '1.18-pre1',
'21w44a', '21w43a', '21w42a', '21w41a', '21w40a', '21w39a', '21w38a', '21w37a',
// '1.18_experimental-snapshot-7', '1.18_experimental-snapshot-6', '1.18_experimental-snapshot-5',
// '1.18_experimental-snapshot-4', '1.18_experimental-snapshot-3', '1.18_experimental-snapshot-2',
// '1.18_experimental-snapshot-1',
// 1.17.x
'1.17.1-rc2', '1.17.1-rc1',
'1.17.1-pre3', '1.17.1-pre2', '1.17.1-pre1',
'1.17-rc2', '1.17-rc1',
'1.17-pre5', '1.17-pre4', '1.17-pre3', '1.17-pre2', '1.17-pre1',
'21w20a', '21w19a', '21w18a', '21w17a', '21w16a', '21w15a', '21w14a', '21w13a', '21w11a', '21w10a',
'21w08b', '21w08a', '21w07a', '21w06a', '21w05b', '21w05a', '21w03a', '20w51a', '20w49a', '20w48a',
'20w46a', '20w45a',
// 1.16.x
'1.16.5-rc1',
'1.16.4-rc1',
'1.16.4-pre2', '1.16.4-pre1',
'1.16.3-rc1',
'1.16.2-rc2', '1.16.2-rc1',
'1.16.2-pre3', '1.16.2-pre2', '1.16.2-pre1',
'20w30a', '20w29a', '20w28a', '20w27a',
'1.16-rc1',
'1.16-pre8', '1.16-pre7', '1.16-pre6', '1.16-pre5', '1.16-pre4', '1.16-pre3', '1.16-pre2', '1.16-pre1',
'20w22a', '20w21a', '20w20b', '20w20a', '20w19a', '20w18a', '20w17a', '20w16a', '20w15a', '20w14a',
'20w14infinite', '20w13b', '20w13a', '20w12a', '20w11a', '20w10a', '20w09a', '20w08a', '20w07a',
'20w06a',
// 1.15.x
'1.15.2-pre2', '1.15.2-pre1',
'1.15.1-pre1',
'1.15-pre7', '1.15-pre6', '1.15-pre5', '1.15-pre4', '1.15-pre3', '1.15-pre2', '1.15-pre1',
'19w46b', '19w46a', '19w45b', '19w45a', '19w44a', '19w42a', '19w41a', '19w40a', '19w39a', '19w38b',
'19w38a', '19w37a', '19w36a', '19w35a', '19w34a',
// 1.14.x
'1.14.4-pre7', '1.14.4-pre6', '1.14.4-pre5', '1.14.4-pre4', '1.14.4-pre3', '1.14.4-pre2', '1.14.4-pre1',
'1.14.3-pre4', '1.14.3-pre3', '1.14.3-pre2', '1.14.3-pre1',
'1.14.2-pre4', '1.14.2-pre3', '1.14.2-pre2', '1.14.2-pre1',
'1.14.1-pre2', '1.14.1-pre1'
]
}
version = Globals.baseVersion
static def getSubprojectVersion() {
return Globals.baseVersion
}
static def getApiVersion() {
return Globals.apiVersion
}
static MinecraftVersion getVersionInfo(String project_name) {
project_name = project_name.replace("versions", "").replace("fabric", "").replace("legacy-", "").replace("/", "")
def version_info = Globals.versionInfo[0]
for (MinecraftVersion minecraftVersion : Globals.versionInfo) {
if (minecraftVersion.mcVersion == project_name) version_info = minecraftVersion
}
return version_info
}
def moduleDependencies(project) {
List<String> depNames = ["api", "common"]
def deps = depNames.iterator().collect { project.dependencies.project(path: ":$it", configuration: 'namedElements') }
project.dependencies {
deps.each {
api it
}
}
}
allprojects {
def projectName = it.name;
apply plugin: 'java-library'
apply plugin: 'fabric-loom'
tasks.withType(JavaCompile).configureEach {
it.options.release = 8
}
group = "fr.catcore"
def versionInfo = getVersionInfo(projectName)
dependencies {
minecraft "com.mojang:minecraft:${versionInfo.mcVersion}"
mappings "net.fabricmc:yarn:${versionInfo.mcVersion}+build.${versionInfo.yarnVersion}:v2"
modApi "net.fabricmc:fabric-loader:${Globals.loaderVersion}"
if (projectName != "common" && projectName != "api") {
if (versionInfo.origin == Origin.FABRIC) {
modImplementation "net.fabricmc.fabric-api:fabric-api:${versionInfo.apiVersion}"
} else {
if (!versionInfo.apiVersion.isEmpty()) modImplementation "net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${versionInfo.apiVersion}"
}
}
}
loom {
if (!versionInfo.origin.customIntermediaryURL.isEmpty()) {
setIntermediaryUrl(versionInfo.origin.customIntermediaryURL)
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
name 'm2-dv8tion'
url 'https://m2.dv8tion.net/releases'
}
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'legacy-fabric'
url = 'https://maven.legacyfabric.net/'
}
maven {
name = "CurseMaven"
url = "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = "Jitpack"
url = "https://jitpack.io/"
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
java {
withSourcesJar()
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
}
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
dependencies {
afterEvaluate {
subprojects.each {
api project(path: ":${it.name}", configuration: "namedElements")
include project("${it.name}:")
}
}
}
curseforge {
apiKey = System.getenv('CURSEKEY') ?: "a key"
project {
id = "318315"
releaseType = "release"
changelog = Globals.changelog
mainArtifact(remapJar) {
displayName = Globals.baseVersion
relations {
requiredDependency "fabric-api"
requiredDependency "legacy-fabric-api"
}
}
addArtifact(file("api/build/libs/fdlink-api-${Globals.apiVersion}.jar")) {
displayName = "Api ${Globals.apiVersion}"
}
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
gameVersionStrings.clear()
gameVersionStrings.add("Fabric")
for (String version : Globals.supportedVersions) {
gameVersionStrings.add(version)
}
for (String version : Globals.supportedVersionsCurseforge) {
gameVersionStrings.add(version)
}
}
options {
forgeGradleIntegration = false
javaVersionAutoDetect = false
}
}
import com.modrinth.minotaur.dependencies.ModDependency
modrinth {
token = System.getenv("MODRINTHKEY") ?: "a key" // This is the default. Remember to have the MODRINTH_TOKEN environment variable set or else this will fail, or set it to whatever you want - just make sure it stays private!
projectId = "FCmig1C9"
versionNumber = Globals.baseVersion // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = "release" // This is the default
uploadFile = remapJar // With Fabric Loom or Architectury Loom, this MUST be set to `remapJar` instead of `jar`!
def modrinthVersions = []
for (String version : Globals.supportedVersions) {
modrinthVersions.add(version)
}
for (String version : Globals.supportedVersionsModrinth) {
modrinthVersions.add(version)
}
gameVersions = modrinthVersions // Must be an array, even with only one version
dependencies = [ // Yet another array. Create a new `ModDependency` or `VersionDependency` with two strings - the ID and the scope
new ModDependency("P7dR8mSH", "required") // Creates a new required dependency on Fabric API
]
}