forked from Creators-of-Create/Create
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
357 lines (307 loc) · 12.5 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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version "${forgegradle_version}"
id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}"
id 'org.spongepowered.mixin' version "${mixingradle_version}"
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
}
jarJar.enable()
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false');
ext.buildNumber = System.getenv('BUILD_NUMBER')
group = 'com.simibubi.create'
archivesBaseName = "create-${artifact_minecraft_version}"
version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
mixin {
add sourceSets.main, 'create.refmap.json'
config 'flywheel.backend.mixins.json'
config 'flywheel.impl.mixins.json'
config 'flywheel.impl.sodium.mixins.json'
config 'create.mixins.json'
debug.verbose = true
debug.export = true
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
minecraft {
if (Boolean.parseBoolean(use_parchment)) {
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
} else {
mappings channel: 'official', version: "${minecraft_version}"
}
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
configureEach {
property 'forge.logging.markers', ''
property 'forge.logging.console.level', 'info'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
//jvmArgs '-XX:+IgnoreUnrecognizedVMOptions', '-XX:+AllowEnhancedClassRedefinition' // uncomment with jbr
mods {
create {
source sourceSets.main
}
}
}
client {
workingDirectory project.file('run')
}
server {
workingDirectory project.file('run/server')
}
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources')
}
gameTestServer {
workingDirectory project.file('run/gametest')
// setForceExit false <- FIXME 1.20
}
}
}
repositories {
maven {
// location of the maven for Registrate and Flywheel
name = 'tterrag maven'
url = 'https://maven.tterrag.com'
}
maven {
// location of the maven that hosts JEI files since January 2023
// location of the maven for Vazkii's mods
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
/*maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.dev"
}*/
maven {
// location of the maven for Dynamic Trees
url = 'https://harleyoconnor.com/maven'
}
maven {
// location of the maven for Curios API
url = "https://maven.theillusivec4.top/"
}
maven {
// location of maven for CC: Tweaked
name = "squiddev"
url = "https://squiddev.cc/maven/"
}
maven {
url = 'https://www.cursemaven.com'
content {
includeGroup "curse.maven"
}
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
mavenCentral()
mavenLocal()
flatDir {
dirs 'libs'
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
jarJar("com.tterrag.registrate:Registrate:${registrate_version}") {
jarJar.ranged(it, '[MC1.19.3-1.1.10,)')
}
jarJar("dev.engine_room.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") {
jarJar.ranged(it, '[1.0,2.0)')
}
implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
compileOnly fg.deobf("dev.engine_room.flywheel:flywheel-forge-api-${flywheel_minecraft_version}:${flywheel_version}")
runtimeOnly fg.deobf("dev.engine_room.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge:${jei_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_minecraft_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_minecraft_version}")
if (cc_tweaked_enable.toBoolean()) {
compileOnly("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-core-api:${cc_tweaked_version}")
compileOnly fg.deobf("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-forge-api:${cc_tweaked_version}")
runtimeOnly fg.deobf("cc.tweaked:cc-tweaked-${cc_tweaked_minecraft_version}-forge:${cc_tweaked_version}")
}
if (dynamic_trees_enable.toBoolean()) {
compileOnly fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-${dynamic_trees_minecraft_version}:${dynamic_trees_version}")
}
// implementation fg.deobf("curse.maven:ic2-classic-242942:5555152")
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
// implementation fg.deobf("com.railwayteam.railways:railways-1.19.2-1.6.4:all") { transitive = false }
// runtimeOnly fg.deobf("curse.maven:framedblocks-441647:5399211")
// runtimeOnly fg.deobf("curse.maven:galosphere-631098:4574834")
// runtimeOnly fg.deobf("curse.maven:elementary-ores-332609:4514276") 1.19.4 only
// runtimeOnly fg.deobf("curse.maven:flib-661261:4479544")
// runtimeOnly fg.deobf("curse.maven:infernal-expansion-395078:4002091")
// runtimeOnly fg.deobf("vazkii.autoreglib:AutoRegLib:1.8.2-58.126")
// runtimeOnly fg.deobf("curse.maven:quark-243121:4812006")
// runtimeOnly fg.deobf("curse.maven:mantle-74924:5339977")
// runtimeOnly fg.deobf("curse.maven:tinkers-construct-74072:5358052")
// runtimeOnly fg.deobf("maven.modrinth:rubidium:0.6.2c")
// runtimeOnly fg.deobf("maven.modrinth:aether:1.19.2-1.4.2-forge")
// runtimeOnly fg.deobf("maven.modrinth:spark:1.10.38-forge")
// runtimeOnly fg.deobf("curse.maven:forbidden-arcanus-309858:4852521")
// runtimeOnly fg.deobf("curse.maven:valhelsia-core-416935:4181245")
// runtimeOnly fg.deobf("curse.maven:modern-ui-352491:5229370")
// runtimeOnly fg.deobf("curse.maven:sophisticated-storage-619320:5194750")
// runtimeOnly fg.deobf("curse.maven:sophisticated-core-618298:5296313")
// runtimeOnly fg.deobf("curse.maven:functional-storage-556861:5499169")
// runtimeOnly fg.deobf("curse.maven:titanium-287342:5356458")
// runtimeOnly fg.deobf("curse.maven:storage-drawers-223852:3884263")
// runtimeOnly fg.deobf("curse.maven:ftb-chunks-forge-314906:5417874")
// runtimeOnly fg.deobf("curse.maven:architectury-api-419699:5137942")
// runtimeOnly fg.deobf("curse.maven:ftb-library-forge-404465:4661834")
// runtimeOnly fg.deobf("curse.maven:ftb-teams-forge-404468:4611938")
// runtimeOnly fg.deobf("curse.maven:citadel-331936:4556677")
// runtimeOnly fg.deobf("curse.maven:ice-and-fire-dragons-264231:5037952")
// runtimeOnly fg.deobf("curse.maven:exnihilosequentia-400012:4993344")
// runtimeOnly fg.deobf("curse.maven:upgrade-aquatic-326895:4777515")
// runtimeOnly fg.deobf("curse.maven:blueprint-382216:4749000")
// runtimeOnly fg.deobf("curse.maven:windsweptmod-636321:4817132")
// runtimeOnly fg.deobf("curse.maven:good-ending-690161:4363719")
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings
// This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly
if (!Boolean.getBoolean('idea.sync.active')) {
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
}
sourceSets.main.java {
if (!cc_tweaked_enable.toBoolean()) {
exclude 'com/simibubi/create/compat/computercraft/implementation/**'
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
exclude '.cache/'
}
// Workaround for SpongePowered/MixinGradle#38
afterEvaluate {
tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava)
tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava)
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
compileJava {
options.compilerArgs = ['-Xdiags:verbose']
}
jar {
archiveClassifier = 'slim'
manifest {
attributes([
'Specification-Title': 'create',
'Specification-Vendor': 'simibubi',
'Specification-Version': '1',
'Implementation-Title': project.jar.archiveBaseName,
'Implementation-Version': project.jar.archiveVersion,
'Implementation-Vendor': 'simibubi',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'MixinConfigs': 'create.mixins.json'
])
}
}
task jarJarRelease {
group = 'jarjar'
doLast {
tasks.jarJar {
archiveClassifier = ''
}
}
finalizedBy tasks.jarJar
}
java {
withSourcesJar()
withJavadocJar()
}
void addLicense(jarTask) {
jarTask.from('LICENSE') {
rename { "${it}_${project.archivesBaseName}" }
}
}
jar.finalizedBy('reobfJar')
tasks.jarJar.finalizedBy('reobfJarJar')
addLicense(jar)
addLicense(tasks.jarJar)
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = archivesBaseName
from components.java
fg.component(it)
jarJar.component(it)
}
}
repositories {
if (project.hasProperty('mavendir')) {
maven { url mavendir }
}
}
}
String getChangelogText() {
def changelogFile = file('changelog.txt')
String str = ''
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (it.size() > 1) {
def temp = it
if (lineCount == 0) {
temp = "Create ${version}"
temp = "<span style=\"font-size: 18px; color: #333399;\">Create v${mod_version}</span> <em>for Minecraft ${minecraft_version}</em><br/>"
} else if (it.startsWith('-')) {
temp = " $temp<br/>"
temp = temp.replaceAll("(\\S+\\/\\S+)#([0-9]+)\\b", "<a href=\"https://github.com/\$1/issues/\$2\">\$0</a>");
temp = temp.replaceAll("#([0-9]+)\\b(?!<\\/a>)", "<a href=\"https://github.com/$github_project/issues/\$1\">\$0</a>");
} else {
temp = "<h4>$temp</h4>"
}
str += temp
lineCount++
} else {
str += "<p>Please submit any Issues you come across on the <a href=\"https://github.com/${github_project}/issues\" rel=\"nofollow\">Issue Tracker</a>.</p>"
done = true
}
}
return str
}
// changelog debugging
// new File("changelog.html").write getChangelogText()
// tasks.curseforge.enabled = !dev && project.hasProperty('simi_curseforge_key')
// curseforge {
// if (project.hasProperty('simi_curseforge_key')) {
// apiKey = project.simi_curseforge_key
// }
//
// project {
// id = project.projectId
// changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG')
// changelogType = 'html'
// releaseType = project.curse_type
// mainArtifact(shadowJar) {
// displayName = "Create - ${version}"
// }
// relations {
// optionalDependency 'jei'
// }
// }
// }