Skip to content

Commit abc89e8

Browse files
committed
Port to Upsteam Updates
3.7.0
1 parent 4dc16c5 commit abc89e8

31 files changed

+263
-278
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ whitelist.json
2828
*.ipr
2929
*.iws
3030
src/main/resources/mixins.*([!.]).json
31-
*.bat
3231
*.DS_Store
3332
!gradlew.bat
3433
.factorypath
@@ -37,3 +36,7 @@ addon.local.gradle.kts
3736
addon.late.local.gradle
3837
addon.late.local.gradle.kts
3938
layout.json
39+
# downgraded binaries
40+
downloads/
41+
output/
42+
JavaDowngrader-Standalone-1.1.2.jar

build.gradle

+23-163
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ plugins {
4343
id 'de.undercouch.download' version '5.4.0'
4444
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
4545
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.26'
46+
id 'xyz.wagyourtail.jvmdowngrader' version '0.7.2'
4647
}
4748

4849
// In submodules, .git is a file pointing to the real git dir
4950

5051
def out = services.get(StyledTextOutputFactory).create('an-output')
5152

52-
def projectJavaVersion = JavaLanguageVersion.of(8)
53+
tasks.withType(JavaCompile).configureEach {
54+
sourceCompatibility = JavaVersion.VERSION_1_8
55+
targetCompatibility = JavaVersion.VERSION_1_8
56+
}
5357

5458
checkPropertyExists("modName")
5559
checkPropertyExists("modId")
@@ -97,13 +101,10 @@ if (usesShadowedDependencies.toBoolean()) {
97101
apply plugin: "com.github.johnrengelman.shadow"
98102
}
99103

104+
def projectJavaVersion = JavaLanguageVersion.of(8)
100105
java {
101106
toolchain {
102-
if (enableModernJavaSyntax.toBoolean()) {
103-
languageVersion.set(JavaLanguageVersion.of(17))
104-
} else {
105-
languageVersion.set(projectJavaVersion)
106-
}
107+
languageVersion.set(projectJavaVersion)
107108
vendor.set(JvmVendorSpec.AZUL)
108109
}
109110
if (!noPublishedSources) {
@@ -163,7 +164,7 @@ if (enableModernJavaSyntax.toBoolean()) {
163164
options.release.set(8)
164165

165166
javaCompiler.set(javaToolchains.compilerFor {
166-
languageVersion.set(JavaLanguageVersion.of(17))
167+
language.set(JavaLanguage.of(17))
167168
vendor.set(JvmVendorSpec.AZUL)
168169
})
169170
}
@@ -440,6 +441,8 @@ configurations {
440441
// TODO: remove Compile after all uses are refactored to Implementation
441442
config.extendsFrom(shadeCompile)
442443
config.extendsFrom(shadowCompile)
444+
libraryJ8
445+
shadowCompile.extendsFrom(libraryJ8)
443446
}
444447
}
445448
// A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api"
@@ -459,6 +462,8 @@ configurations {
459462
testImplementation.extendsFrom(testCompile)
460463
}
461464

465+
jvmdg.dg(configurations.libraryJ8)
466+
462467
afterEvaluate {
463468
if (!configurations.compile.allDependencies.empty || !configurations.testCompile.allDependencies.empty) {
464469
logger.warn("This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`")
@@ -467,6 +472,7 @@ afterEvaluate {
467472
}
468473

469474
repositories {
475+
mavenCentral()
470476
maven {
471477
name 'Overmind forge repo mirror'
472478
url 'https://gregtech.overminddl1.com/'
@@ -483,6 +489,12 @@ repositories {
483489
includeGroup "org.lwjgl"
484490
}
485491
}
492+
maven {
493+
url = "https://repo.viaversion.com"
494+
metadataSources {
495+
artifact()
496+
}
497+
}
486498
if (includeWellKnownRepositories.toBoolean()) {
487499
exclusiveContent {
488500
forRepository {
@@ -506,17 +518,6 @@ repositories {
506518
includeGroup "maven.modrinth"
507519
}
508520
}
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-
}
520521
maven {
521522
name "MMD Maven"
522523
url "https://maven.mcmoddev.com/"
@@ -572,19 +573,7 @@ configurations.all {
572573

573574
dependencies {
574575
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+
588577
}
589578
}
590579

@@ -652,6 +641,7 @@ tasks.named("processResources", ProcessResources).configure {
652641
}
653642

654643
dependencies {
644+
655645
}
656646

657647
ext.java17JvmArgs = [
@@ -699,9 +689,9 @@ def getManifestAttributes() {
699689

700690
if (usesMixins.toBoolean()) {
701691
manifestAttributes += [
692+
"ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean(),
702693
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
703-
"MixinConfigs" : "mixins." + modId + ".json",
704-
"ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean()
694+
"MixinConfigs" : "mixins." + modId + ".json"
705695
]
706696
}
707697
return manifestAttributes
@@ -718,7 +708,6 @@ if (usesShadowedDependencies.toBoolean()) {
718708
manifest {
719709
attributes(getManifestAttributes())
720710
}
721-
722711
if (minimizeShadowedDependencies.toBoolean()) {
723712
minimize() // This will only allow shading for actually used classes
724713
}
@@ -918,57 +907,6 @@ tasks.named("ideVirtualMainClasses").configure {
918907
// workaround variable hiding in pom processing
919908
def projectConfigs = project.configurations
920909

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-
}
972910

973911
// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
974912
tasks.register('faq') {
@@ -987,84 +925,6 @@ tasks.register('faq') {
987925
}
988926
}
989927

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-
1068928
// Parameter Deobfuscation
1069929

1070930
tasks.register('deobfParams') {

dependencies.gradle

+4-12
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,13 @@
3535
*/
3636
dependencies {
3737
// included for qol, if building fails you can remove these without consequences
38-
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev")
38+
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev")
3939
//runtimeOnlyNonPublishable("com.github.GTNewHorizons:inventory-tweaks:1.6.0:dev")
4040
//runtimeOnlyNonPublishable deobf('https://github.com/Yoghurt4C/Audino/releases/download/1.0.1/Audino-1.0.1.jar')
4141

42-
// compileOnlyApi ("io.netty:netty-all:4.0.23.Final")
42+
shadowCompile fileTree(dir: 'output', include: '*.jar')
4343

44-
shadowCompile "com.viaversion:viaversion-common:${project.viaversion_version}"
45-
shadowCompile "com.viaversion:viabackwards-common:${project.viabackwards_version}"
46-
shadowCompile "com.viaversion:viarewind-common:${project.viarewind_version}"
47-
shadowCompile "net.raphimc:ViaLegacy:${project.vialegacy_version}"
48-
49-
shadowCompile "net.raphimc:ViaAprilFools:${project.viaaprilfools_version}"
50-
shadowCompile "net.raphimc:ViaLoader:${project.vialoader_version}"
51-
52-
shadowImplementation "org.slf4j:slf4j-api:${project.slf4j_version}"
53-
shadowImplementation "org.yaml:snakeyaml:${project.snake_yml_version}"
44+
shadowCompile "org.slf4j:slf4j-api:${project.slf4j_version}"
45+
shadowCompile "org.yaml:snakeyaml:${project.snake_yml_version}"
5446
compileOnlyApi("io.netty:netty-all:4.0.23.Final")
5547
}

gradle.properties

+3-22
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ modId = viaforge
55

66
modGroup = de.florianmichael
77

8-
modVersion = 3.6.1
8+
modVersion = 3.7.0
99
# WHY is there no version field?
1010
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
1111
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
@@ -92,19 +92,6 @@ relocateShadowedDependencies = false
9292
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
9393
includeWellKnownRepositories = false
9494

95-
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
96-
# Authenticate with the MAVEN_USERNAME and MAVEN_PASSWORD environment variables.
97-
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
98-
usesMavenPublishing = false
99-
# mavenPublishUrl = http://jenkins.usrv.eu:8081/nexus/content/repositories/releases
100-
101-
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
102-
# projects. New projects should not use this parameter.
103-
# customArchiveBaseName =
104-
105-
# Optional parameter to prevent the source code from being published
106-
# noPublishedSources =
107-
10895
# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
10996
# (force use delegated build).
11097
# This is meant to be set in $HOME/.gradle/gradle.properties.
@@ -116,16 +103,10 @@ usesMavenPublishing = false
116103
org.gradle.java.installations.auto-detect=true
117104
org.gradle.java.installations.fromEnv=JDK8
118105

119-
project.version = 3.6.1
106+
project.version = 3.7.0
120107

121108
# ViaVersion
122-
viaversion_version=4.10.2
123-
viabackwards_version=4.10.2
124-
viarewind_version=3.1.2
125-
vialegacy_version=2.2.23-SNAPSHOT
126-
viaaprilfools_version=2.0.13-SNAPSHOT
127-
vialoader_version=2.2.14-SNAPSHOT
128109

129110
# Misc Libraries
130111
snake_yml_version=2.2
131-
slf4j_version=2.0.7
112+
slf4j_version=2.0.13

repositories.gradle

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ repositories {
1010
name = "sponge"
1111
url = "https://repo.spongepowered.org/repository/maven-public/"
1212
}
13-
maven {
14-
url = "https://repo.viaversion.com"
13+
maven {
14+
url = "https://repo.viaversion.com"
15+
metadataSources {
16+
artifact()
17+
}
1518
}
1619
maven {
1720
url "https://cursemaven.com"

0 commit comments

Comments
 (0)