mirror of
https://github.com/LegacyModdingMC/UniMixins.git
synced 2026-10-26 14:34:00 +00:00
Delete build.gradle.disabled
This commit is contained in:
1 parent
763020eec6
commit
7a1496c88f
1 file changed
-196
@@ -1,196 +0,0 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
archivesBaseName = archivesBaseName.replace("-1.7.10", "-all-1.7.10")
|
||||
|
||||
// The order of these determines the order embedded core plugins get initialized in
|
||||
ext.moduleNames = ["module-mixin", "module-compat", "module-mixingasm", "module-spongemixins", "module-mixinbooterlegacy", "module-gasstation", "module-gtnhmixins", "module-mixinextras"]
|
||||
|
||||
def getJarTaskName(name, classifier) {
|
||||
if(name == "module-mixin") {
|
||||
return ":module-mixin:shadow${classifier == 'sources' ? 'Sources' : ''}JarUnimix"
|
||||
} else {
|
||||
def candidate = ":" + name + ":" + (classifier + "Jar").uncapitalize()
|
||||
if(classifier == 'dev' && (tasks.findByPath(candidate) == null)) {
|
||||
return getJarTaskName(name, '')
|
||||
} else {
|
||||
return candidate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getModuleJar(name, classifier = '') {
|
||||
return tasks.getByPath(getJarTaskName(name, classifier)).getOutputs().getFiles().getSingleFile()
|
||||
}
|
||||
|
||||
def getModuleJars(classifier = '') {
|
||||
return moduleNames.collect { getModuleJar(it, classifier) }
|
||||
}
|
||||
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
def getManifest(file) {
|
||||
def man = null
|
||||
zipTree(file).matching { include 'META-INF/MANIFEST.MF' }.getSingleFile().withInputStream {
|
||||
man = new Manifest(it).mainAttributes
|
||||
}
|
||||
return man
|
||||
}
|
||||
|
||||
task createMergedMcmodInfo() {
|
||||
outputs.file("build/tmp/mcmod.info")
|
||||
outputs.upToDateWhen { false }
|
||||
doLast {
|
||||
def mergedJson = []
|
||||
getModuleJars().each {
|
||||
def json = new groovy.json.JsonSlurper().parseText(zipTree(it).matching { include 'mcmod.info' }.getSingleFile().text)
|
||||
json[0]["parent"] = "unimixins"
|
||||
mergedJson += json
|
||||
}
|
||||
|
||||
def desc = mergedJson.collect{ it.name.split(": ")[1]}.join("; ")
|
||||
mergedJson = [
|
||||
[
|
||||
modid: "unimixins",
|
||||
name: "UniMixins",
|
||||
description: "UniMixins composite jar consisting of the following modules:\n" + desc,
|
||||
version: version,
|
||||
mcversion: "1.7.10",
|
||||
url: project_url,
|
||||
authorList: ["makamys"],
|
||||
]
|
||||
] + mergedJson
|
||||
|
||||
file("build/tmp/mcmod.info").text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(mergedJson))
|
||||
return file("build/tmp/mcmod.info")
|
||||
}
|
||||
|
||||
moduleNames.each { dependsOn tasks.getByPath(":$it:build") }
|
||||
}
|
||||
|
||||
task createEmbeddedCorePluginsFile() {
|
||||
def path = "build/tmp/unimixins-all.EmbeddedFMLCorePlugins.txt"
|
||||
outputs.file(path)
|
||||
outputs.upToDateWhen { false }
|
||||
doLast {
|
||||
file(path).text = getModuleJars().findResults { getManifest(it).getValue("FMLCorePlugin") }.join(' ')
|
||||
return file(path)
|
||||
}
|
||||
|
||||
moduleNames.each { dependsOn tasks.getByPath(":$it:build") }
|
||||
}
|
||||
|
||||
task createMergedAnnotationProcessorConfig() {
|
||||
def path = "build/tmp/javax.annotation.processing.Processor"
|
||||
outputs.file(path)
|
||||
outputs.upToDateWhen { false }
|
||||
doLast {
|
||||
// MixinExtras's APs have to be registered before Mixin's,
|
||||
// so we manually merge the APs to ensure this is the case.
|
||||
file(path).text = """com.llamalad7.mixinextras.ap.MixinExtrasAP
|
||||
io.github.tox1cozz.mixinextras.MixinExtrasAnnotationProcessor
|
||||
org.spongepowered.tools.obfuscation.MixinObfuscationProcessorInjection
|
||||
org.spongepowered.tools.obfuscation.MixinObfuscationProcessorTargets
|
||||
"""
|
||||
|
||||
return file(path)
|
||||
}
|
||||
}
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
shadowJar {
|
||||
classifier = ''
|
||||
}
|
||||
|
||||
task devJar(type: ShadowJar) {
|
||||
classifier = 'dev'
|
||||
}
|
||||
|
||||
tasks.withType(ShadowJar) {
|
||||
if(name == "shadowJar" || name == "devJar") {
|
||||
dependsOn tasks.createMergedMcmodInfo
|
||||
dependsOn tasks.createEmbeddedCorePluginsFile
|
||||
dependsOn tasks.createMergedAnnotationProcessorConfig
|
||||
|
||||
from sourceSets.main.output
|
||||
configurations = [project.configurations.shadow]
|
||||
relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.all.repackage.common'
|
||||
|
||||
(["module-common"] + moduleNames).each {
|
||||
def name = it
|
||||
def j = getModuleJar(it, classifier)
|
||||
into ""
|
||||
from(zipTree(j)){
|
||||
exclude 'mcmod.info'
|
||||
exclude 'META-INF/MANIFEST.MF'
|
||||
exclude 'CREDITS', 'LICENSE*', 'README*'
|
||||
exclude 'META-INF/services/javax.annotation.processing.Processor'
|
||||
into("")
|
||||
}
|
||||
from(zipTree(j)){
|
||||
include 'CREDITS', 'LICENSE*', 'README*'
|
||||
into("META-INF/licenses/$name")
|
||||
}
|
||||
}
|
||||
|
||||
from tasks.createMergedMcmodInfo.getOutputs().getFiles().getSingleFile()
|
||||
from(tasks.createEmbeddedCorePluginsFile.getOutputs().getFiles().getSingleFile()) {
|
||||
into 'META-INF'
|
||||
}
|
||||
from(tasks.createMergedAnnotationProcessorConfig.getOutputs().getFiles().getSingleFile()) {
|
||||
into 'META-INF/services'
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes (
|
||||
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
|
||||
'FMLCorePluginContainsFMLMod': true,
|
||||
'ForceLoadAsMod': true,
|
||||
'FMLCorePlugin': 'io.github.legacymoddingmc.unimixins.all.AllCore',
|
||||
'MixinConfigs': 'mixins.gtnhmixins.json,mixins.gasstation.json,mixins.gtnhmixins.json,mixingasm.mixin.json',
|
||||
'Premain-Class': 'org.spongepowered.tools.agent.MixinAgent',
|
||||
'Agent-Class': 'org.spongepowered.tools.agent.MixinAgent',
|
||||
'Can-Redefine-Classes': true,
|
||||
'Can-Retransform-Classes': true,
|
||||
)
|
||||
}
|
||||
|
||||
doFirst {
|
||||
manifest.attributes (
|
||||
'Implementation-Version': getManifest(getModuleJar("module-mixin")).getValue("Implementation-Version")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
enabled = false
|
||||
dependsOn shadowJar, devJar
|
||||
}
|
||||
|
||||
task sourcesJar(type: ShadowJar) {
|
||||
dependsOn devJar
|
||||
|
||||
classifier = 'sources'
|
||||
|
||||
moduleNames.each {
|
||||
def j = getModuleJar(it, 'sources')
|
||||
from(zipTree(j)){
|
||||
exclude 'mcmod.info'
|
||||
exclude 'META-INF/MANIFEST.MF'
|
||||
exclude 'CREDITS', 'LICENSE*', 'README*'
|
||||
exclude 'META-INF/services/javax.annotation.processing.Processor'
|
||||
}
|
||||
}
|
||||
|
||||
from(zipTree(tasks.devJar.getOutputs().getFiles().getSingleFile())) {
|
||||
include "CREDITS"
|
||||
include "META-INF/licenses/**"
|
||||
}
|
||||
}
|
||||
|
||||
clean {
|
||||
moduleNames.each { dependsOn tasks.getByPath(":$it:clean") }
|
||||
}
|
||||
|
||||
reobf.enabled = false
|
||||
Reference in new issue
Block a user