diff --git a/build.gradle b/build.gradle
index fe8a2e7..952a3c5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,4 +1,4 @@
-//version: 1675110695
+//version: 1704650211
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -6,47 +6,34 @@
*/
-import com.diffplug.blowdryer.Blowdryer
-import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
+import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
+import com.gtnewhorizons.retrofuturagradle.util.Distribution
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseRelation
import com.modrinth.minotaur.dependencies.ModDependency
import com.modrinth.minotaur.dependencies.VersionDependency
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
-import org.jetbrains.gradle.ext.*
+import org.gradle.internal.xml.XmlTransformer
+import org.jetbrains.gradle.ext.Application
+import org.jetbrains.gradle.ext.Gradle
+import javax.inject.Inject
import java.nio.file.Files
import java.nio.file.Paths
import java.util.concurrent.TimeUnit
-import java.util.zip.ZipEntry
-import java.util.zip.ZipOutputStream
buildscript {
repositories {
- mavenLocal()
- mavenCentral()
-
- maven {
- name 'forge'
- url 'https://maven.minecraftforge.net'
- }
maven {
// GTNH RetroFuturaGradle and ASM Fork
name "GTNH Maven"
- url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
- allowInsecureProtocol = true
- }
- maven {
- name 'sonatype'
- url 'https://oss.sonatype.org/content/repositories/snapshots/'
- }
- maven {
- name 'Scala CI dependencies'
- url 'https://repo1.maven.org/maven2/'
+ url "https://nexus.gtnewhorizons.com/repository/public/"
}
+ mavenLocal()
}
}
plugins {
@@ -58,22 +45,26 @@ plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
- id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle
- id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
- id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
- id 'de.undercouch.download' version '5.3.0'
+ id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
+ id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
+ id 'com.palantir.git-version' version '3.0.0' apply false
+ id 'de.undercouch.download' version '5.5.0'
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
- id 'com.diffplug.spotless' version '6.7.2' apply false
+ id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
- id 'com.gtnewhorizons.retrofuturagradle' version '1.1.2'
+ id 'com.gtnewhorizons.retrofuturagradle' version '1.3.27'
}
+
+print("You might want to check out './gradlew :faq' if your build fails.\n")
+
boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated)
throw new GradleException("Settings has been updated, please re-run task.")
-if (project.file('.git/HEAD').isFile()) {
+// In submodules, .git is a file pointing to the real git dir
+if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
apply plugin: 'com.palantir.git-version'
}
@@ -82,6 +73,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output')
def projectJavaVersion = JavaLanguageVersion.of(8)
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
+boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false
+
+final String CHECKSTYLE_CONFIG = """
+
+
+
+
+
+
+
+
+
+
+
+"""
checkPropertyExists("modName")
checkPropertyExists("modId")
@@ -108,6 +116,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
+propertyDefaultIfUnset("usesMavenPublishing", true)
+propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
@@ -122,12 +132,26 @@ propertyDefaultIfUnset("gradleTokenGroupName", "")
propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only
propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only
-project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts
+// this is meant to be set using the user wide property file. by default we do nothing.
+propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea"
+
+project.extensions.add(com.diffplug.blowdryer.Blowdryer, "Blowdryer", com.diffplug.blowdryer.Blowdryer) // Make blowdryer available in "apply from:" scripts
if (!disableSpotless) {
apply plugin: 'com.diffplug.spotless'
apply from: Blowdryer.file('spotless.gradle')
}
+if (!disableCheckstyle) {
+ apply plugin: 'checkstyle'
+ tasks.named("checkstylePatchedMc") { enabled = false }
+ tasks.named("checkstyleMcLauncher") { enabled = false }
+ tasks.named("checkstyleIdeVirtualMain") { enabled = false }
+ tasks.named("checkstyleInjectedTags") { enabled = false }
+ checkstyle {
+ config = resources.text.fromString(CHECKSTYLE_CONFIG)
+ }
+}
+
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
@@ -143,13 +167,21 @@ java {
} else {
languageVersion.set(projectJavaVersion)
}
- vendor.set(JvmVendorSpec.ADOPTIUM)
+ vendor.set(JvmVendorSpec.AZUL)
}
if (!noPublishedSources) {
withSourcesJar()
}
}
+tasks.withType(JavaCompile).configureEach {
+ options.encoding = "UTF-8"
+}
+
+tasks.withType(ScalaCompile).configureEach {
+ options.encoding = "UTF-8"
+}
+
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
// If Kotlin is enabled in the project
kotlin {
@@ -183,14 +215,34 @@ configurations {
canBeConsumed = false
canBeResolved = false
}
+
+ create("devOnlyNonPublishable") {
+ description = "Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)"
+ canBeConsumed = false
+ canBeResolved = false
+ }
+ compileOnly.extendsFrom(devOnlyNonPublishable)
+ runtimeOnlyNonPublishable.extendsFrom(devOnlyNonPublishable)
}
if (enableModernJavaSyntax.toBoolean()) {
+ repositories {
+ mavenCentral {
+ mavenContent {
+ includeGroup("me.eigenraven.java8unsupported")
+ }
+ }
+ }
+
dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
+ // workaround for https://github.com/bsideup/jabel/issues/174
+ annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
transitive = false // We only care about the 1 annotation class
}
+ // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937.
+ patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0')
}
tasks.withType(JavaCompile).configureEach {
@@ -202,7 +254,7 @@ if (enableModernJavaSyntax.toBoolean()) {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(17))
- vendor.set(JvmVendorSpec.ADOPTIUM)
+ vendor.set(JvmVendorSpec.AZUL)
})
}
}
@@ -234,12 +286,14 @@ if (apiPackage) {
}
if (accessTransformersFile) {
- String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
- if (!getFile(targetFile).exists()) {
- throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
+ for (atFile in accessTransformersFile.split(" ")) {
+ String targetFile = "src/main/resources/META-INF/" + atFile.trim()
+ if (!getFile(targetFile).exists()) {
+ throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
+ }
+ tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
+ tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
}
- tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
- tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
} else {
boolean atsFound = false
for (File at : sourceSets.getByName("main").resources.files) {
@@ -317,7 +371,27 @@ catch (Exception ignored) {
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
- identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
+ // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
+ if (versionOverride == null) {
+ def gitDetails = versionDetails()
+ def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
+ String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
+ if (branchName.startsWith('origin/')) {
+ branchName = branchName.minus('origin/')
+ }
+ branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
+ identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
+ if (gitDetails.commitDistance > 0) {
+ identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
+ if (isDirty) {
+ identifiedVersion += "-dirty"
+ }
+ } else if (isDirty) {
+ identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
+ }
+ } else {
+ identifiedVersion = versionOverride
+ }
}
catch (Exception ignored) {
out.style(Style.Failure).text(
@@ -339,9 +413,13 @@ if (identifiedVersion == versionOverride) {
group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
- archivesBaseName = customArchiveBaseName
+ base {
+ archivesName = customArchiveBaseName
+ }
} else {
- archivesBaseName = modId
+ base {
+ archivesName = modId
+ }
}
@@ -367,12 +445,14 @@ minecraft {
injectMissingGenerics.set(true)
}
+ username = developmentEnvironmentUserName.toString()
+
+ lwjgl3Version = "3.3.2"
+
// Enable assertions in the current mod
extraRunJvmArguments.add("-ea:${modGroup}")
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
- extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
-
if (usesMixinDebug.toBoolean()) {
extraRunJvmArguments.addAll([
"-Dmixin.debug.countInjections=true",
@@ -401,6 +481,16 @@ configurations.configureEach {
}
}
}
+ def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE)
+ if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) {
+ resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+ // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server
+ if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') {
+ details.useVersion '2388750'
+ details.because 'Pick obfuscated jar'
+ }
+ }
+ }
}
// Ensure tests have access to minecraft classes
@@ -413,10 +503,19 @@ sourceSets {
}
}
-if (file('addon.gradle').exists()) {
+if (file('addon.gradle.kts').exists()) {
+ apply from: 'addon.gradle.kts'
+} else if (file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
+// File for local tweaks not commited to Git
+if (file('addon.local.gradle.kts').exists()) {
+ apply from: 'addon.local.gradle.kts'
+} else if (file('addon.local.gradle').exists()) {
+ apply from: 'addon.local.gradle'
+}
+
// Allow unsafe repos but warn
repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
@@ -427,11 +526,19 @@ repositories.configureEach { repo ->
}
}
-apply from: 'repositories.gradle'
+if (file('repositories.gradle.kts').exists()) {
+ apply from: 'repositories.gradle.kts'
+} else if (file('repositories.gradle').exists()) {
+ apply from: 'repositories.gradle'
+} else {
+ logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.")
+ throw new RuntimeException("Missing repositories.gradle[.kts]")
+}
configurations {
+ runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
+ testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) {
- config.extendsFrom(runtimeOnlyNonPublishable)
if (usesShadowedDependencies.toBoolean()) {
config.extendsFrom(shadowImplementation)
// TODO: remove Compile after all uses are refactored to Implementation
@@ -464,45 +571,53 @@ afterEvaluate {
}
repositories {
+ maven {
+ name = "GTNH Maven"
+ url = "https://nexus.gtnewhorizons.com/repository/public/"
+ // Links for convenience:
+ // Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/
+ // Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases
+ }
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
- mavenContent {
- excludeGroup("net.minecraftforge") // missing the `universal` artefact
- }
}
maven {
- name = "GTNH Maven"
- url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
- allowInsecureProtocol = true
- }
- if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
- if (usesMixinDebug.toBoolean()) {
- maven {
- name = "Fabric Maven"
- url = "https://maven.fabricmc.net/"
- }
+ name 'sonatype'
+ url 'https://oss.sonatype.org/content/repositories/snapshots/'
+ content {
+ includeGroup "org.lwjgl"
}
}
if (includeWellKnownRepositories.toBoolean()) {
- maven {
- name "CurseMaven"
- url "https://cursemaven.com"
- content {
+ exclusiveContent {
+ forRepository {
+ maven {
+ name "CurseMaven"
+ url "https://cursemaven.com"
+ }
+ }
+ filter {
includeGroup "curse.maven"
}
}
- maven {
- name = "ic2"
- url = "https://maven.ic2.player.to/"
- metadataSources {
- mavenPom()
- artifact()
+ exclusiveContent {
+ forRepository {
+ maven {
+ name = "Modrinth"
+ url = "https://api.modrinth.com/maven"
+ }
+ }
+ filter {
+ includeGroup "maven.modrinth"
}
}
maven {
- name = "ic2-mirror"
- url = "https://maven2.ic2.player.to/"
+ name = "ic2"
+ url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/")
+ content {
+ includeGroup "net.industrial-craft"
+ }
metadataSources {
mavenPom()
artifact()
@@ -515,35 +630,80 @@ repositories {
}
}
+def mixinProviderGroup = "io.github.legacymoddingmc"
+def mixinProviderModule = "unimixins"
+def mixinProviderVersion = "0.1.13"
+def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
+def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
+ext.mixinProviderSpec = mixinProviderSpec
+
+def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
+
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
- annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
+ annotationProcessor(mixinProviderSpec)
if (usesMixinDebug.toBoolean()) {
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
- if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
- implementation('com.gtnewhorizon:gtnhmixins:2.1.10')
+ if (usesMixins.toBoolean()) {
+ implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
+ } else if (forceEnableMixins.toBoolean()) {
+ runtimeOnlyNonPublishable(mixinProviderSpec)
}
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) {
dependencies {
- kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
+ kapt(mixinProviderSpec)
}
}
}
-apply from: 'dependencies.gradle'
+// Replace old mixin mods with unimixins
+// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier
+configurations.all {
+ resolutionStrategy.dependencySubstitution {
+ substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
+ substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
+ substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
+ substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
+ substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
-def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
-def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
-def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
-def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
+ substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets')
+ }
+}
+
+dependencies {
+ constraints {
+ def minGtnhLibVersion = "0.0.13"
+ implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
+ because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
+ }
+ runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
+ because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
+ }
+ devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
+ because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
+ }
+ runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
+ because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
+ }
+ }
+}
+
+if (file('dependencies.gradle.kts').exists()) {
+ apply from: 'dependencies.gradle.kts'
+} else if (file('dependencies.gradle').exists()) {
+ apply from: 'dependencies.gradle'
+} else {
+ logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.")
+ throw new RuntimeException("Missing dependencies.gradle[.kts]")
+}
tasks.register('generateAssets') {
group = "GTNH Buildscript"
@@ -575,46 +735,17 @@ tasks.register('generateAssets') {
}
if (usesMixins.toBoolean()) {
- tasks.named("reobfJar", ReobfuscatedJar).configure {
- extraSrgFiles.from(mixinSrg)
- }
-
tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure {
- doFirst {
- new File(mixinTmpDir).mkdirs()
- }
options.compilerArgs += [
- "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
- "-AoutSrgFile=${mixinSrg}",
- "-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
-
- pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
- kapt {
- correctErrorTypes = true
- javacOptions {
- option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
- option("-AoutSrgFile=$mixinSrg")
- option("-AoutRefMapFile=$refMap")
- }
- }
- tasks.configureEach { task ->
- if (task.name == "kaptKotlin") {
- task.doFirst {
- new File(mixinTmpDir).mkdirs()
- }
- }
- }
- }
-
}
tasks.named("processResources", ProcessResources).configure {
@@ -632,10 +763,149 @@ tasks.named("processResources", ProcessResources).configure {
}
if (usesMixins.toBoolean()) {
- from refMap
+ dependsOn("compileJava", "compileScala")
}
}
+ext.java17Toolchain = (JavaToolchainSpec spec) -> {
+ spec.languageVersion.set(JavaLanguageVersion.of(17))
+ spec.vendor.set(JvmVendorSpec.matching("jetbrains"))
+}
+
+ext.java17DependenciesCfg = configurations.create("java17Dependencies") {
+ extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution
+ canBeConsumed = false
+}
+ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") {
+ canBeConsumed = false
+}
+
+dependencies {
+ def lwjgl3ifyVersion = '1.5.7'
+ if (modId != 'lwjgl3ify') {
+ java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
+ }
+ if (modId != 'hodgepodge') {
+ java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
+ }
+
+ java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
+}
+
+ext.java17JvmArgs = [
+ // Java 9+ support
+ "--illegal-access=warn",
+ "-Djava.security.manager=allow",
+ "-Dfile.encoding=UTF-8",
+ "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
+ "--add-opens", "java.base/java.net=ALL-UNNAMED",
+ "--add-opens", "java.base/java.nio=ALL-UNNAMED",
+ "--add-opens", "java.base/java.io=ALL-UNNAMED",
+ "--add-opens", "java.base/java.lang=ALL-UNNAMED",
+ "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
+ "--add-opens", "java.base/java.text=ALL-UNNAMED",
+ "--add-opens", "java.base/java.util=ALL-UNNAMED",
+ "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
+ "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
+ "--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
+ "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
+ "--add-modules", "jdk.dynalink",
+ "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
+ "--add-modules", "java.sql.rowset",
+ "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
+]
+
+ext.hotswapJvmArgs = [
+ // DCEVM advanced hot reload
+ "-XX:+AllowEnhancedClassRedefinition",
+ "-XX:HotswapAgent=fatjar"
+]
+
+ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") {
+ group = "GTNH Buildscript"
+ description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory"
+ def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar'
+ def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")}
+ def targetFilename = "hotswap-agent.jar"
+ onlyIf {
+ !targetFolderProvider.get().file(targetFilename).asFile.exists()
+ }
+ doLast {
+ def targetFolder = targetFolderProvider.get()
+ targetFolder.asFile.mkdirs()
+ download.run {
+ src hsaUrl
+ dest targetFolder.file(targetFilename).asFile
+ overwrite false
+ tempAndMove true
+ }
+ }
+}
+
+public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
+ // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable
+ private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP"));
+
+ @Input
+ public boolean getEnableHotswap() { return enableHotswap }
+ @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger")
+ public boolean setEnableHotswap(boolean enable) { enableHotswap = enable }
+
+ @Inject
+ public RunHotswappableMinecraftTask(Distribution side, String superTask, org.gradle.api.invocation.Gradle gradle) {
+ super(side, gradle)
+
+ this.lwjglVersion = 3
+ this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain)
+ this.extraJvmArgs.addAll(project.java17JvmArgs)
+ this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : []))
+
+ this.classpath(project.java17PatchDependenciesCfg)
+ if (side == Distribution.CLIENT) {
+ this.classpath(project.minecraftTasks.lwjgl3Configuration)
+ }
+ // Use a raw provider instead of map to not create a dependency on the task
+ this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath))
+ this.classpath.filter { file ->
+ !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
+ }
+ this.classpath(project.java17DependenciesCfg)
+ }
+
+ public void setup(Project project) {
+ super.setup(project)
+ if (project.usesMixins.toBoolean()) {
+ this.extraJvmArgs.addAll(project.provider(() -> {
+ def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
+ mixinCfg.canBeConsumed = false
+ mixinCfg.transitive = false
+ enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
+ }))
+ }
+ }
+}
+
+def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
+runClient17Task.configure {
+ setup(project)
+ group = "Modded Minecraft"
+ description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge"
+ dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
+ mainClass = "GradleStart"
+ username = minecraft.username
+ userUUID = minecraft.userUUID
+}
+
+def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Distribution.DEDICATED_SERVER, "runServer")
+runServer17Task.configure {
+ setup(project)
+ group = "Modded Minecraft"
+ description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge"
+ dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
+ mainClass = "GradleStartServer"
+ extraArgs.add("nogui")
+}
+
def getManifestAttributes() {
def manifestAttributes = [:]
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
@@ -667,11 +937,6 @@ tasks.named("jar", Jar).configure {
}
if (usesShadowedDependencies.toBoolean()) {
- tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
- target = tasks.shadowJar
- prefix = modGroup + ".shadow"
- enabled = minimizeShadowedDependencies.toBoolean()
- }
tasks.named("shadowJar", ShadowJar).configure {
manifest {
attributes(getManifestAttributes())
@@ -686,8 +951,9 @@ if (usesShadowedDependencies.toBoolean()) {
project.configurations.shadeCompile
]
archiveClassifier.set('dev')
- if (minimizeShadowedDependencies.toBoolean()) {
- dependsOn(relocateShadowJar)
+ if (relocateShadowedDependencies.toBoolean()) {
+ relocationPrefix = modGroup + ".shadow"
+ enableRelocation = true
}
}
configurations.runtimeElements.outgoing.artifacts.clear()
@@ -695,8 +961,7 @@ if (usesShadowedDependencies.toBoolean()) {
configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
tasks.named("jar", Jar) {
- enabled = false
- finalizedBy(tasks.shadowJar)
+ archiveClassifier.set('dev-preshadow')
}
tasks.named("reobfJar", ReobfuscatedJar) {
inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
@@ -705,11 +970,6 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip()
}
- for (runTask in ["runClient", "runServer"]) {
- tasks.named(runTask).configure {
- dependsOn("shadowJar")
- }
- }
}
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
ext.publishableObfJar = tasks.reobfJar
@@ -743,16 +1003,47 @@ idea {
module {
downloadJavadoc = true
downloadSources = true
+ inheritOutputDirs = true
}
project {
settings {
+ if (ideaOverrideBuildType != "") {
+ delegateActions {
+ if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) {
+ delegateBuildRunToGradle = true
+ testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE
+ } else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) {
+ delegateBuildRunToGradle = false
+ testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
+ } else {
+ throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.')
+ }
+ }
+ }
runConfigurations {
+ "0. Build and Test"(Gradle) {
+ taskNames = ["build"]
+ }
"1. Run Client"(Gradle) {
taskNames = ["runClient"]
}
"2. Run Server"(Gradle) {
taskNames = ["runServer"]
}
+ "1a. Run Client (Java 17)"(Gradle) {
+ taskNames = ["runClient17"]
+ }
+ "2a. Run Server (Java 17)"(Gradle) {
+ taskNames = ["runServer17"]
+ }
+ "1b. Run Client (Java 17, Hotswap)"(Gradle) {
+ taskNames = ["runClient17"]
+ envs = ["HOTSWAP": "true"]
+ }
+ "2b. Run Server (Java 17, Hotswap)"(Gradle) {
+ taskNames = ["runServer17"]
+ envs = ["HOTSWAP": "true"]
+ }
"3. Run Obfuscated Client"(Gradle) {
taskNames = ["runObfClient"]
}
@@ -770,7 +1061,7 @@ idea {
}
"Run Client (IJ Native)"(Application) {
mainClass = "GradleStart"
- moduleName = project.name + ".main"
+ moduleName = project.name + ".ideVirtualMain"
afterEvaluate {
workingDirectory = tasks.runClient.workingDir.absolutePath
programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -781,7 +1072,7 @@ idea {
}
"Run Server (IJ Native)"(Application) {
mainClass = "GradleStartServer"
- moduleName = project.name + ".main"
+ moduleName = project.name + ".ideVirtualMain"
afterEvaluate {
workingDirectory = tasks.runServer.workingDir.absolutePath
programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -793,11 +1084,57 @@ idea {
}
compiler.javac {
afterEvaluate {
+ javacAdditionalOptions = "-encoding utf8"
moduleJavacAdditionalOptions = [
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
]
}
}
+ withIDEADir { File ideaDir ->
+ if (!ideaDir.path.contains(".idea")) {
+ // If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory
+ ideaDir = new File(ideaDir, ".idea")
+ }
+ if (ideaDir.isDirectory()) {
+ def miscFile = new File(ideaDir, "misc.xml")
+ if (miscFile.isFile()) {
+ boolean dirty = false
+ def miscTransformer = new XmlTransformer()
+ miscTransformer.addAction { root ->
+ Node rootNode = root.asNode()
+ def rootManager = rootNode
+ .component.find { it.@name == 'ProjectRootManager' }
+ if (!rootManager) {
+ rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2'])
+ dirty = true
+ }
+ def output = rootManager.output
+ if (!output) {
+ output = rootManager.appendNode('output')
+ dirty = true
+ }
+ if (!output.@url) {
+ // Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow.
+ // This is a sensible default for most setups
+ output.@url = 'file://$PROJECT_DIR$/build/ideaBuild'
+ dirty = true
+ }
+ }
+ def result = miscTransformer.transform(miscFile.text)
+ if (dirty) {
+ miscFile.write(result)
+ }
+ } else {
+ miscFile.text = """
+
+
+
+
+
+"""
+ }
+ }
+ }
}
}
}
@@ -806,6 +1143,14 @@ tasks.named("processIdeaSettings").configure {
dependsOn("injectTags")
}
+tasks.named("ideVirtualMainClasses").configure {
+ // Make IntelliJ "Build project" build the mod jars
+ dependsOn("jar", "reobfJar")
+ if (!disableSpotless) {
+ dependsOn("spotlessCheck")
+ }
+}
+
// workaround variable hiding in pom processing
def projectConfigs = project.configurations
@@ -824,14 +1169,15 @@ publishing {
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
-
repositories {
- maven {
- url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
- allowInsecureProtocol = true
- credentials {
- username = System.getenv("MAVEN_USER") ?: "NONE"
- password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
+ if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
+ maven {
+ url = mavenPublishUrl
+ allowInsecureProtocol = mavenPublishUrl.startsWith("http://")
+ credentials {
+ username = System.getenv("MAVEN_USER") ?: "NONE"
+ password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
+ }
}
}
}
@@ -867,7 +1213,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
}
}
if (usesMixins.toBoolean()) {
- addModrinthDep("required", "project", "gtnhmixins")
+ addModrinthDep("required", "project", "unimixins")
}
tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth)
@@ -911,7 +1257,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null
}
}
if (usesMixins.toBoolean()) {
- addCurseForgeRelation("requiredDependency", "gtnhmixins")
+ addCurseForgeRelation("requiredDependency", "unimixins")
}
tasks.curseforge.dependsOn(build)
tasks.publish.dependsOn(tasks.curseforge)
@@ -945,10 +1291,21 @@ def addCurseForgeRelation(String type, String name) {
}
// Updating
+
+def buildscriptGradleVersion = "8.5"
+
+tasks.named('wrapper', Wrapper).configure {
+ gradleVersion = buildscriptGradleVersion
+}
+
tasks.register('updateBuildScript') {
group = 'GTNH Buildscript'
description = 'Updates the build script to the latest version'
+ if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) {
+ dependsOn('wrapper')
+ }
+
doLast {
if (performBuildScriptUpdate()) return
@@ -961,6 +1318,26 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
performBuildScriptUpdate()
} else {
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
+ if (gradle.gradleVersion != buildscriptGradleVersion) {
+ out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n")
+ }
+ }
+}
+
+// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
+tasks.register('faq') {
+ group = 'GTNH Buildscript'
+ description = 'Prints frequently asked questions about building a project'
+
+ doLast {
+ print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
+ "Or you can manually check if the versions are still on the distributing sites - " +
+ "the links can be found in repositories.gradle and build.gradle:repositories, " +
+ "but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
+ "If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
+ "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
+ "However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
+ "Java 9 or later.")
}
}
@@ -1021,8 +1398,14 @@ boolean isNewBuildScriptVersionAvailable() {
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
- String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
- String availableBuildScriptHash = getVersionHash(availableBuildScript)
+ String availableBuildScriptHash
+ try {
+ String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
+ availableBuildScriptHash = getVersionHash(availableBuildScript)
+ } catch (IOException e) {
+ logger.warn("Could not check for buildscript update availability: {}", e.message)
+ return false
+ }
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
@@ -1101,7 +1484,7 @@ static int replaceParams(File file, Map params) {
return 0
}
-// Dependency Deobfuscation
+// Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle)
def deobf(String sourceURL) {
try {
@@ -1143,11 +1526,7 @@ def deobfMaven(String repoURL, String mavenDep) {
}
def deobfCurse(String curseDep) {
- try {
- return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep")
- } catch (Exception ignored) {
- out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.")
- }
+ return dependencies.rfg.deobf("curse.maven:$curseDep")
}
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
@@ -1155,34 +1534,7 @@ def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
- String bon2Dir = "$cacheDir/forge_gradle/deobf"
- String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
- String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
-
- if (file(deobfFile).exists()) {
- return files(deobfFile)
- }
-
- String mappingsVer
- String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
- if (remoteMappings) {
- String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
- String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
-
- zipMappings(mappingsZIP, remoteMappings, bon2Dir)
-
- mappingsVer = "snapshot_$id"
- } else {
- mappingsVer = "${channel}_$mappingsVersion"
- }
-
- download.run {
- src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
- dest bon2File
- quiet true
- overwrite false
- }
download.run {
src sourceURL
@@ -1190,50 +1542,8 @@ def deobf(String sourceURL, String rawFileName) {
quiet true
overwrite false
}
-
- exec {
- commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
- workingDir bon2Dir
- standardOutput = new FileOutputStream("${deobfFile}.log")
- }
-
- return files(deobfFile)
+ return dependencies.rfg.deobf(files(obfFile))
}
-
-def zipMappings(String zipPath, String url, String bon2Dir) {
- File zipFile = new File(zipPath)
- if (zipFile.exists()) {
- return
- }
-
- String fieldsCache = "$bon2Dir/data/fields.csv"
- String methodsCache = "$bon2Dir/data/methods.csv"
-
- download.run {
- src "${url}fields.csv"
- dest fieldsCache
- quiet true
- }
- download.run {
- src "${url}methods.csv"
- dest methodsCache
- quiet true
- }
-
- zipFile.getParentFile().mkdirs()
- ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
-
- zos.putNextEntry(new ZipEntry("fields.csv"))
- Files.copy(Paths.get(fieldsCache), zos)
- zos.closeEntry()
-
- zos.putNextEntry(new ZipEntry("methods.csv"))
- Files.copy(Paths.get(methodsCache), zos)
- zos.closeEntry()
-
- zos.close()
-}
-
// Helper methods
def checkPropertyExists(String propertyName) {
@@ -1260,3 +1570,36 @@ def getSecondaryArtifacts() {
if (apiPackage) secondaryArtifacts += [apiJar]
return secondaryArtifacts
}
+
+def getURL(String main, String fallback) {
+ return pingURL(main, 10000) ? main : fallback
+}
+
+// credit: https://stackoverflow.com/a/3584332
+def pingURL(String url, int timeout) {
+ url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates.
+ try {
+ HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection()
+ connection.setConnectTimeout(timeout)
+ connection.setReadTimeout(timeout)
+ connection.setRequestMethod("HEAD")
+ int responseCode = connection.getResponseCode()
+ return 200 <= responseCode && responseCode <= 399
+ } catch (IOException ignored) {
+ return false
+ }
+}
+
+// For easier scripting of things that require variables defined earlier in the buildscript
+if (file('addon.late.gradle.kts').exists()) {
+ apply from: 'addon.late.gradle.kts'
+} else if (file('addon.late.gradle').exists()) {
+ apply from: 'addon.late.gradle'
+}
+
+// File for local tweaks not commited to Git
+if (file('addon.late.local.gradle.kts').exists()) {
+ apply from: 'addon.late.local.gradle.kts'
+} else if (file('addon.late.local.gradle').exists()) {
+ apply from: 'addon.late.local.gradle'
+}
diff --git a/gradle.properties b/gradle.properties
index 6b35313..3330197 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -62,3 +62,6 @@ usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
customArchiveBaseName = RemoteIO
+
+# TODO: Remove when you modify this repository, it's been put in for automatic buildscript updates
+disableCheckstyle = true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index ccebba7..d64cd49 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f398c33..1af9e09 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 79a61d4..1aa94a4 100755
--- a/gradlew
+++ b/gradlew
@@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC3045
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
diff --git a/settings.gradle b/settings.gradle
index 01ea5f1..8a66026 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -4,10 +4,9 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
- url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
- allowInsecureProtocol = true
+ url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
- includeGroup("com.gtnewhorizons.retrofuturagradle")
+ includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
@@ -17,8 +16,8 @@ pluginManagement {
}
plugins {
- id 'com.diffplug.blowdryerSetup' version '1.6.0'
- id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
+ id 'com.diffplug.blowdryerSetup' version '1.7.1'
+ id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
}
blowdryerSetup {