forked from TeamPneumatic/pnc-repressurized
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
448 lines (396 loc) · 14 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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://maven.parchmentmc.org' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.parchmentmc:librarian:1.+'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
classpath 'org.spongepowered:mixingradle:0.7.+'
}
}
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: "com.jfrog.artifactory"
apply plugin: "org.spongepowered.mixin"
//adds the build number to the end of the version string if on a build server
String build_number = System.getenv().BUILD_NUMBER
if (build_number == null) {
build_number = 'CUSTOM'
}
String semver = "${mod_version_massive}.${mod_version_major}.${mod_version_minor}"
// these two are required for the java plugin to generate jar files with a version
version = "${project.mc_version}-${semver}-${build_number}"
group = 'me.desht.pneumaticcraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "pneumaticcraft-repressurized"
ext.releaseTag = System.getenv('TAG') ?: ""
ext.isAlpha = ext.releaseTag.contains("alpha")
ext.isBeta = ext.releaseTag.contains("beta")
// All jar files from this folder will be added automatically as runtime mod dependencies
String extraModsDir = "extra-mods-${project.mc_version}"
sourceSets {
api
main {
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
resources {
srcDir 'src/generated/resources'
}
}
test {
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
}
}
configurations {
// apiImplementation.extendsFrom(implementation)
// apiRuntimeOnly.extendsFrom(runtimeOnly)
apiImplementation.extendsFrom(minecraft)
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
repositories {
mavenCentral()
flatDir {
name "extra-mods"
dir file(extraModsDir)
}
maven {
name "JEI"
url "https://dvs1.progwml6.com/files/maven"
}
maven {
name 'CC: Tweaked'
url 'https://squiddev.cc/maven/'
}
maven {
name 'Crafttweaker/Patchouli/Botania/Immersive Engineering/Gamestages'
url 'https://maven.blamejared.com/'
}
maven {
name 'Curios'
url "https://maven.theillusivec4.top/"
}
maven {
name "K-4u Mod maven"
url "https://modmaven.dev/"
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}
dependencies {
minecraft([
group : "net.minecraftforge",
name : 'forge',
version: "${project.mc_version}-${project.forge_version}"
])
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.2"
implementation fg.deobf("mcjty.theoneprobe:theoneprobe:${top_version}") {
exclude group: "net.minecraftforge", module: "forge"
}
// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// at runtime, use the full JEI
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-common:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")
compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}-FORGE:api")
runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}-FORGE")
compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")
implementation fg.deobf("org.squiddev:cc-tweaked-${project.mc_version}:${cc_tweaked_version}")
compileOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}")
compileOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:api")
runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")
implementation fg.deobf("com.simibubi.create:create-${project.mc_version}:${create_version}:slim") { transitive = false }
implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${project.mc_version}:${flywheel_version}")
implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
// implementation fg.deobf("curse.maven:create-328085:${create_curse_id}")
implementation fg.deobf("curse.maven:jade-324717:${jade_curse_id}")
implementation fg.deobf("curse.maven:cofh_core-69162:${cofh_core_curse_id}")
implementation fg.deobf("curse.maven:thermal_cultivation-271835:${thermal_cultivation_curse_id}")
implementation fg.deobf("curse.maven:thermal_expansion-69163:${thermal_expansion_curse_id}")
implementation fg.deobf("curse.maven:thermal_foundation-222880:${thermal_foundation_curse_id}")
implementation fg.deobf("curse.maven:thermal_innovation-291737:${thermal_innovation_curse_id}")
implementation fg.deobf("curse.maven:thermal_locomotion-406959:${thermal_locomotion_curse_id}")
implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-1.19.2:${crafttweaker_version}")
compileOnly fg.deobf("net.darkhax.gamestages:GameStages-Forge-${project.mc_version}:${gamestages_version}")
//compileOnly fg.deobf("appeng:appliedenergistics2:${ae2_version}:api")
//runtimeOnly fg.deobf("appeng:appliedenergistics2:${ae2_version}")
//compileOnly fg.deobf("team.chisel.ctm:CTM:MC1.16.1-${ctm_version}")
//runtimeOnly fg.deobf("team.chisel.ctm:CTM:MC1.16.1-${ctm_version}")
// Locally sourced extra mods for runtime (i.e. testing) - thanks AE2 for this idea
for (extraModJar in fileTree(dir: extraModsDir, include: '*.jar')) {
def basename = extraModJar.name.substring(0, extraModJar.name.length() - ".jar".length())
def versionSep = basename.lastIndexOf('-')
assert versionSep != -1
def artifactId = basename.substring(0, versionSep)
def version = basename.substring(versionSep + 1)
runtimeOnly fg.deobf("extra-mods:$artifactId:$version")
}
// compileOnly "li.cil.oc:OpenComputers:MC1.12.2-${oc_version}:api"
// compileOnly "net.industrial-craft:industrialcraft-2:2.8.27-ex112:api"
// compileOnly "thaumcraft:Thaumcraft:${thaumcraft_version}"
// compileOnly "team.chisel.ctm:CTM:${ctm_version}:api"
}
minecraft {
mappings channel: 'parchment', version: "${project.mappings_version}-${project.mc_version}"
// mappings channel: 'parchment', version: "${project.mappings_version}-${project.mc_version}"
// mappings channel: 'official', version: "1.19"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
property 'forge.logging.console.level', 'debug'
workingDirectory file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
ideaModule "${project.name}.main"
mods {
pneumaticcraft.sources((SourceSet[]) [sourceSets.main, sourceSets.api])
}
}
server {
property 'forge.logging.console.level', 'debug'
workingDirectory file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
ideaModule "${project.name}.main"
mods {
pneumaticcraft.sources((SourceSet[]) [sourceSets.main, sourceSets.api])
}
}
data {
property 'forge.logging.console.level', 'debug'
property 'fml.earlyprogresswindow', 'false'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
workingDirectory file('run')
ideaModule "${project.name}.main"
forceExit false
args '--mod', 'pneumaticcraft', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0]
mods {
pneumaticcraft.sources((SourceSet[]) [sourceSets.main, sourceSets.api])
}
}
}
}
mixin {
// Refmaps for each SourceSet
add sourceSets.main, 'mixins.pneumaticcraft.refmap.json'
// Configs to add to runs and jars
config 'mixins.pneumaticcraft.json'
// Specify options for dev run configs
debug.verbose = true
debug.export = true
dumpTargetOnFailure = true
// Options for the Annotation Processor
quiet
}
def replaceResources = tasks.register("replaceResources", Copy) {
it.outputs.upToDateWhen { false }
//Copy it into the build dir
it.from(sourceSets.main.resources) {
include "META-INF/mods.toml"
expand 'version': version, 'mc_version': mc_version, 'mc_version_range': minecraft_version_range, 'forge_version_range': forge_version_range
}
it.into "$buildDir/resources/main/"
}
processResources {
duplicatesStrategy(DuplicatesStrategy.FAIL)
exclude('META-INF/mods.toml')
configure { finalizedBy(replaceResources) }
}
classes.configure {
dependsOn(replaceResources)
}
javadoc {
source = [sourceSets.main.allJava, sourceSets.api.allJava]
// prevent java 8's strict doclint for javadocs from failing builds
options.addStringOption('Xdoclint:none', '-quiet')
(options as StandardJavadocDocletOptions)
.tags("apiNote:a:API Note:", "implSpec:a:Implementation Requirements:", "implNote:a:Implementation Note:")
}
task getChangelogProperty(type: Exec) {
standardOutput = new ByteArrayOutputStream()
commandLine 'bash', './scripts/extract_changes.sh', "${semver}"
doLast {
ext.changelog = standardOutput.toString()
}
}
//task makeChangelog(type: GitChangelogTask) {
// file = file('changelog.html')
// untaggedName = "Current release ${project.version}"
// fromCommit = '2fe051cf727adce1be210a46f778aa8fe031331e'
// toRef = 'HEAD'
// templateContent = file('changelog.mustache').getText('UTF-8')
//}
//curseforge {
// apiKey = project.findProperty('curseforge_apikey') ?: '0'
// project {
// id = curse_project_id
// changelog = file('changelog.html')
// changelogType = 'html'
// releaseType = 'beta'
// }
//}
//afterEvaluate {
// tasks.curseforge281849.dependsOn makeChangelog
//}
jar {
from sourceSets.main.output
from sourceSets.api.output
manifest.attributes([
'FMLAT': 'accesstransformer.cfg',
"Specification-Title": "PneumaticCraft: Repressurized",
"Specification-Vendor": "desht",
"Specification-Version": "${semver}",
"Implementation-Title": project.name,
"Implementation-Version": "${project.version}",
"Implementation-Vendor" :"desht",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
finalizedBy 'reobfJar'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
duplicatesStrategy(DuplicatesStrategy.FAIL)
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task sourcesJar(type: Jar) {
duplicatesStrategy(DuplicatesStrategy.FAIL)
archiveClassifier.set('sources')
from sourceSets.main.allJava
from sourceSets.api.allJava
}
task apiJar(type: Jar, dependsOn: apiClasses) {
duplicatesStrategy(DuplicatesStrategy.FAIL)
archiveClassifier.set('api')
from sourceSets.api.output
afterEvaluate { finalizedBy reobfApiJar }
}
task deobfJar(type: Jar) {
duplicatesStrategy(DuplicatesStrategy.FAIL)
archiveClassifier.set('deobf')
from sourceSets.main.output
from sourceSets.api.output
}
artifacts {
archives javadocJar
archives sourcesJar
archives apiJar
archives deobfJar
}
reobf {
apiJar { classpath.from(sourceSets.api.compileClasspath) }
jar { classpath.from(sourceSets.main.compileClasspath) }
}
task reobf {
dependsOn reobfJar
dependsOn reobfApiJar
}
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// with thanks to AE2
def mavenVer = ext.releaseTag == "" ? "${project.mc_version}-${semver}-SNAPSHOT" : "${project.mc_version}-${semver}"
publishing {
if (System.getenv("MODMAVEN_USER") != null) {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = project.archivesBaseName
version = mavenVer
// ForgeGradle will generate wild dependency definitions, see https://github.com/MinecraftForge/ForgeGradle/issues/584
// Since we don't actually depend on anything, just remove the entire node.
pom.withXml {
asNode().remove(asNode().dependencies)
}
from components.java
artifact sourcesJar
artifact javadocJar
artifact apiJar
}
}
repositories {
maven {
name = "modmaven"
credentials {
username System.getenv("MODMAVEN_USER")
password System.getenv("MODMAVEN_PASSWORD")
}
url = "https://modmaven.dev/artifactory/local-releases/"
}
}
}
}
idea {
module {
for (String exclude in ['run', 'out', 'logs']) {
excludeDirs += file(exclude)
}
}
}
def relType = "release"
if (ext.isAlpha) {
relType = "alpha"
} else if (ext.isBeta) {
relType = "beta"
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "${project.modrinth_project_id}"
versionNumber = "${project.mc_version}-${semver}"
versionType = relType
uploadFile = jar // With Loom, this MUST be set to `remapJar` instead of `jar`!
additionalFiles = [ apiJar ]
gameVersions = ["${mc_version}"] // Must be an array, even with only one version
changelog = System.getenv("CHANGELOG")
dependencies { // A special DSL for creating dependencies
// scope.type
// The scope can be `required`, `optional`, or `incompatible`
// The type can either be `project` or `version`
required.project "nU0bVIaL" // Patchouli
}
}
if (System.getenv("CURSEFORGE_TOKEN")) {
curseforge {
apiKey = System.getenv("CURSEFORGE_TOKEN")
project {
id = project.curse_project_id
changelogType = "markdown"
changelog = System.getenv("CHANGELOG")
releaseType = relType
addGameVersion project.mc_version
addGameVersion "Forge"
mainArtifact(jar.archiveFile) {
displayName = "${project.archivesBaseName} v${project.mc_version}-${semver}"
relations {
requiredDependency "patchouli"
}
}
addArtifact(apiJar.archiveFile)
}
}
}
//test {
// useJUnitPlatform()
// include 'mezz/jei/**'
// exclude 'mezz/jei/lib/**'
//}