@@ -43,13 +43,17 @@ plugins {
43
43
id ' de.undercouch.download' version ' 5.4.0'
44
44
id ' com.github.gmazzo.buildconfig' version ' 3.1.0' apply false // Unused, available for addon.gradle
45
45
id ' com.gtnewhorizons.retrofuturagradle' version ' 1.3.26'
46
+ id ' xyz.wagyourtail.jvmdowngrader' version ' 0.7.2'
46
47
}
47
48
48
49
// In submodules, .git is a file pointing to the real git dir
49
50
50
51
def out = services. get(StyledTextOutputFactory ). create(' an-output' )
51
52
52
- def projectJavaVersion = JavaLanguageVersion . of(8 )
53
+ tasks. withType(JavaCompile ). configureEach {
54
+ sourceCompatibility = JavaVersion . VERSION_1_8
55
+ targetCompatibility = JavaVersion . VERSION_1_8
56
+ }
53
57
54
58
checkPropertyExists(" modName" )
55
59
checkPropertyExists(" modId" )
@@ -97,13 +101,10 @@ if (usesShadowedDependencies.toBoolean()) {
97
101
apply plugin : " com.github.johnrengelman.shadow"
98
102
}
99
103
104
+ def projectJavaVersion = JavaLanguageVersion . of(8 )
100
105
java {
101
106
toolchain {
102
- if (enableModernJavaSyntax. toBoolean()) {
103
- languageVersion. set(JavaLanguageVersion . of(17 ))
104
- } else {
105
- languageVersion. set(projectJavaVersion)
106
- }
107
+ languageVersion. set(projectJavaVersion)
107
108
vendor. set(JvmVendorSpec . AZUL )
108
109
}
109
110
if (! noPublishedSources) {
@@ -163,7 +164,7 @@ if (enableModernJavaSyntax.toBoolean()) {
163
164
options. release. set(8 )
164
165
165
166
javaCompiler. set(javaToolchains. compilerFor {
166
- languageVersion . set(JavaLanguageVersion . of(17 ))
167
+ language . set(JavaLanguage . of(17 ))
167
168
vendor. set(JvmVendorSpec . AZUL )
168
169
})
169
170
}
@@ -440,6 +441,8 @@ configurations {
440
441
// TODO: remove Compile after all uses are refactored to Implementation
441
442
config. extendsFrom(shadeCompile)
442
443
config. extendsFrom(shadowCompile)
444
+ libraryJ8
445
+ shadowCompile. extendsFrom(libraryJ8)
443
446
}
444
447
}
445
448
// A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api"
@@ -459,6 +462,8 @@ configurations {
459
462
testImplementation. extendsFrom(testCompile)
460
463
}
461
464
465
+ jvmdg. dg(configurations. libraryJ8)
466
+
462
467
afterEvaluate {
463
468
if (! configurations. compile. allDependencies. empty || ! configurations. testCompile. allDependencies. empty) {
464
469
logger. warn(" This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`" )
@@ -467,6 +472,7 @@ afterEvaluate {
467
472
}
468
473
469
474
repositories {
475
+ mavenCentral()
470
476
maven {
471
477
name ' Overmind forge repo mirror'
472
478
url ' https://gregtech.overminddl1.com/'
@@ -483,6 +489,12 @@ repositories {
483
489
includeGroup " org.lwjgl"
484
490
}
485
491
}
492
+ maven {
493
+ url = " https://repo.viaversion.com"
494
+ metadataSources {
495
+ artifact()
496
+ }
497
+ }
486
498
if (includeWellKnownRepositories. toBoolean()) {
487
499
exclusiveContent {
488
500
forRepository {
@@ -506,17 +518,6 @@ repositories {
506
518
includeGroup " maven.modrinth"
507
519
}
508
520
}
509
- maven {
510
- name = " ic2"
511
- url = getURL(" https://maven.ic2.player.to/" , " https://maven2.ic2.player.to/" )
512
- content {
513
- includeGroup " net.industrial-craft"
514
- }
515
- metadataSources {
516
- mavenPom()
517
- artifact()
518
- }
519
- }
520
521
maven {
521
522
name " MMD Maven"
522
523
url " https://maven.mcmoddev.com/"
@@ -572,19 +573,7 @@ configurations.all {
572
573
573
574
dependencies {
574
575
constraints {
575
- def minGtnhLibVersion = " 0.0.13"
576
- implementation(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
577
- because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
578
- }
579
- runtimeOnly(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
580
- because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
581
- }
582
- devOnlyNonPublishable(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
583
- because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
584
- }
585
- runtimeOnlyNonPublishable(" com.github.GTNewHorizons:GTNHLib:${ minGtnhLibVersion} " ) {
586
- because(" fixes duplicate mod errors in java 17 configurations using old gtnhlib" )
587
- }
576
+
588
577
}
589
578
}
590
579
@@ -652,6 +641,7 @@ tasks.named("processResources", ProcessResources).configure {
652
641
}
653
642
654
643
dependencies {
644
+
655
645
}
656
646
657
647
ext. java17JvmArgs = [
@@ -699,9 +689,9 @@ def getManifestAttributes() {
699
689
700
690
if (usesMixins. toBoolean()) {
701
691
manifestAttributes + = [
692
+ " ForceLoadAsMod" : ! containsMixinsAndOrCoreModOnly. toBoolean(),
702
693
" TweakClass" : " org.spongepowered.asm.launch.MixinTweaker" ,
703
- " MixinConfigs" : " mixins." + modId + " .json" ,
704
- " ForceLoadAsMod" : ! containsMixinsAndOrCoreModOnly. toBoolean()
694
+ " MixinConfigs" : " mixins." + modId + " .json"
705
695
]
706
696
}
707
697
return manifestAttributes
@@ -718,7 +708,6 @@ if (usesShadowedDependencies.toBoolean()) {
718
708
manifest {
719
709
attributes(getManifestAttributes())
720
710
}
721
-
722
711
if (minimizeShadowedDependencies. toBoolean()) {
723
712
minimize() // This will only allow shading for actually used classes
724
713
}
@@ -918,57 +907,6 @@ tasks.named("ideVirtualMainClasses").configure {
918
907
// workaround variable hiding in pom processing
919
908
def projectConfigs = project. configurations
920
909
921
- publishing {
922
- publications {
923
- create(" maven" , MavenPublication ) {
924
- from components. java
925
-
926
- if (apiPackage) {
927
- artifact apiJar
928
- }
929
-
930
- groupId = System . getenv(" ARTIFACT_GROUP_ID" ) ?: project. group
931
- artifactId = System . getenv(" ARTIFACT_ID" ) ?: project. name
932
- // Using the identified version, not project.version as it has the prepended 1.7.10
933
- version = System . getenv(" RELEASE_VERSION" ) ?: identifiedVersion
934
- }
935
- }
936
- repositories {
937
- if (usesMavenPublishing. toBoolean() && System . getenv(" MAVEN_USER" ) != null ) {
938
- maven {
939
- url = mavenPublishUrl
940
- allowInsecureProtocol = mavenPublishUrl. startsWith(" http://" ) // Mostly for the GTNH maven
941
- credentials {
942
- username = System . getenv(" MAVEN_USER" ) ?: " NONE"
943
- password = System . getenv(" MAVEN_PASSWORD" ) ?: " NONE"
944
- }
945
- }
946
- }
947
- }
948
- }
949
-
950
- // Updating
951
-
952
- def buildscriptGradleVersion = " 8.5"
953
-
954
- tasks. named(' wrapper' , Wrapper ). configure {
955
- gradleVersion = buildscriptGradleVersion
956
- }
957
-
958
- tasks. register(' updateBuildScript' ) {
959
- group = ' GTNH Buildscript'
960
- description = ' Updates the build script to the latest version'
961
-
962
- if (gradle. gradleVersion != buildscriptGradleVersion && ! Boolean . getBoolean(' DISABLE_BUILDSCRIPT_GRADLE_UPDATE' )) {
963
- dependsOn(' wrapper' )
964
- }
965
-
966
- doLast {
967
- if (performBuildScriptUpdate()) return
968
-
969
- print (" Build script already up-to-date!" )
970
- }
971
- }
972
910
973
911
// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
974
912
tasks. register(' faq' ) {
@@ -987,84 +925,6 @@ tasks.register('faq') {
987
925
}
988
926
}
989
927
990
- static URL availableBuildScriptUrl () {
991
- new URL (" https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle" )
992
- }
993
-
994
- static URL exampleSettingsGradleUrl () {
995
- new URL (" https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example" )
996
- }
997
-
998
- static URL exampleGitAttributesUrl () {
999
- new URL (" https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes" )
1000
- }
1001
-
1002
-
1003
- boolean verifyGitAttributes () {
1004
- def gitattributesFile = getFile(" .gitattributes" )
1005
- if (! gitattributesFile. exists()) {
1006
- println (" Downloading default .gitattributes" )
1007
- exampleGitAttributesUrl(). withInputStream { i -> gitattributesFile. withOutputStream { it << i } }
1008
- exec {
1009
- workingDir ' .'
1010
- commandLine ' git' , ' add' , ' --renormalize' , ' .'
1011
- }
1012
- return true
1013
- }
1014
- return false
1015
- }
1016
-
1017
- boolean verifySettingsGradle () {
1018
- def settingsFile = getFile(" settings.gradle" )
1019
- if (! settingsFile. exists()) {
1020
- println (" Downloading default settings.gradle" )
1021
- exampleSettingsGradleUrl(). withInputStream { i -> settingsFile. withOutputStream { it << i } }
1022
- return true
1023
- }
1024
- return false
1025
- }
1026
-
1027
- boolean performBuildScriptUpdate () {
1028
- if (isNewBuildScriptVersionAvailable()) {
1029
- def buildscriptFile = getFile(" build.gradle" )
1030
- availableBuildScriptUrl(). withInputStream { i -> buildscriptFile. withOutputStream { it << i } }
1031
- def out = services. get(StyledTextOutputFactory ). create(' buildscript-update-output' )
1032
- out. style(Style.Success ). print (" Build script updated. Please REIMPORT the project or RESTART your IDE!" )
1033
- boolean settingsupdated = verifySettingsGradle()
1034
- settingsupdated = verifyGitAttributes() || settingsupdated
1035
- if (settingsupdated)
1036
- throw new GradleException (" Settings has been updated, please re-run task." )
1037
- return true
1038
- }
1039
- return false
1040
- }
1041
-
1042
- boolean isNewBuildScriptVersionAvailable () {
1043
- Map parameters = [" connectTimeout" : 2000 , " readTimeout" : 2000 ]
1044
-
1045
- String currentBuildScript = getFile(" build.gradle" ). getText()
1046
- String currentBuildScriptHash = getVersionHash(currentBuildScript)
1047
- String availableBuildScriptHash
1048
- try {
1049
- String availableBuildScript = availableBuildScriptUrl(). newInputStream(parameters). getText()
1050
- availableBuildScriptHash = getVersionHash(availableBuildScript)
1051
- } catch (IOException e) {
1052
- logger. warn(" Could not check for buildscript update availability: {}" , e. message)
1053
- return false
1054
- }
1055
-
1056
- boolean isUpToDate = currentBuildScriptHash. empty || availableBuildScriptHash. empty || currentBuildScriptHash == availableBuildScriptHash
1057
- return ! isUpToDate
1058
- }
1059
-
1060
- static String getVersionHash (String buildScriptContent ) {
1061
- String versionLine = buildScriptContent. find(" ^//version: [a-z0-9]*" )
1062
- if (versionLine != null ) {
1063
- return versionLine. split(" : " ). last()
1064
- }
1065
- return " "
1066
- }
1067
-
1068
928
// Parameter Deobfuscation
1069
929
1070
930
tasks. register(' deobfParams' ) {
0 commit comments