mirror of https://github.com/FabricMC/yarn.git
Generate a mergedv2 jar, update engima + some other tweaks. Closes #1071
This commit is contained in:
parent
d24dec94fb
commit
355a622b46
|
@ -6,7 +6,7 @@ jdk:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- chmod +x gradlew
|
- chmod +x gradlew
|
||||||
- ./gradlew build mapNamedJar --stacktrace
|
- ./gradlew build mapNamedJar checkMappings --stacktrace
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
108
build.gradle
108
build.gradle
|
@ -7,12 +7,12 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "cuchaz:enigma:0.14.3.148"
|
classpath "cuchaz:enigma:0.15.150"
|
||||||
classpath "net.fabricmc:stitch:0.4.3.71"
|
classpath "net.fabricmc:stitch:0.4.3.71"
|
||||||
classpath "commons-io:commons-io:2.6"
|
classpath "commons-io:commons-io:2.6"
|
||||||
classpath "com.google.guava:guava:28.0-jre"
|
classpath "com.google.guava:guava:28.0-jre"
|
||||||
classpath 'de.undercouch:gradle-download-task:4.0.2'
|
classpath 'de.undercouch:gradle-download-task:4.0.2'
|
||||||
classpath 'net.fabricmc:tiny-remapper:+'
|
classpath 'net.fabricmc:tiny-remapper:0.2.1.63'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ configurations {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
enigmaRuntime "net.fabricmc:stitch:0.4.3.71"
|
enigmaRuntime "net.fabricmc:stitch:0.4.3.71"
|
||||||
enigmaRuntime "cuchaz:enigma:0.14.3.148"
|
enigmaRuntime "cuchaz:enigma:0.15.150"
|
||||||
}
|
}
|
||||||
|
|
||||||
def setupGroup = "jar setup"
|
def setupGroup = "jar setup"
|
||||||
|
@ -83,6 +83,8 @@ import net.fabricmc.stitch.commands.CommandProposeFieldNames
|
||||||
import net.fabricmc.stitch.commands.CommandReorderTiny
|
import net.fabricmc.stitch.commands.CommandReorderTiny
|
||||||
import net.fabricmc.stitch.commands.CommandRewriteIntermediary
|
import net.fabricmc.stitch.commands.CommandRewriteIntermediary
|
||||||
import net.fabricmc.stitch.commands.tinyv2.CommandProposeV2FieldNames
|
import net.fabricmc.stitch.commands.tinyv2.CommandProposeV2FieldNames
|
||||||
|
import net.fabricmc.stitch.commands.tinyv2.CommandMergeTinyV2
|
||||||
|
import net.fabricmc.stitch.commands.tinyv2.CommandReorderTinyV2
|
||||||
import net.fabricmc.stitch.merge.JarMerger
|
import net.fabricmc.stitch.merge.JarMerger
|
||||||
import net.fabricmc.tinyremapper.OutputConsumerPath
|
import net.fabricmc.tinyremapper.OutputConsumerPath
|
||||||
import net.fabricmc.tinyremapper.TinyRemapper
|
import net.fabricmc.tinyremapper.TinyRemapper
|
||||||
|
@ -172,14 +174,16 @@ task downloadMcJars(dependsOn: downloadWantedVersionManifest) {
|
||||||
|
|
||||||
logger.lifecycle(":downloading minecraft jars")
|
logger.lifecycle(":downloading minecraft jars")
|
||||||
|
|
||||||
if (!clientJar.exists() || !validateChecksum(clientJar, version.downloads.client.sha1)) {
|
download {
|
||||||
logger.lifecycle(":downloading minecraft client")
|
src new URL(version.downloads.client.url)
|
||||||
FileUtils.copyURLToFile(new URL(version.downloads.client.url), clientJar)
|
dest clientJar
|
||||||
|
overwrite false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!serverJar.exists() || !validateChecksum(serverJar, version.downloads.server.sha1)) {
|
download {
|
||||||
logger.lifecycle(":downloading minecraft server")
|
src new URL(version.downloads.server.url)
|
||||||
FileUtils.copyURLToFile(new URL(version.downloads.server.url), serverJar)
|
dest serverJar
|
||||||
|
overwrite false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,6 +195,22 @@ task downloadIntermediary(type: Download) {
|
||||||
dest new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny")
|
dest new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task downloadIntermediaryV2(type: Download) {
|
||||||
|
group = buildMappingGroup
|
||||||
|
def url = "https://maven.fabricmc.net/net/fabricmc/intermediary/${minecraft_version}/intermediary-${minecraft_version}-v2.jar"
|
||||||
|
src com.google.common.net.UrlEscapers.urlFragmentEscaper().escape(url)
|
||||||
|
dest new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-v2.jar")
|
||||||
|
}
|
||||||
|
|
||||||
|
task extractIntermediaryV2(dependsOn: downloadIntermediaryV2, type: Copy) {
|
||||||
|
def output = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-v2.tiny")
|
||||||
|
from({ zipTree(downloadIntermediaryV2.dest) }) {
|
||||||
|
include 'mappings/mappings.tiny'
|
||||||
|
rename 'mappings.tiny', "../${output.name}"
|
||||||
|
}
|
||||||
|
into output.parentFile
|
||||||
|
}
|
||||||
|
|
||||||
task mergeJars(dependsOn: downloadMcJars) {
|
task mergeJars(dependsOn: downloadMcJars) {
|
||||||
group = setupGroup
|
group = setupGroup
|
||||||
inputs.files downloadMcJars.outputs.files.files
|
inputs.files downloadMcJars.outputs.files.files
|
||||||
|
@ -268,9 +288,31 @@ task invertIntermediary(dependsOn: downloadIntermediary, type: FileOutput) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task invertIntermediaryv2(dependsOn: extractIntermediaryV2, type: FileOutput) {
|
||||||
|
group = buildMappingGroup
|
||||||
|
def v2Input = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-v2.tiny")
|
||||||
|
|
||||||
|
output = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-inverted-v2.tiny")
|
||||||
|
outputs.file(output)
|
||||||
|
|
||||||
|
outputs.upToDateWhen { false }
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
logger.lifecycle(":building inverted intermediary v2")
|
||||||
|
|
||||||
|
String[] v2Args = [
|
||||||
|
v2Input.getAbsolutePath(),
|
||||||
|
output.getAbsolutePath(),
|
||||||
|
"intermediary", "official"
|
||||||
|
]
|
||||||
|
|
||||||
|
new CommandReorderTinyV2().run(v2Args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task patchIntermediary(dependsOn: [mergeJars, downloadIntermediary]) {
|
task patchIntermediary(dependsOn: [mergeJars, downloadIntermediary]) {
|
||||||
group = buildMappingGroup
|
group = buildMappingGroup
|
||||||
def intermediaryTinyInput = downloadIntermediary.dest
|
def intermediaryTinyInput = downloadIntermediary.outputs.files.singleFile
|
||||||
|
|
||||||
def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-full.tiny")
|
def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-full.tiny")
|
||||||
outputs.file(outputFile)
|
outputs.file(outputFile)
|
||||||
|
@ -454,7 +496,7 @@ clean.doFirst {
|
||||||
delete tempDir, cacheFilesMinecraft
|
delete tempDir, cacheFilesMinecraft
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.build.dependsOn "compressTiny","tinyJar","v2UnmergedYarnJar"
|
tasks.build.dependsOn "compressTiny","tinyJar","v2UnmergedYarnJar", "v2MergedYarnJar"
|
||||||
|
|
||||||
task mapYarnJar(dependsOn: [compressTiny, mapIntermediaryJar]) {
|
task mapYarnJar(dependsOn: [compressTiny, mapIntermediaryJar]) {
|
||||||
group = mapJarGroup
|
group = mapJarGroup
|
||||||
|
@ -566,6 +608,36 @@ task insertAutoGeneratedEnumMappings(dependsOn : [buildYarnTiny,mapIntermediaryJ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task mergeV2(dependsOn: ["v2UnmergedYarnJar", "invertIntermediaryv2"], type: FileOutput) {
|
||||||
|
def mergedV2 = new File(tempDir, "merged-v2.tiny");
|
||||||
|
|
||||||
|
output = new File(tempDir, "merged-reordered-v2.tiny")
|
||||||
|
outputs.upToDateWhen { false }
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
logger.lifecycle(":merging yarn and intermediary v2")
|
||||||
|
String[] args = [
|
||||||
|
invertIntermediaryv2.output.getAbsolutePath(),
|
||||||
|
insertAutoGeneratedEnumMappings.output.getAbsolutePath(),
|
||||||
|
mergedV2.getAbsolutePath(),
|
||||||
|
"intermediary",
|
||||||
|
"official"
|
||||||
|
]
|
||||||
|
|
||||||
|
new CommandMergeTinyV2().run(args)
|
||||||
|
|
||||||
|
//Reorder the mappings to match the output of loom
|
||||||
|
args = [
|
||||||
|
mergedV2.getAbsolutePath(),
|
||||||
|
output.getAbsolutePath(),
|
||||||
|
"official",
|
||||||
|
"intermediary",
|
||||||
|
"named"
|
||||||
|
]
|
||||||
|
new CommandReorderTinyV2().run(args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task v2UnmergedYarnJar(dependsOn: insertAutoGeneratedEnumMappings, type: Jar) {
|
task v2UnmergedYarnJar(dependsOn: insertAutoGeneratedEnumMappings, type: Jar) {
|
||||||
def mappings = insertAutoGeneratedEnumMappings.output
|
def mappings = insertAutoGeneratedEnumMappings.output
|
||||||
group = "mapping build"
|
group = "mapping build"
|
||||||
|
@ -578,6 +650,17 @@ task v2UnmergedYarnJar(dependsOn: insertAutoGeneratedEnumMappings, type: Jar) {
|
||||||
destinationDirectory.set(file("build/libs"))
|
destinationDirectory.set(file("build/libs"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task v2MergedYarnJar(dependsOn: ["mergeV2"], type: Jar) {
|
||||||
|
def mappings = mergeV2.output
|
||||||
|
group = "mapping build"
|
||||||
|
outputs.upToDateWhen { false }
|
||||||
|
archiveFileName = "yarn-${yarnVersion}-mergedv2.jar"
|
||||||
|
|
||||||
|
from(file(mappings)) {
|
||||||
|
rename mappings.name, "mappings/mappings.tiny"
|
||||||
|
}
|
||||||
|
destinationDirectory.set(file("build/libs"))
|
||||||
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
|
@ -594,6 +677,9 @@ publishing {
|
||||||
artifact(v2UnmergedYarnJar) {
|
artifact(v2UnmergedYarnJar) {
|
||||||
classifier "v2"
|
classifier "v2"
|
||||||
}
|
}
|
||||||
|
artifact(v2MergedYarnJar) {
|
||||||
|
classifier "mergedv2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue