1
- // version: 1685785062
1
+ // version: 1690104383
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.
@@ -69,7 +69,7 @@ plugins {
69
69
id ' com.diffplug.spotless' version ' 6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
70
70
id ' com.modrinth.minotaur' version ' 2.+' apply false
71
71
id ' com.matthewprenger.cursegradle' version ' 1.4.0' apply false
72
- id ' com.gtnewhorizons.retrofuturagradle' version ' 1.3.14 '
72
+ id ' com.gtnewhorizons.retrofuturagradle' version ' 1.3.21 '
73
73
}
74
74
75
75
print (" You might want to check out './gradlew :faq' if your build fails.\n " )
@@ -115,6 +115,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
115
115
propertyDefaultIfUnset(" forceEnableMixins" , false )
116
116
propertyDefaultIfUnset(" channel" , " stable" )
117
117
propertyDefaultIfUnset(" mappingsVersion" , " 12" )
118
+ propertyDefaultIfUnset(" usesMavenPublishing" , true )
119
+ propertyDefaultIfUnset(" mavenPublishUrl" , " http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" )
118
120
propertyDefaultIfUnset(" modrinthProjectId" , " " )
119
121
propertyDefaultIfUnset(" modrinthRelations" , " " )
120
122
propertyDefaultIfUnset(" curseForgeProjectId" , " " )
@@ -357,7 +359,27 @@ catch (Exception ignored) {
357
359
String identifiedVersion
358
360
String versionOverride = System . getenv(" VERSION" ) ?: null
359
361
try {
360
- identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
362
+ // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
363
+ if (versionOverride == null ) {
364
+ def gitDetails = versionDetails()
365
+ def isDirty = gitVersion(). endsWith(" .dirty" ) // No public API for this, isCleanTag has a different meaning
366
+ String branchName = gitDetails. branchName ?: (System . getenv(' GIT_BRANCH' ) ?: ' git' )
367
+ if (branchName. startsWith(' origin/' )) {
368
+ branchName = branchName. minus(' origin/' )
369
+ }
370
+ branchName = branchName. replaceAll(" [^a-zA-Z0-9-]+" , " -" ) // sanitize branch names for semver
371
+ identifiedVersion = gitDetails. lastTag ?: ' ${gitDetails.gitHash}'
372
+ if (gitDetails. commitDistance > 0 ) {
373
+ identifiedVersion + = " -${ branchName} .${ gitDetails.commitDistance} +${ gitDetails.gitHash} "
374
+ if (isDirty) {
375
+ identifiedVersion + = " -dirty"
376
+ }
377
+ } else if (isDirty) {
378
+ identifiedVersion + = " -${ branchName} +${ gitDetails.gitHash} -dirty"
379
+ }
380
+ } else {
381
+ identifiedVersion = versionOverride
382
+ }
361
383
}
362
384
catch (Exception ignored) {
363
385
out. style(Style.Failure ). text(
@@ -465,10 +487,19 @@ sourceSets {
465
487
}
466
488
}
467
489
468
- if (file(' addon.gradle' ). exists()) {
490
+ if (file(' addon.gradle.kts' ). exists()) {
491
+ apply from : ' addon.gradle.kts'
492
+ } else if (file(' addon.gradle' ). exists()) {
469
493
apply from : ' addon.gradle'
470
494
}
471
495
496
+ // File for local tweaks not commited to Git
497
+ if (file(' addon.local.gradle.kts' ). exists()) {
498
+ apply from : ' addon.local.gradle.kts'
499
+ } else if (file(' addon.local.gradle' ). exists()) {
500
+ apply from : ' addon.local.gradle'
501
+ }
502
+
472
503
// Allow unsafe repos but warn
473
504
repositories. configureEach { repo ->
474
505
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository ) {
@@ -479,7 +510,14 @@ repositories.configureEach { repo ->
479
510
}
480
511
}
481
512
482
- apply from : ' repositories.gradle'
513
+ if (file(' repositories.gradle.kts' ). exists()) {
514
+ apply from : ' repositories.gradle.kts'
515
+ } else if (file(' repositories.gradle' ). exists()) {
516
+ apply from : ' repositories.gradle'
517
+ } else {
518
+ logger. error(" Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template." )
519
+ throw new RuntimeException (" Missing repositories.gradle[.kts]" )
520
+ }
483
521
484
522
configurations {
485
523
runtimeClasspath. extendsFrom(runtimeOnlyNonPublishable)
@@ -537,13 +575,28 @@ repositories {
537
575
}
538
576
}
539
577
if (includeWellKnownRepositories. toBoolean()) {
540
- maven {
541
- name " CurseMaven"
542
- url " https://cursemaven.com"
543
- content {
578
+ exclusiveContent {
579
+ forRepository {
580
+ maven {
581
+ name " CurseMaven"
582
+ url " https://cursemaven.com"
583
+ }
584
+ }
585
+ filter {
544
586
includeGroup " curse.maven"
545
587
}
546
588
}
589
+ exclusiveContent {
590
+ forRepository {
591
+ maven {
592
+ name = " Modrinth"
593
+ url = " https://api.modrinth.com/maven"
594
+ }
595
+ }
596
+ filter {
597
+ includeGroup " maven.modrinth"
598
+ }
599
+ }
547
600
maven {
548
601
name = " ic2"
549
602
url = " https://maven.ic2.player.to/"
@@ -585,7 +638,7 @@ dependencies {
585
638
}
586
639
}
587
640
if (usesMixins. toBoolean()) {
588
- implementation(mixinProviderSpec)
641
+ implementation(modUtils . enableMixins( mixinProviderSpec) )
589
642
} else if (forceEnableMixins. toBoolean()) {
590
643
runtimeOnlyNonPublishable(mixinProviderSpec)
591
644
}
@@ -611,12 +664,34 @@ configurations.all {
611
664
}
612
665
}
613
666
614
- apply from : ' dependencies.gradle'
667
+ dependencies {
668
+ constraints {
669
+ def minGtnhLibVersion = " 0.0.13"
670
+ implementation(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
671
+ because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
672
+ }
673
+ runtimeOnly(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
674
+ because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
675
+ }
676
+ devOnlyNonPublishable(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
677
+ because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
678
+ }
679
+ runtimeOnlyNonPublishable(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
680
+ because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
681
+ }
682
+ }
683
+ }
684
+
685
+ if (file(' dependencies.gradle.kts' ). exists()) {
686
+ apply from : ' dependencies.gradle.kts'
687
+ } else if (file(' dependencies.gradle' ). exists()) {
688
+ apply from : ' dependencies.gradle'
689
+ } else {
690
+ logger. error(" Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template." )
691
+ throw new RuntimeException (" Missing dependencies.gradle[.kts]" )
692
+ }
615
693
616
694
def mixingConfigRefMap = ' mixins.' + modId + ' .refmap.json'
617
- def mixinTmpDir = buildDir. path + File . separator + ' tmp' + File . separator + ' mixins'
618
- def refMap = " ${ mixinTmpDir} " + File . separator + mixingConfigRefMap
619
- def mixinSrg = " ${ mixinTmpDir} " + File . separator + " mixins.srg"
620
695
621
696
tasks. register(' generateAssets' ) {
622
697
group = " GTNH Buildscript"
@@ -648,46 +723,17 @@ tasks.register('generateAssets') {
648
723
}
649
724
650
725
if (usesMixins. toBoolean()) {
651
- tasks. named(" reobfJar" , ReobfuscatedJar ). configure {
652
- extraSrgFiles. from(mixinSrg)
653
- }
654
-
655
726
tasks. named(" processResources" ). configure {
656
727
dependsOn(" generateAssets" )
657
728
}
658
729
659
730
tasks. named(" compileJava" , JavaCompile ). configure {
660
- doFirst {
661
- new File (mixinTmpDir). mkdirs()
662
- }
663
731
options. compilerArgs + = [
664
- " -AreobfSrgFile=${ tasks.reobfJar.srg.get().asFile} " ,
665
- " -AoutSrgFile=${ mixinSrg} " ,
666
- " -AoutRefMapFile=${ refMap} " ,
667
732
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
668
733
" -XDenableSunApiLintControl" ,
669
734
" -XDignore.symbol.file"
670
735
]
671
736
}
672
-
673
- pluginManager. withPlugin(' org.jetbrains.kotlin.kapt' ) {
674
- kapt {
675
- correctErrorTypes = true
676
- javacOptions {
677
- option(" -AreobfSrgFile=${ tasks.reobfJar.srg.get().asFile} " )
678
- option(" -AoutSrgFile=$mixinSrg " )
679
- option(" -AoutRefMapFile=$refMap " )
680
- }
681
- }
682
- tasks. configureEach { task ->
683
- if (task. name == " kaptKotlin" ) {
684
- task. doFirst {
685
- new File (mixinTmpDir). mkdirs()
686
- }
687
- }
688
- }
689
- }
690
-
691
737
}
692
738
693
739
tasks. named(" processResources" , ProcessResources ). configure {
@@ -705,7 +751,6 @@ tasks.named("processResources", ProcessResources).configure {
705
751
}
706
752
707
753
if (usesMixins. toBoolean()) {
708
- from refMap
709
754
dependsOn(" compileJava" , " compileScala" )
710
755
}
711
756
}
@@ -724,13 +769,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
724
769
}
725
770
726
771
dependencies {
727
- def lwjgl3ifyVersion = ' 1.3.5 '
772
+ def lwjgl3ifyVersion = ' 1.4.0 '
728
773
def asmVersion = ' 9.4'
729
774
if (modId != ' lwjgl3ify' ) {
730
775
java17Dependencies(" com.github.GTNewHorizons:lwjgl3ify:${ lwjgl3ifyVersion} " )
731
776
}
732
777
if (modId != ' hodgepodge' ) {
733
- java17Dependencies(' com.github.GTNewHorizons:Hodgepodge:2.2.13 ' )
778
+ java17Dependencies(' com.github.GTNewHorizons:Hodgepodge:2.2.19 ' )
734
779
}
735
780
736
781
java17PatchDependencies(' net.minecraft:launchwrapper:1.15' ) {transitive = false }
@@ -979,6 +1024,9 @@ idea {
979
1024
}
980
1025
}
981
1026
runConfigurations {
1027
+ " 0. Build and Test" (Gradle ) {
1028
+ taskNames = [" build" ]
1029
+ }
982
1030
" 1. Run Client" (Gradle ) {
983
1031
taskNames = [" runClient" ]
984
1032
}
@@ -1098,6 +1146,11 @@ tasks.named("processIdeaSettings").configure {
1098
1146
dependsOn(" injectTags" )
1099
1147
}
1100
1148
1149
+ tasks. named(" ideVirtualMainClasses" ). configure {
1150
+ // Make IntelliJ "Build project" build the mod jars
1151
+ dependsOn(" jar" , " reobfJar" , " spotlessCheck" )
1152
+ }
1153
+
1101
1154
// workaround variable hiding in pom processing
1102
1155
def projectConfigs = project. configurations
1103
1156
@@ -1118,12 +1171,14 @@ publishing {
1118
1171
}
1119
1172
1120
1173
repositories {
1121
- maven {
1122
- url = " http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
1123
- allowInsecureProtocol = true
1124
- credentials {
1125
- username = System . getenv(" MAVEN_USER" ) ?: " NONE"
1126
- password = System . getenv(" MAVEN_PASSWORD" ) ?: " NONE"
1174
+ if (usesMavenPublishing. toBoolean()) {
1175
+ maven {
1176
+ url = mavenPublishUrl
1177
+ allowInsecureProtocol = mavenPublishUrl. startsWith(" http://" ) // Mostly for the GTNH maven
1178
+ credentials {
1179
+ username = System . getenv(" MAVEN_USER" ) ?: " NONE"
1180
+ password = System . getenv(" MAVEN_PASSWORD" ) ?: " NONE"
1181
+ }
1127
1182
}
1128
1183
}
1129
1184
}
@@ -1238,7 +1293,7 @@ def addCurseForgeRelation(String type, String name) {
1238
1293
1239
1294
// Updating
1240
1295
1241
- def buildscriptGradleVersion = " 8.1 .1"
1296
+ def buildscriptGradleVersion = " 8.2 .1"
1242
1297
1243
1298
tasks. named(' wrapper' , Wrapper ). configure {
1244
1299
gradleVersion = buildscriptGradleVersion
@@ -1344,8 +1399,14 @@ boolean isNewBuildScriptVersionAvailable() {
1344
1399
1345
1400
String currentBuildScript = getFile(" build.gradle" ). getText()
1346
1401
String currentBuildScriptHash = getVersionHash(currentBuildScript)
1347
- String availableBuildScript = availableBuildScriptUrl(). newInputStream(parameters). getText()
1348
- String availableBuildScriptHash = getVersionHash(availableBuildScript)
1402
+ String availableBuildScriptHash
1403
+ try {
1404
+ String availableBuildScript = availableBuildScriptUrl(). newInputStream(parameters). getText()
1405
+ availableBuildScriptHash = getVersionHash(availableBuildScript)
1406
+ } catch (IOException e) {
1407
+ logger. warn(" Could not check for buildscript update availability: {}" , e. message)
1408
+ return false
1409
+ }
1349
1410
1350
1411
boolean isUpToDate = currentBuildScriptHash. empty || availableBuildScriptHash. empty || currentBuildScriptHash == availableBuildScriptHash
1351
1412
return ! isUpToDate
@@ -1510,3 +1571,17 @@ def getSecondaryArtifacts() {
1510
1571
if (apiPackage) secondaryArtifacts + = [apiJar]
1511
1572
return secondaryArtifacts
1512
1573
}
1574
+
1575
+ // For easier scripting of things that require variables defined earlier in the buildscript
1576
+ if (file(' addon.late.gradle.kts' ). exists()) {
1577
+ apply from : ' addon.late.gradle.kts'
1578
+ } else if (file(' addon.late.gradle' ). exists()) {
1579
+ apply from : ' addon.late.gradle'
1580
+ }
1581
+
1582
+ // File for local tweaks not commited to Git
1583
+ if (file(' addon.late.local.gradle.kts' ). exists()) {
1584
+ apply from : ' addon.late.local.gradle.kts'
1585
+ } else if (file(' addon.late.local.gradle' ). exists()) {
1586
+ apply from : ' addon.late.local.gradle'
1587
+ }
0 commit comments