From 5fbb40602c408ef3391aaa9601f73a19052495d2 Mon Sep 17 00:00:00 2001 From: ah-OOG-ah <75745146+ah-OOG-ah@users.noreply.github.com> Date: Mon, 9 Jun 2025 02:21:21 -0400 Subject: [PATCH] Remove old buildscripts --- build.gradle.disabled | 150 --------------- buildscript/forge-1.7-mixin.gradle | 54 ------ buildscript/forge-1.7.gradle | 151 --------------- common/build.gradle.disabled | 4 - mixin/build.gradle.disabled | 287 ----------------------------- module-compat/build.gradle | 28 --- 6 files changed, 674 deletions(-) delete mode 100644 build.gradle.disabled delete mode 100644 buildscript/forge-1.7-mixin.gradle delete mode 100644 buildscript/forge-1.7.gradle delete mode 100644 common/build.gradle.disabled delete mode 100644 mixin/build.gradle.disabled delete mode 100644 module-compat/build.gradle diff --git a/build.gradle.disabled b/build.gradle.disabled deleted file mode 100644 index 4a6ef46..0000000 --- a/build.gradle.disabled +++ /dev/null @@ -1,150 +0,0 @@ -/** The root of the build. Exposed for flexibility, but you shouldn't edit it - unless you have to. Edit project.gradle instead. */ - -buildscript { - repositories { - mavenCentral() - maven { - name = "forge" - url = "https://maven.minecraftforge.net/" - } - maven { - url = "https://jitpack.io" - } - } - dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11' - } -} - -plugins { - id 'com.github.johnrengelman.shadow' version '6.1.0' apply false -} - -allprojects { - apply plugin: 'com.github.johnrengelman.shadow' - apply plugin: 'maven-publish' - // For some reason this is needed when using Gradle 6.9 (but not if using 4.4.1) - repositories { - mavenCentral() - mavenLocal() - maven { - name 'Overmind forge repo mirror' - url 'https://gregtech.overminddl1.com/' - } - maven { - name = "forge" - url = "https://maven.minecraftforge.net/" - } - maven { - name = 'sponge' - url = 'https://repo.spongepowered.org/maven/' - } - maven { - url = "https://mvn.falsepattern.com/releases" - } - maven { - name = "GTNH Maven" - url = "https://nexus.gtnewhorizons.com/nexus/content/groups/public/" - allowInsecureProtocol = true - } - maven { - url 'https://jitpack.io' - } - } - - apply from: "${project.rootDir}/buildscript/forge-1.7.gradle" - - def projectVersion = version - - dependencies { - // TODO only include IFMLLoadingPlugin, Mod and ComparableVersion - compileOnly "net.minecraftforge:forge:1.12.2-14.23.5.2860:universal" - } - - // The all module is published without any suffix, and to the normal group - // Other modules are published if publishAll is set, to io.github.legacymoddingmc.unimixins, with a -1.7.10 suffix - boolean publishAll = project.hasProperty("publishAll") - ext.mainModule = project.name == "module-all" - ext.publishModuleToMaven = mainModule || publishAll - ext.mavenGroupId = !mainModule ? project.group : project.group.replace(".unimixins", "") - - if (project.name.startsWith("module-") && project.name != "module-mixin" && project.name != "module-common") { - if (project.name != "module-all") { - tasks.register('sourcesJar', Jar) { - from sourceSets.main.allSource - classifier = 'sources' - } - } - - afterEvaluate { - if (!mainModule) { - tasks.register('devJar', Jar) { - classifier = 'dev' - def jarTask = (jar.enabled ? jar : shadowJar) - from zipTree(jarTask.getOutputs().getFiles().getSingleFile()) - manifest = jarTask.manifest - - dependsOn jarTask - } - } - - reobf.dependsOn devJar - - artifacts { - archives tasks."sourcesJar" - archives tasks."devJar" - } - - if (publishModuleToMaven) { - publishing { - publications { - create("maven", MavenPublication) { - artifact jar.enabled ? jar : shadowJar - artifact source: tasks."sourcesJar", classifier: 'sources' - artifact source: tasks."devJar", classifier: 'dev' - if (mainModule) - artifactId = "unimixins" - else - artifactId = archivesBaseName.substring(1) - version = projectVersion - groupId = mavenGroupId - } - } - } - } - - project.tasks.forEach { - if (it.name.startsWith("publish") && it.name.contains("PublicationTo")) { - it.dependsOn reobf - } - } - } - } - - publishing { - repositories { - if (System.getenv("MAVEN_USER") != null) { - maven { - url = System.getenv("MAVEN_URL") - credentials { - username = System.getenv("MAVEN_USER") ?: "NONE" - password = System.getenv("MAVEN_PASSWORD") ?: "NONE" - } - } - } - } - } - - // Put license, credits and readme in jar - - delete "$projectDir/build/tmp/license" - - copy { - from "$projectDir" - into "$projectDir/build/tmp/license" - include "CREDITS", "LICENSE*", "README*" - } - - sourceSets.main.resources.srcDir("build/tmp/license") -} diff --git a/buildscript/forge-1.7-mixin.gradle b/buildscript/forge-1.7-mixin.gradle deleted file mode 100644 index 9612084..0000000 --- a/buildscript/forge-1.7-mixin.gradle +++ /dev/null @@ -1,54 +0,0 @@ -/** Applying this file in a Forge build will imbue it with the powers of Mixin. */ - -repositories { - maven { - name = 'sponge' - url = 'https://repo.spongepowered.org/maven/' - } -} - -def embedMixin = !project.hasProperty("nomixin"); - -if(!embedMixin){ - project.version += "+nomixin" -} - -dependencies { - if(embedMixin){ - embed('org.spongepowered:mixin:0.7.11-SNAPSHOT'){ - setTransitive false - } - } else { - compile('org.spongepowered:mixin:0.7.11-SNAPSHOT'){ - setTransitive false - } - } -} - -ext.outRefMapFile = "${tasks.compileJava.temporaryDir}/${project.modid}.mixin.refmap.json" - -jar { - manifest { - attributes ( - 'MixinConfigs': "${project.modid}.mixin.json", - 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker', - 'TweakOrder': 0, - - // If these two are not set, Forge will not detect the mod, it will only run the mixins - 'FMLCorePluginContainsFMLMod': 'true', - 'ForceLoadAsMod': 'true', - ) - } - - from outRefMapFile; -} - -def outSrgFile = "${tasks.compileJava.temporaryDir}/outSrg.srg" - -afterEvaluate { - tasks.compileJava.options.compilerArgs += ["-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${outSrgFile}", "-AoutRefMapFile=${outRefMapFile}"]; -} - -reobf { - addExtraSrgFile outSrgFile -} diff --git a/buildscript/forge-1.7.gradle b/buildscript/forge-1.7.gradle deleted file mode 100644 index dcfcffb..0000000 --- a/buildscript/forge-1.7.gradle +++ /dev/null @@ -1,151 +0,0 @@ -/** Common code for Forge 1.7.10 builds */ - -apply plugin: 'forge' - -ext.publishDir = project.multiproject_structure.toBoolean() ? "${projectDir}/../publish" : "${rootDir}/publish" - -def runCommand(cmd) { - def commitHashProc = cmd.execute(null, file("${projectDir}")) - commitHashProc.waitFor() - if(commitHashProc.exitValue() == 0){ - def commitHash = commitHashProc.text.trim() - - return commitHash - } else { - println commitHashProc.err.text - println(cmd + " exited with non-zero return value") - return null - } -} - -def getCommitVersion() { - def ver = null - - def versionPath = publishDir + "/version.txt" - if(file(versionPath).isFile()) { - ver = file(versionPath).text - } else { - - try { - ver = runCommand("git describe --tags --dirty") ?: "UNKNOWN-" + runCommand("git describe --always --dirty") ?: "UNKNOWN" - } catch(Exception e){ - println "Failed to run " + cmd + ": " + e.getMessage() - ver = "UNKNOWN" - } - } - - ver = ver.trim() - if(ver.charAt(0) == 'v') { - ver = ver.substring(1) - } - - return ver -} - -project.version = getCommitVersion() - -group = project.group -archivesBaseName = "${project.archives_base}-${project.minecraft_version}" - -minecraft { - version = "${project.minecraft_version}-${project.forge_version}" - runDir = "run" - replace '@VERSION@', project.version -} - -// These settings allow you to choose what version of Java you want to be compatible with. Forge 1.7.10 runs on Java 6 to 8. -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -repositories { - maven { - name = "chickenbones" - url = "http://chickenbones.net/maven/" - } -} - -configurations { - embed - compile.extendsFrom(embed) - shade - compile.extendsFrom(shade) -} - -if(project.enable_mixin.toBoolean()) { - apply from: "buildscript/forge-1.7-mixin.gradle" -} - -project.ext.override_dependencies = false - -if(file("project.gradle").exists()){ - apply from: "project.gradle" -} - -if(!project.ext.override_dependencies) { - dependencies { - runtimeOnly "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" - runtimeOnly "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev" - } -} - -jar { - from(sourceSets.main.output); - - // embed libraries in jar - from configurations.embed.collect { - exclude '**/LICENSE', '**/LICENSE.txt' - it.isDirectory() ? it : zipTree(it) - } - - configurations.shade.each { dep -> - from(project.zipTree(dep)){ - exclude '**/LICENSE', '**/LICENSE.txt', 'META-INF', 'META-INF/**' - } - } -} - -processResources { - // This will ensure that this task is redone when the versions or any - // user-defined properties change. - inputs.property "version", version - inputs.property "mcversion", project.minecraft.version - inputs.properties project.ext.getProperties() - - filesMatching('*.info') { - expand project.properties - } -} - -// Ensures that the encoding of source files is set to UTF-8, see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" -} - -// Add git commit hash to MANIFEST.MF - -def getCommitHash(){ - try { - def commitHashProc = "git describe --always --dirty".execute() - commitHashProc.waitFor() - if(commitHashProc.exitValue() == 0){ - def commitHash = commitHashProc.text.trim() - - return commitHash - } else { - println commitHashProc.err.text - throw new Exception("git describe exited with non-zero return value") - } - } catch(Exception e){ - println "Failed to get commit version: " + e.getMessage() - } - return "UNKNOWN" // fallback -} - - -jar { - manifest { - attributes ( - 'Commit-ID': getCommitHash(), - ) - } -} diff --git a/common/build.gradle.disabled b/common/build.gradle.disabled deleted file mode 100644 index 2ea2755..0000000 --- a/common/build.gradle.disabled +++ /dev/null @@ -1,4 +0,0 @@ -archivesBaseName = archivesBaseName.replace("-1.7.10", "-common-1.7.10" ) - -// Obfuscation is unnecessary since this module does not reference Minecraft classes -reobf.enabled = false diff --git a/mixin/build.gradle.disabled b/mixin/build.gradle.disabled deleted file mode 100644 index 6321f25..0000000 --- a/mixin/build.gradle.disabled +++ /dev/null @@ -1,287 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -buildscript { - repositories { - gradlePluginPortal() - } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' - } -} - -def versionBase = version -archivesBaseName = archivesBaseName.replace("-1.7.10", "-mixin-1.7.10") - -configurations.archives.artifacts.clear() - -dependencies { - compileOnly("org.spongepowered:mixin:$spongepoweredMixinVersion") - compileOnly(project(":module-common")) { - transitive = false - } -} - -apply plugin: "com.github.johnrengelman.shadow" - -def flavors = (!project.hasProperty("enableAltMixin") ? [] : ["spongepowered", "fabric", "gasmix", "gtnh"]) + ["unimix"] - -flavors.each { - def mixinFlavor = it - def _flavor = it.capitalize() - def mixinFlavorClassifier = "UNKNOWN" - def mixinFlavorCapitalized = [spongepowered: "SpongePowered", fabric: "Fabric", gasmix: "GasMix", gtnh: "GTNH", unimix: "UniMix"][mixinFlavor] - def mixinVersion = "UNKNOWN" - - configurations.create("shadow$_flavor") - configurations.create("shadowBridge$_flavor") - configurations.create("shadowSources$_flavor") - - dependencies { - add("shadow$_flavor", project(":module-common"), { - transitive = false - }) - } - - if (mixinFlavor == "fabric" || mixinFlavor == "spongepowered" || mixinFlavor == "unimix" || mixinFlavor == "gtnh") { - // Fabric / SpongePowered / UniMix / GTNH - - if (mixinFlavor == "fabric" || mixinFlavor == "unimix") { - def uniLocal = mixinFlavor == "unimix" && project.hasProperty("local") - def uniJitpack = mixinFlavor == "unimix" && !uniLocal - - mixinVersion = mixinFlavor == "fabric" ? fabricMixinVersion : unimixMixinVersion - if (uniLocal) { - mixinVersion += "-local" - } - - // jitpack differences: - // - domain is com instead of io (for some strange reason) - // - we have to use _ instead of + in version string because the latter is not supported (for some strange reason) - // - artifact id is UniMix, not sponge-mixin (this one makes sense at least) - - def mixinGroup = mixinFlavor == "fabric" ? "net.fabricmc" : "${uniJitpack ? 'com' : 'io'}.github.legacymoddingmc" - def mixinArtifactId = uniJitpack ? "UniMix" : "sponge-mixin" - def mixinDepVersion = uniJitpack ? mixinVersion.replace('+', '_') : mixinVersion - def mixinDep = "$mixinGroup:$mixinArtifactId:$mixinDepVersion" - - mixinFlavorClassifier = "$mixinFlavor.${mixinVersion.replace('+', '-')}" - - dependencies { - add("shadow$_flavor", "$mixinDep", { - exclude group: "org.ow2.asm" - }) - add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") - - add("shadowBridge$_flavor", "$mixinDep", { - transitive = false - }) - - add("shadowSources$_flavor", "$mixinDep:sources", { - transitive = false - }) - } - } else if(mixinFlavor == "spongepowered") { - mixinVersion = spongepoweredMixinVersion - - mixinFlavorClassifier = "spongepowered.$mixinVersion" - - dependencies { - add("shadow$_flavor", "org.spongepowered:mixin:$mixinVersion") - add("shadowBridge$_flavor", "org.spongepowered:mixin:$mixinVersion", { - transitive = false - }) - add("shadow$_flavor", "com.google.guava:guava:21.0") - add("shadow$_flavor", "com.google.code.gson:gson:2.2.4") - add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") - - add("shadowSources$_flavor", "org.spongepowered:mixin:$mixinVersion:sources") - } - } else if(mixinFlavor == "gtnh") { - // Adapted from GTNHMixins's build script - - mixinVersion = gtnhMixinVersion - mixinFlavorClassifier = "gtnh.$mixinVersion" - - dependencies { - add("shadow$_flavor", "org.spongepowered:mixin:$mixinVersion") - add("shadow$_flavor", "org.ow2.asm:asm-tree:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-commons:$asmVersion") - add("shadow$_flavor", "org.ow2.asm:asm-util:$asmVersion") - add("shadow$_flavor", "com.google.guava:guava:21.0") - add("shadowBridge$_flavor", "org.spongepowered:mixin:$spongepoweredMixinVersion") - add("shadowSources$_flavor", "org.spongepowered:mixin:$spongepoweredMixinVersion:sources") - } - - } - - // We want to *not* relocate ASM in the bridge classes. So we use a multi-step - // build procedure: - - // 1. Create relocated Mixin jar, without the bridge classes - task("mixinJar$_flavor", type: ShadowJar) { - destinationDirectory = file("build/tmp") - classifier = "tmpMixin$_flavor" - configurations = [project.configurations."shadow$_flavor"] - - relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib' - if(mixinFlavor != "gtnh") { - relocate 'com.google', 'org.spongepowered.libraries.com.google' - } else { - // we don't use this ASM package name - //relocate 'org.objectweb.asm', 'org.spongepowered.libraries.org.objectweb.asm' - relocate 'com.google.common', 'org.spongepowered.libraries.com.google.common' - relocate 'com.google.thirdparty.publicsuffix', 'org.spongepowered.libraries.com.google.thirdparty.publicsuffix' - } - - exclude 'org/spongepowered/asm/bridge/RemapperAdapter.class' - exclude 'org/spongepowered/asm/bridge/RemapperAdapterFML.class' - - // Exclude stuff that's compiled for Java 16 - - exclude 'org/spongepowered/asm/service/modlauncher/*' - exclude 'org/spongepowered/asm/launch/MixinTransformationServiceLegacy*' - exclude 'org/spongepowered/asm/launch/MixinLaunchPlugin*' - exclude 'org/spongepowered/asm/launch/MixinTransformationService*' - exclude 'org/spongepowered/asm/launch/platform/container/ContainerHandleModLauncherEx*' - - exclude 'META-INF/services/cpw.mods.modlauncher.api.ITransformationService' - exclude 'META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService' - - exclude '**/module-info.class' - - // Exclude jar-specific stuff - - exclude 'META-INF/MANIFEST.MF', 'META-INF/maven/**', 'META-INF/*.RSA', 'META-INF/*.SF' - } - - // 2. Create Mixin jar without relocation, with *only* the bridge classes - task("bridgeJar$_flavor", type: ShadowJar) { - destinationDirectory = file("build/tmp") - classifier = "tmpBridge$_flavor" - configurations = [project.configurations."shadowBridge$_flavor"] - - include '*.jar' - include 'org/spongepowered/asm/bridge/*' - } - - // 3. Combine the two jars - task("shadowJar$_flavor", type: ShadowJar) { - version = versionBase + "+" + mixinFlavorClassifier - from(sourceSets.main.output) { - exclude "mcmod.info" - } - - relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.mixin.repackage.common' - - dependsOn "mixinJar$_flavor" - dependsOn "bridgeJar$_flavor" - dependsOn "mixinJar$_flavor" - dependsOn "bridgeJar$_flavor" - - from zipTree(tasks."mixinJar$_flavor".archiveFile).matching { - exclude 'module-info.class' - eachFile { - if(it.path.startsWith("META-INF/services/")) { - it.filter({l -> !l.startsWith("org.spongepowered.asm.service.modlauncher.") ? l : null}) - } - } - } - from zipTree(tasks."bridgeJar$_flavor".archiveFile).matching { include 'org/spongepowered/asm/bridge/*' } - - doLast { - delete tasks."mixinJar$_flavor".archiveFile - delete tasks."bridgeJar$_flavor".archiveFile - } - } - - jar.dependsOn("shadowJar$_flavor") - } else if (mixinFlavor == "gasmix") { - // GasMix - - mixinVersion = gasmixMixinVersion - - mixinFlavorClassifier = "gasmix.$mixinVersion" - - dependencies { - add("shadow$_flavor", "org.spongepowered:mixin:$mixinVersion") - add("shadowSources$_flavor", "org.spongepowered:mixin:$mixinVersion:sources") - } - - task("shadowJar$_flavor", type: ShadowJar) { - from(sourceSets.main.output) { - exclude "mcmod.info" - } - - version = versionBase + "+" + mixinFlavorClassifier - classifier = '' - configurations = [project.configurations."shadow$_flavor"] - - relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.mixin.repackage.common' - } - - jar.dependsOn("shadowJar$_flavor") - } - - // Common - - task("createMcmodInfo$_flavor", type: Copy) { - outputs.upToDateWhen { false } - from 'src/main/resources/mcmod.info' - into "build/tmp/mcmod.${mixinFlavor}.info" - filter { - line -> line.replaceAll('@MIXIN_CLASSIFIER@', mixinFlavorClassifier).replaceAll('@MIXIN_SOURCE_CAPITALIZED@', mixinFlavorCapitalized).replaceAll('@VERSION@', "$versionBase+$mixinFlavorClassifier").replaceAll('@PROJECT_URL@', project.project_url) - } - } - - tasks."shadowJar$_flavor" { - dependsOn("createMcmodInfo$_flavor") - from "build/tmp/mcmod.${mixinFlavor}.info/mcmod.info" - - manifest { - attributes( - 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker', - 'FMLCorePluginContainsFMLMod': 'true', - 'ForceLoadAsMod': 'true', - 'FMLCorePlugin': 'io.github.legacymoddingmc.unimixins.mixin.MixinCore', - 'Premain-Class': 'org.spongepowered.tools.agent.MixinAgent', - 'Agent-Class': 'org.spongepowered.tools.agent.MixinAgent', - 'Can-Redefine-Classes': true, - 'Can-Retransform-Classes': true, - 'Implementation-Version': mixinVersion - ) - } - } - - task("shadowSourcesJar$_flavor", type: ShadowJar) { - from sourceSets.main.allSource - - version = versionBase + "+" + mixinFlavorClassifier - classifier = "sources" - configurations = [project.configurations."shadowSources$_flavor"] - } - - jar.dependsOn("shadowSourcesJar$_flavor") - - if (publishModuleToMaven){ - publishing { - publications { - create("maven$_flavor", MavenPublication) { - artifact tasks."shadowJar$_flavor" - artifact tasks."shadowSourcesJar$_flavor" - - artifactId = archivesBaseName.substring(1) + (mixinFlavor == "unimix" ? "" : "-" + mixinFlavor) - groupId = mavenGroupId - } - } - } - } -} - -// Obfuscation is unnecessary since this module does not reference Minecraft classes -reobf.enabled = false - -jar.enabled = false diff --git a/module-compat/build.gradle b/module-compat/build.gradle deleted file mode 100644 index eae2953..0000000 --- a/module-compat/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -dependencies { - compileOnly('org.spongepowered:mixin:0.8.5') - shadow(project(":module-common")) { - transitive = false - } -} - -archivesBaseName = archivesBaseName.replace("-1.7.10", "-compat-1.7.10") - -apply plugin: "com.github.johnrengelman.shadow" - -shadowJar { - configurations = [project.configurations.shadow] - classifier = '' - relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.compat.repackage.common' - - manifest { - attributes ( - 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker', - 'FMLCorePluginContainsFMLMod': true, - 'ForceLoadAsMod': true, - 'FMLCorePlugin': 'io.github.legacymoddingmc.unimixins.compat.CompatCore' - ) - } -} - -jar.dependsOn shadowJar -jar.enabled = false