Compare commits

...
3 Commits
Author SHA1 Message Date
Martin Robertz 3492bae96f spotless 2023-04-20 09:42:09 +02:00
Martin Robertz 0732ee46c7 update to newest gt version 2023-04-20 09:35:42 +02:00
Martin Robertz b971a13b14 update buildscript + spottless 2023-04-20 09:32:21 +02:00
6 changed files with 176 additions and 129 deletions

No files matched your search

+170 -120
View File
@@ -1,4 +1,4 @@
//version: 1676031737 //version: 1681680742
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -20,6 +20,7 @@ import cpw.mods.fml.relauncher.Side
import org.gradle.api.tasks.options.Option; import org.gradle.api.tasks.options.Option;
import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.gradle.internal.xml.XmlTransformer
import org.jetbrains.gradle.ext.* import org.jetbrains.gradle.ext.*
import java.nio.file.Files import java.nio.file.Files
@@ -31,7 +32,6 @@ import javax.inject.Inject
buildscript { buildscript {
repositories { repositories {
mavenLocal()
mavenCentral() mavenCentral()
maven { maven {
@@ -52,6 +52,8 @@ buildscript {
name 'Scala CI dependencies' name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/' url 'https://repo1.maven.org/maven2/'
} }
mavenLocal()
} }
} }
plugins { plugins {
@@ -63,22 +65,23 @@ plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
id 'org.jetbrains.kotlin.kapt' 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 '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 '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.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 'com.palantir.git-version' version '3.0.0' apply false
id 'de.undercouch.download' version '5.3.0' id 'de.undercouch.download' version '5.3.0'
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle 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.7.2' apply false
id 'com.modrinth.minotaur' version '2.+' apply false id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.1.6' id 'com.gtnewhorizons.retrofuturagradle' version '1.2.5'
} }
boolean settingsupdated = verifySettingsGradle() boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated) if (settingsupdated)
throw new GradleException("Settings has been updated, please re-run task.") 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' apply plugin: 'com.palantir.git-version'
} }
@@ -127,6 +130,9 @@ propertyDefaultIfUnset("gradleTokenGroupName", "")
propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only
propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only
// 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(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts
if (!disableSpotless) { if (!disableSpotless) {
apply plugin: 'com.diffplug.spotless' apply plugin: 'com.diffplug.spotless'
@@ -148,13 +154,21 @@ java {
} else { } else {
languageVersion.set(projectJavaVersion) languageVersion.set(projectJavaVersion)
} }
vendor.set(JvmVendorSpec.ADOPTIUM) vendor.set(JvmVendorSpec.AZUL)
} }
if (!noPublishedSources) { if (!noPublishedSources) {
withSourcesJar() withSourcesJar()
} }
} }
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
tasks.withType(ScalaCompile).configureEach {
options.encoding = "UTF-8"
}
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
// If Kotlin is enabled in the project // If Kotlin is enabled in the project
kotlin { kotlin {
@@ -188,6 +202,14 @@ configurations {
canBeConsumed = false canBeConsumed = false
canBeResolved = 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()) { if (enableModernJavaSyntax.toBoolean()) {
@@ -217,7 +239,7 @@ if (enableModernJavaSyntax.toBoolean()) {
javaCompiler.set(javaToolchains.compilerFor { javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM) vendor.set(JvmVendorSpec.AZUL)
}) })
} }
} }
@@ -249,12 +271,14 @@ if (apiPackage) {
} }
if (accessTransformersFile) { if (accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile for (atFile in accessTransformersFile.split(",")) {
if (!getFile(targetFile).exists()) { String targetFile = "src/main/resources/META-INF/" + atFile.trim()
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) 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 { } else {
boolean atsFound = false boolean atsFound = false
for (File at : sourceSets.getByName("main").resources.files) { for (File at : sourceSets.getByName("main").resources.files) {
@@ -382,12 +406,14 @@ minecraft {
injectMissingGenerics.set(true) injectMissingGenerics.set(true)
} }
username = developmentEnvironmentUserName.toString()
lwjgl3Version = "3.3.2-SNAPSHOT"
// Enable assertions in the current mod // Enable assertions in the current mod
extraRunJvmArguments.add("-ea:${modGroup}") extraRunJvmArguments.add("-ea:${modGroup}")
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
if (usesMixinDebug.toBoolean()) { if (usesMixinDebug.toBoolean()) {
extraRunJvmArguments.addAll([ extraRunJvmArguments.addAll([
"-Dmixin.debug.countInjections=true", "-Dmixin.debug.countInjections=true",
@@ -455,8 +481,9 @@ repositories.configureEach { repo ->
apply from: 'repositories.gradle' apply from: 'repositories.gradle'
configurations { configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) {
config.extendsFrom(runtimeOnlyNonPublishable)
if (usesShadowedDependencies.toBoolean()) { if (usesShadowedDependencies.toBoolean()) {
config.extendsFrom(shadowImplementation) config.extendsFrom(shadowImplementation)
// TODO: remove Compile after all uses are refactored to Implementation // TODO: remove Compile after all uses are refactored to Implementation
@@ -501,12 +528,11 @@ repositories {
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true allowInsecureProtocol = true
} }
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { maven {
if (usesMixinDebug.toBoolean()) { name 'sonatype'
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'
name = "Fabric Maven" content {
url = "https://maven.fabricmc.net/" includeGroup "org.lwjgl"
}
} }
} }
if (includeWellKnownRepositories.toBoolean()) { if (includeWellKnownRepositories.toBoolean()) {
@@ -540,29 +566,49 @@ repositories {
} }
} }
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.12:processor') annotationProcessor(mixinProviderSpec)
if (usesMixinDebug.toBoolean()) { if (usesMixinDebug.toBoolean()) {
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
} }
} }
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { if (usesMixins.toBoolean()) {
implementation('com.gtnewhorizon:gtnhmixins:2.1.12') implementation(mixinProviderSpec)
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
} }
} }
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
dependencies { dependencies {
kapt('com.gtnewhorizon:gtnhmixins:2.1.12:processor') kapt(mixinProviderSpec)
} }
} }
} }
// 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")
}
}
apply from: 'dependencies.gradle' apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
@@ -667,17 +713,22 @@ ext.java17Toolchain = (JavaToolchainSpec spec) -> {
spec.vendor.set(JvmVendorSpec.matching("jetbrains")) spec.vendor.set(JvmVendorSpec.matching("jetbrains"))
} }
ext.java17DependenciesCfg = configurations.create("java17Dependencies") ext.java17DependenciesCfg = configurations.create("java17Dependencies") {
ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution
canBeConsumed = false
}
ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") {
canBeConsumed = false
}
dependencies { dependencies {
def lwjgl3ifyVersion = '1.1.21' def lwjgl3ifyVersion = '1.3.3'
def asmVersion = '9.4' def asmVersion = '9.4'
if (modId != 'lwjgl3ify') { if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.31') java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.4')
} }
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
@@ -688,14 +739,14 @@ dependencies {
java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}") java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1') java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0") java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
} }
ext.java17JvmArgs = [ ext.java17JvmArgs = [
// Java 9+ support // Java 9+ support
"--illegal-access=warn", "--illegal-access=warn",
"-Dfile.encoding=UTF-8",
"-Djava.security.manager=allow", "-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED", "--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens", "java.base/java.nio=ALL-UNNAMED",
@@ -706,6 +757,7 @@ ext.java17JvmArgs = [
"--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=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-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-modules", "jdk.dynalink", "--add-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
@@ -750,8 +802,8 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } public boolean setEnableHotswap(boolean enable) { enableHotswap = enable }
@Inject @Inject
public RunHotswappableMinecraftTask(Side side, String superTask) { public RunHotswappableMinecraftTask(Side side, String superTask, org.gradle.api.invocation.Gradle gradle) {
super(side) super(side, gradle)
this.lwjglVersion = 3 this.lwjglVersion = 3
this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain)
@@ -768,10 +820,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
!file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
} }
this.classpath(project.java17DependenciesCfg) this.classpath(project.java17DependenciesCfg)
if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) {
this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
}
} }
} }
@@ -782,6 +830,8 @@ runClient17Task.configure {
description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge"
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
mainClass = "GradleStart" mainClass = "GradleStart"
username = minecraft.username
userUUID = minecraft.userUUID
} }
def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer") def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer")
@@ -828,7 +878,7 @@ if (usesShadowedDependencies.toBoolean()) {
tasks.register('relocateShadowJar', ConfigureShadowRelocation) { tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
target = tasks.shadowJar target = tasks.shadowJar
prefix = modGroup + ".shadow" prefix = modGroup + ".shadow"
enabled = minimizeShadowedDependencies.toBoolean() enabled = relocateShadowedDependencies.toBoolean()
} }
tasks.named("shadowJar", ShadowJar).configure { tasks.named("shadowJar", ShadowJar).configure {
manifest { manifest {
@@ -844,7 +894,7 @@ if (usesShadowedDependencies.toBoolean()) {
project.configurations.shadeCompile project.configurations.shadeCompile
] ]
archiveClassifier.set('dev') archiveClassifier.set('dev')
if (minimizeShadowedDependencies.toBoolean()) { if (relocateShadowedDependencies.toBoolean()) {
dependsOn(relocateShadowJar) dependsOn(relocateShadowJar)
} }
} }
@@ -905,6 +955,19 @@ idea {
} }
project { project {
settings { 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 { runConfigurations {
"1. Run Client"(Gradle) { "1. Run Client"(Gradle) {
taskNames = ["runClient"] taskNames = ["runClient"]
@@ -943,7 +1006,7 @@ idea {
} }
"Run Client (IJ Native)"(Application) { "Run Client (IJ Native)"(Application) {
mainClass = "GradleStart" mainClass = "GradleStart"
moduleName = project.name + ".main" moduleName = project.name + ".ideVirtualMain"
afterEvaluate { afterEvaluate {
workingDirectory = tasks.runClient.workingDir.absolutePath workingDirectory = tasks.runClient.workingDir.absolutePath
programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -954,7 +1017,7 @@ idea {
} }
"Run Server (IJ Native)"(Application) { "Run Server (IJ Native)"(Application) {
mainClass = "GradleStartServer" mainClass = "GradleStartServer"
moduleName = project.name + ".main" moduleName = project.name + ".ideVirtualMain"
afterEvaluate { afterEvaluate {
workingDirectory = tasks.runServer.workingDir.absolutePath workingDirectory = tasks.runServer.workingDir.absolutePath
programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -966,11 +1029,57 @@ idea {
} }
compiler.javac { compiler.javac {
afterEvaluate { afterEvaluate {
javacAdditionalOptions = "-encoding utf8"
moduleJavacAdditionalOptions = [ moduleJavacAdditionalOptions = [
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') (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 = """<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2">
<output url="file://\$PROJECT_DIR\$/out" />
</component>
</project>
"""
}
}
}
} }
} }
} }
@@ -1040,7 +1149,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
} }
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
addModrinthDep("required", "project", "gtnhmixins") addModrinthDep("required", "project", "unimixins")
} }
tasks.modrinth.dependsOn(build) tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth) tasks.publish.dependsOn(tasks.modrinth)
@@ -1084,7 +1193,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null
} }
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
addCurseForgeRelation("requiredDependency", "gtnhmixins") addCurseForgeRelation("requiredDependency", "unimixins")
} }
tasks.curseforge.dependsOn(build) tasks.curseforge.dependsOn(build)
tasks.publish.dependsOn(tasks.curseforge) tasks.publish.dependsOn(tasks.curseforge)
@@ -1118,10 +1227,21 @@ def addCurseForgeRelation(String type, String name) {
} }
// Updating // Updating
def buildscriptGradleVersion = "8.0.2"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
}
tasks.register('updateBuildScript') { tasks.register('updateBuildScript') {
group = 'GTNH Buildscript' group = 'GTNH Buildscript'
description = 'Updates the build script to the latest version' description = 'Updates the build script to the latest version'
if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) {
dependsOn('wrapper')
}
doLast { doLast {
if (performBuildScriptUpdate()) return if (performBuildScriptUpdate()) return
@@ -1134,6 +1254,9 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
performBuildScriptUpdate() performBuildScriptUpdate()
} else { } else {
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") 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")
}
} }
} }
@@ -1274,7 +1397,7 @@ static int replaceParams(File file, Map<String, String> params) {
return 0 return 0
} }
// Dependency Deobfuscation // Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle)
def deobf(String sourceURL) { def deobf(String sourceURL) {
try { try {
@@ -1316,11 +1439,7 @@ def deobfMaven(String repoURL, String mavenDep) {
} }
def deobfCurse(String curseDep) { def deobfCurse(String curseDep) {
try { return dependencies.rfg.deobf("curse.maven:$curseDep")
return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep")
} catch (Exception ignored) {
out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.")
}
} }
// The method above is to be preferred. Use this method if the filename is not at the end of the URL. // The method above is to be preferred. Use this method if the filename is not at the end of the URL.
@@ -1328,34 +1447,7 @@ def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1" String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8") String fileName = URLDecoder.decode(rawFileName, "UTF-8")
String cacheDir = "$project.gradle.gradleUserHomeDir/caches" 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 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 { download.run {
src sourceURL src sourceURL
@@ -1363,50 +1455,8 @@ def deobf(String sourceURL, String rawFileName) {
quiet true quiet true
overwrite false overwrite false
} }
return dependencies.rfg.deobf(files(obfFile))
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
workingDir bon2Dir
standardOutput = new FileOutputStream("${deobfFile}.log")
}
return files(deobfFile)
} }
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 // Helper methods
def checkPropertyExists(String propertyName) { def checkPropertyExists(String propertyName) {
+1 -1
View File
@@ -1,7 +1,7 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.195:dev' compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.42.65-pre:dev'
compile 'com.github.GTNewHorizons:Baubles:1.0.1.14:dev' compile 'com.github.GTNewHorizons:Baubles:1.0.1.14:dev'
compile 'net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev' compile 'net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev'
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+2 -2
View File
@@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -13,10 +13,7 @@ import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
import emt.client.gui.EMT_UITextures; import emt.client.gui.EMT_UITextures;
import emt.init.EMTItems; import emt.init.EMTItems;
import gregtech.api.enums.GT_Values; import gregtech.api.enums.*;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe;
@@ -130,7 +127,7 @@ public class EMT_RecipeAdder {
GT_ModHandler.getModItem("DraconicEvolution", "awakenedCore", 4, 0), GT_ModHandler.getModItem("DraconicEvolution", "awakenedCore", 4, 0),
GT_ModHandler.getModItem("DraconicEvolution", "chaosFragment", 2, 2), GT_ModHandler.getModItem("DraconicEvolution", "chaosFragment", 2, 2),
new ItemStack(EMTItems.itemEMTItems, 0, 19) }, new ItemStack(EMTItems.itemEMTItems, 0, 19) },
Materials.SpaceTime.getMolten(1440), MaterialsUEVplus.SpaceTime.getMolten(1440),
GT_ModHandler.getModItem("DraconicEvolution", "chaoticCore", 1, 0), GT_ModHandler.getModItem("DraconicEvolution", "chaoticCore", 1, 0),
GT_Values.NF, GT_Values.NF,
3200, 3200,