1
- // version: 1679836390
1
+ // version: 1682616243
2
2
/*
3
3
DO NOT CHANGE THIS FILE!
4
4
Also, you may replace this file at any time if there is an update available.
5
5
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates.
6
6
*/
7
7
8
8
9
- import com.diffplug.blowdryer.Blowdryer
10
- import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
11
9
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
12
10
import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
13
11
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
14
12
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
13
+ import com.gtnewhorizons.retrofuturagradle.util.Distribution
15
14
import com.matthewprenger.cursegradle.CurseArtifact
16
15
import com.matthewprenger.cursegradle.CurseRelation
17
16
import com.modrinth.minotaur.dependencies.ModDependency
18
17
import com.modrinth.minotaur.dependencies.VersionDependency
19
- import cpw.mods.fml.relauncher.Side
20
- import org.gradle.api.tasks.options.Option ;
21
18
import org.gradle.internal.logging.text.StyledTextOutput.Style
22
19
import org.gradle.internal.logging.text.StyledTextOutputFactory
23
20
import org.gradle.internal.xml.XmlTransformer
24
- import org.jetbrains.gradle.ext.*
21
+ import org.jetbrains.gradle.ext.Application
22
+ import org.jetbrains.gradle.ext.Gradle
25
23
24
+ import javax.inject.Inject
26
25
import java.nio.file.Files
27
26
import java.nio.file.Paths
28
27
import java.util.concurrent.TimeUnit
29
- import java.util.zip.ZipEntry
30
- import java.util.zip.ZipOutputStream
31
- import javax.inject.Inject
32
28
33
29
buildscript {
34
30
repositories {
@@ -66,21 +62,22 @@ plugins {
66
62
id ' org.jetbrains.kotlin.kapt' version ' 1.8.0' apply false
67
63
id ' com.google.devtools.ksp' version ' 1.8.0-1.0.9' apply false
68
64
id ' org.ajoberstar.grgit' version ' 4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
69
- id ' com.github.johnrengelman.shadow' version ' 7 .1.2 ' apply false
70
- id ' com.palantir.git-version' version ' 0.13. 0' apply false // 0.13.0 is the last jvm8 supporting version
71
- id ' de.undercouch.download' version ' 5.3 .0'
65
+ id ' com.github.johnrengelman.shadow' version ' 8 .1.1 ' apply false
66
+ id ' com.palantir.git-version' version ' 3.0. 0' apply false
67
+ id ' de.undercouch.download' version ' 5.4 .0'
72
68
id ' com.github.gmazzo.buildconfig' version ' 3.1.0' apply false // Unused, available for addon.gradle
73
- id ' com.diffplug.spotless' version ' 6.7.2 ' apply false
69
+ id ' com.diffplug.spotless' version ' 6.13.0 ' apply false // 6.13.0 is the last jvm8 supporting version
74
70
id ' com.modrinth.minotaur' version ' 2.+' apply false
75
71
id ' com.matthewprenger.cursegradle' version ' 1.4.0' apply false
76
- id ' com.gtnewhorizons.retrofuturagradle' version ' 1.2.3 '
72
+ id ' com.gtnewhorizons.retrofuturagradle' version ' 1.3.7 '
77
73
}
78
74
boolean settingsupdated = verifySettingsGradle()
79
75
settingsupdated = verifyGitAttributes() || settingsupdated
80
76
if (settingsupdated)
81
77
throw new GradleException (" Settings has been updated, please re-run task." )
82
78
83
- if (project. file(' .git/HEAD' ). isFile()) {
79
+ // In submodules, .git is a file pointing to the real git dir
80
+ if (project. file(' .git/HEAD' ). isFile() || project. file(' .git' ). isFile()) {
84
81
apply plugin : ' com.palantir.git-version'
85
82
}
86
83
@@ -132,7 +129,7 @@ propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new
132
129
// this is meant to be set using the user wide property file. by default we do nothing.
133
130
propertyDefaultIfUnset(" ideaOverrideBuildType" , " " ) // Can be nothing, "gradle" or "idea"
134
131
135
- project. extensions. add(Blowdryer , " Blowdryer" , Blowdryer ) // Make blowdryer available in "apply from:" scripts
132
+ project. extensions. add(com.diffplug.blowdryer. Blowdryer , " Blowdryer" , com.diffplug.blowdryer. Blowdryer ) // Make blowdryer available in "apply from:" scripts
136
133
if (! disableSpotless) {
137
134
apply plugin : ' com.diffplug.spotless'
138
135
apply from : Blowdryer . file(' spotless.gradle' )
@@ -201,6 +198,14 @@ configurations {
201
198
canBeConsumed = false
202
199
canBeResolved = false
203
200
}
201
+
202
+ create(" devOnlyNonPublishable" ) {
203
+ description = " Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)"
204
+ canBeConsumed = false
205
+ canBeResolved = false
206
+ }
207
+ compileOnly. extendsFrom(devOnlyNonPublishable)
208
+ runtimeOnlyNonPublishable. extendsFrom(devOnlyNonPublishable)
204
209
}
205
210
206
211
if (enableModernJavaSyntax. toBoolean()) {
@@ -399,14 +404,12 @@ minecraft {
399
404
400
405
username = developmentEnvironmentUserName. toString()
401
406
402
- lwjgl3Version = " 3.3.2-SNAPSHOT "
407
+ lwjgl3Version = " 3.3.2"
403
408
404
409
// Enable assertions in the current mod
405
410
extraRunJvmArguments. add(" -ea:${ modGroup} " )
406
411
407
412
if (usesMixins. toBoolean() || forceEnableMixins. toBoolean()) {
408
- extraTweakClasses. add(" org.spongepowered.asm.launch.MixinTweaker" )
409
-
410
413
if (usesMixinDebug. toBoolean()) {
411
414
extraRunJvmArguments. addAll([
412
415
" -Dmixin.debug.countInjections=true" ,
@@ -561,8 +564,9 @@ repositories {
561
564
562
565
def mixinProviderGroup = " io.github.legacymoddingmc"
563
566
def mixinProviderModule = " unimixins"
564
- def mixinProviderVersion = " 0.1.5"
565
- def mixinProviderSpec = " ${ mixinProviderGroup} :${ mixinProviderModule} :${ mixinProviderVersion} "
567
+ def mixinProviderVersion = " 0.1.6"
568
+ def mixinProviderSpecNoClassifer = " ${ mixinProviderGroup} :${ mixinProviderModule} :${ mixinProviderVersion} "
569
+ def mixinProviderSpec = " ${ mixinProviderSpecNoClassifer} :dev"
566
570
567
571
dependencies {
568
572
if (usesMixins. toBoolean()) {
@@ -574,8 +578,10 @@ dependencies {
574
578
runtimeOnlyNonPublishable(' org.jetbrains:intellij-fernflower:1.2.1.16' )
575
579
}
576
580
}
577
- if (usesMixins. toBoolean() || forceEnableMixins . toBoolean() ) {
581
+ if (usesMixins. toBoolean()) {
578
582
implementation(mixinProviderSpec)
583
+ } else if (forceEnableMixins. toBoolean()) {
584
+ runtimeOnlyNonPublishable(mixinProviderSpec)
579
585
}
580
586
}
581
587
@@ -591,10 +597,11 @@ pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
591
597
// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier
592
598
configurations. all {
593
599
resolutionStrategy. dependencySubstitution {
594
- substitute module(' com.gtnewhorizon:gtnhmixins' ) using module(mixinProviderSpec) withoutClassifier() because(" Unimixins replaces other mixin mods" )
595
- substitute module(' com.github.GTNewHorizons:Mixingasm' ) using module(mixinProviderSpec) withoutClassifier() because(" Unimixins replaces other mixin mods" )
596
- substitute module(' com.github.GTNewHorizons:SpongePoweredMixin' ) using module(mixinProviderSpec) withoutClassifier() because(" Unimixins replaces other mixin mods" )
597
- substitute module(' com.github.GTNewHorizons:SpongeMixins' ) using module(mixinProviderSpec) withoutClassifier() because(" Unimixins replaces other mixin mods" )
600
+ substitute module(' com.gtnewhorizon:gtnhmixins' ) using module(mixinProviderSpecNoClassifer) withClassifier(" dev" ) because(" Unimixins replaces other mixin mods" )
601
+ substitute module(' com.github.GTNewHorizons:Mixingasm' ) using module(mixinProviderSpecNoClassifer) withClassifier(" dev" ) because(" Unimixins replaces other mixin mods" )
602
+ substitute module(' com.github.GTNewHorizons:SpongePoweredMixin' ) using module(mixinProviderSpecNoClassifer) withClassifier(" dev" ) because(" Unimixins replaces other mixin mods" )
603
+ substitute module(' com.github.GTNewHorizons:SpongeMixins' ) using module(mixinProviderSpecNoClassifer) withClassifier(" dev" ) because(" Unimixins replaces other mixin mods" )
604
+ substitute module(' io.github.legacymoddingmc:unimixins' ) using module(mixinProviderSpecNoClassifer) withClassifier(" dev" ) because(" Our previous unimixins upload was missing the dev classifier" )
598
605
}
599
606
}
600
607
@@ -711,13 +718,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
711
718
}
712
719
713
720
dependencies {
714
- def lwjgl3ifyVersion = ' 1.3.3 '
721
+ def lwjgl3ifyVersion = ' 1.3.5 '
715
722
def asmVersion = ' 9.4'
716
723
if (modId != ' lwjgl3ify' ) {
717
724
java17Dependencies(" com.github.GTNewHorizons:lwjgl3ify:${ lwjgl3ifyVersion} " )
718
725
}
719
726
if (modId != ' hodgepodge' ) {
720
- java17Dependencies(' com.github.GTNewHorizons:Hodgepodge:2.2.4 ' )
727
+ java17Dependencies(' com.github.GTNewHorizons:Hodgepodge:2.2.8 ' )
721
728
}
722
729
723
730
java17PatchDependencies(' net.minecraft:launchwrapper:1.15' ) {transitive = false }
@@ -791,7 +798,7 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
791
798
public boolean setEnableHotswap (boolean enable ) { enableHotswap = enable }
792
799
793
800
@Inject
794
- public RunHotswappableMinecraftTask (Side side , String superTask , org.gradle.api.invocation.Gradle gradle ) {
801
+ public RunHotswappableMinecraftTask (Distribution side , String superTask , org.gradle.api.invocation.Gradle gradle ) {
795
802
super (side, gradle)
796
803
797
804
this . lwjglVersion = 3
@@ -800,7 +807,7 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
800
807
this . extraJvmArgs. addAll(project. provider(() -> enableHotswap ? project. hotswapJvmArgs : []))
801
808
802
809
this . classpath(project. java17PatchDependenciesCfg)
803
- if (side == Side . CLIENT ) {
810
+ if (side == Distribution . CLIENT ) {
804
811
this . classpath(project. minecraftTasks. lwjgl3Configuration)
805
812
}
806
813
// Use a raw provider instead of map to not create a dependency on the task
@@ -809,14 +816,10 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
809
816
! file. path. contains(" 2.9.4-nightly-20150209" ) // Remove lwjgl2
810
817
}
811
818
this . classpath(project. java17DependenciesCfg)
812
-
813
- if (! (project. usesMixins. toBoolean() || project. forceEnableMixins. toBoolean())) {
814
- this . extraArgs. addAll(" --tweakClass" , " org.spongepowered.asm.launch.MixinTweaker" )
815
- }
816
819
}
817
820
}
818
821
819
- def runClient17Task = tasks. register(" runClient17" , RunHotswappableMinecraftTask , Side . CLIENT , " runClient" )
822
+ def runClient17Task = tasks. register(" runClient17" , RunHotswappableMinecraftTask , Distribution . CLIENT , " runClient" )
820
823
runClient17Task. configure {
821
824
setup(project)
822
825
group = " Modded Minecraft"
@@ -827,7 +830,7 @@ runClient17Task.configure {
827
830
userUUID = minecraft. userUUID
828
831
}
829
832
830
- def runServer17Task = tasks. register(" runServer17" , RunHotswappableMinecraftTask , Side . SERVER , " runServer" )
833
+ def runServer17Task = tasks. register(" runServer17" , RunHotswappableMinecraftTask , Distribution . DEDICATED_SERVER , " runServer" )
831
834
runServer17Task. configure {
832
835
setup(project)
833
836
group = " Modded Minecraft"
@@ -868,11 +871,6 @@ tasks.named("jar", Jar).configure {
868
871
}
869
872
870
873
if (usesShadowedDependencies. toBoolean()) {
871
- tasks. register(' relocateShadowJar' , ConfigureShadowRelocation ) {
872
- target = tasks. shadowJar
873
- prefix = modGroup + " .shadow"
874
- enabled = relocateShadowedDependencies. toBoolean()
875
- }
876
874
tasks. named(" shadowJar" , ShadowJar ). configure {
877
875
manifest {
878
876
attributes(getManifestAttributes())
@@ -888,7 +886,8 @@ if (usesShadowedDependencies.toBoolean()) {
888
886
]
889
887
archiveClassifier. set(' dev' )
890
888
if (relocateShadowedDependencies. toBoolean()) {
891
- dependsOn(relocateShadowJar)
889
+ relocationPrefix = modGroup + " .shadow"
890
+ enableRelocation = true
892
891
}
893
892
}
894
893
configurations. runtimeElements. outgoing. artifacts. clear()
@@ -1221,7 +1220,7 @@ def addCurseForgeRelation(String type, String name) {
1221
1220
1222
1221
// Updating
1223
1222
1224
- def buildscriptGradleVersion = " 8.0.2 "
1223
+ def buildscriptGradleVersion = " 8.1.1 "
1225
1224
1226
1225
tasks. named(' wrapper' , Wrapper ). configure {
1227
1226
gradleVersion = buildscriptGradleVersion
@@ -1390,7 +1389,7 @@ static int replaceParams(File file, Map<String, String> params) {
1390
1389
return 0
1391
1390
}
1392
1391
1393
- // Dependency Deobfuscation
1392
+ // Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle)
1394
1393
1395
1394
def deobf (String sourceURL ) {
1396
1395
try {
@@ -1432,97 +1431,24 @@ def deobfMaven(String repoURL, String mavenDep) {
1432
1431
}
1433
1432
1434
1433
def deobfCurse (String curseDep ) {
1435
- try {
1436
- return deobfMaven(" https://www.cursemaven.com/" , " curse.maven:$curseDep " )
1437
- } catch (Exception ignored) {
1438
- out. style(Style.Failure ). println (" Failed to get $curseDep from cursemaven." )
1439
- }
1434
+ return dependencies. rfg. deobf(" curse.maven:$curseDep " )
1440
1435
}
1441
1436
1442
1437
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
1443
1438
def deobf (String sourceURL , String rawFileName ) {
1444
1439
String bon2Version = " 2.5.1"
1445
1440
String fileName = URLDecoder . decode(rawFileName, " UTF-8" )
1446
1441
String cacheDir = " $project . gradle . gradleUserHomeDir /caches"
1447
- String bon2Dir = " $cacheDir /forge_gradle/deobf"
1448
- String bon2File = " $bon2Dir /BON2-${ bon2Version} .jar"
1449
1442
String obfFile = " $cacheDir /modules-2/files-2.1/${ fileName} .jar"
1450
- String deobfFile = " $cacheDir /modules-2/files-2.1/${ fileName} -deobf.jar"
1451
-
1452
- if (file(deobfFile). exists()) {
1453
- return files(deobfFile)
1454
- }
1455
-
1456
- String mappingsVer
1457
- String remoteMappings = project. hasProperty(' remoteMappings' ) ? project. remoteMappings : ' https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
1458
- if (remoteMappings) {
1459
- String id = " ${ forgeVersion.split("\\.")[3]} -$minecraftVersion "
1460
- String mappingsZIP = " $cacheDir /forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id /mcp_snapshot_nodoc-${ id} .zip"
1461
-
1462
- zipMappings(mappingsZIP, remoteMappings, bon2Dir)
1463
-
1464
- mappingsVer = " snapshot_$id "
1465
- } else {
1466
- mappingsVer = " ${ channel} _$mappingsVersion "
1467
- }
1468
-
1469
- download. run {
1470
- src " http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version -CUSTOM/BON2-$bon2Version -CUSTOM-all.jar"
1471
- dest bon2File
1472
- quiet true
1473
- overwrite false
1474
- }
1475
1443
1476
1444
download. run {
1477
1445
src sourceURL
1478
1446
dest obfFile
1479
1447
quiet true
1480
1448
overwrite false
1481
1449
}
1482
-
1483
- exec {
1484
- commandLine ' java' , ' -jar' , bon2File, ' --inputJar' , obfFile, ' --outputJar' , deobfFile, ' --mcVer' , minecraftVersion, ' --mappingsVer' , mappingsVer, ' --notch'
1485
- workingDir bon2Dir
1486
- standardOutput = new FileOutputStream (" ${ deobfFile} .log" )
1487
- }
1488
-
1489
- return files(deobfFile)
1450
+ return dependencies. rfg. deobf(files(obfFile))
1490
1451
}
1491
-
1492
- def zipMappings (String zipPath , String url , String bon2Dir ) {
1493
- File zipFile = new File (zipPath)
1494
- if (zipFile. exists()) {
1495
- return
1496
- }
1497
-
1498
- String fieldsCache = " $bon2Dir /data/fields.csv"
1499
- String methodsCache = " $bon2Dir /data/methods.csv"
1500
-
1501
- download. run {
1502
- src " ${ url} fields.csv"
1503
- dest fieldsCache
1504
- quiet true
1505
- }
1506
- download. run {
1507
- src " ${ url} methods.csv"
1508
- dest methodsCache
1509
- quiet true
1510
- }
1511
-
1512
- zipFile. getParentFile(). mkdirs()
1513
- ZipOutputStream zos = new ZipOutputStream (new FileOutputStream (zipFile))
1514
-
1515
- zos. putNextEntry(new ZipEntry (" fields.csv" ))
1516
- Files . copy(Paths . get(fieldsCache), zos)
1517
- zos. closeEntry()
1518
-
1519
- zos. putNextEntry(new ZipEntry (" methods.csv" ))
1520
- Files . copy(Paths . get(methodsCache), zos)
1521
- zos. closeEntry()
1522
-
1523
- zos. close()
1524
- }
1525
-
1526
1452
// Helper methods
1527
1453
1528
1454
def checkPropertyExists (String propertyName ) {
0 commit comments