2016-08-17 15:23:28 -04:00
|
|
|
buildscript {
|
2016-10-02 11:58:41 -04:00
|
|
|
repositories {
|
2016-10-19 04:58:14 -04:00
|
|
|
maven {
|
2019-06-28 17:55:20 -04:00
|
|
|
name "Fabric Repository"
|
|
|
|
url 'https://maven.fabricmc.net'
|
2016-10-19 04:58:14 -04:00
|
|
|
}
|
2021-03-16 13:51:18 -04:00
|
|
|
mavenCentral()
|
2021-07-03 20:30:37 -04:00
|
|
|
mavenLocal()
|
2016-10-02 11:58:41 -04:00
|
|
|
}
|
|
|
|
dependencies {
|
2020-06-03 14:47:17 -04:00
|
|
|
classpath "cuchaz:enigma-cli:${project.enigma_version}"
|
|
|
|
classpath "net.fabricmc:stitch:${project.stitch_version}"
|
2022-04-15 18:17:53 -04:00
|
|
|
classpath "de.undercouch:gradle-download-task:4.1.1"
|
2021-03-26 15:04:22 -04:00
|
|
|
classpath "net.fabricmc.unpick:unpick:${project.unpick_version}"
|
|
|
|
classpath "net.fabricmc.unpick:unpick-format-utils:${project.unpick_version}"
|
2021-09-28 11:17:36 -04:00
|
|
|
classpath "net.fabricmc:name-proposal:${project.name_proposal_version}"
|
2016-10-02 11:58:41 -04:00
|
|
|
}
|
2016-08-17 15:23:28 -04:00
|
|
|
}
|
|
|
|
|
2018-12-08 07:32:48 -05:00
|
|
|
plugins {
|
2021-07-10 07:28:14 -04:00
|
|
|
id 'java' // for constants, packages, javadoc
|
2022-04-15 18:17:53 -04:00
|
|
|
id 'de.undercouch.download' version '4.1.2'
|
2018-12-08 07:32:48 -05:00
|
|
|
id 'maven-publish'
|
2022-04-15 18:17:53 -04:00
|
|
|
id "com.diffplug.spotless" version "6.4.2"
|
2022-09-19 13:18:02 -04:00
|
|
|
id 'net.fabricmc.filament'
|
2018-12-08 07:32:48 -05:00
|
|
|
}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2022-12-07 11:01:33 -05:00
|
|
|
def minecraft_version = "1.19.3"
|
2016-09-09 08:47:32 -04:00
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
filament {
|
|
|
|
minecraftVersion = minecraft_version
|
|
|
|
}
|
|
|
|
|
2016-09-09 08:47:32 -04:00
|
|
|
def ENV = System.getenv()
|
2020-11-06 18:33:17 -05:00
|
|
|
// Fetch build number from Github Actions
|
2018-11-15 11:57:32 -05:00
|
|
|
def build_number = ENV.BUILD_NUMBER ?: "local"
|
|
|
|
|
2019-04-10 12:20:44 -04:00
|
|
|
def yarnVersion = "${minecraft_version}+build.$build_number"
|
2021-03-24 16:04:48 -04:00
|
|
|
version = yarnVersion
|
2016-09-09 08:47:32 -04:00
|
|
|
|
2021-04-28 18:13:10 -04:00
|
|
|
if (ENV.BRANCH_NAME) {
|
2021-04-28 18:16:02 -04:00
|
|
|
def branch = ENV.BRANCH_NAME.substring(ENV.BRANCH_NAME.lastIndexOf('/') + 1)
|
2021-04-28 14:42:32 -04:00
|
|
|
if (minecraft_version != branch) {
|
|
|
|
throw new IllegalStateException("Branch name (${branch}) does not match the mc version (${minecraft_version})")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-08 07:32:48 -05:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven {
|
2019-06-28 17:55:20 -04:00
|
|
|
name "Fabric Repository"
|
|
|
|
url 'https://maven.fabricmc.net'
|
2018-12-08 07:32:48 -05:00
|
|
|
}
|
2020-10-31 15:02:53 -04:00
|
|
|
maven {
|
|
|
|
name "Mojang"
|
|
|
|
url 'https://libraries.minecraft.net/'
|
|
|
|
}
|
2021-03-24 16:04:48 -04:00
|
|
|
mavenLocal()
|
2018-12-08 07:32:48 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
2022-04-20 13:41:28 -04:00
|
|
|
asm
|
|
|
|
enigmaRuntime {
|
|
|
|
extendsFrom asm
|
|
|
|
}
|
2020-04-07 16:13:29 -04:00
|
|
|
javadocClasspath
|
2020-10-31 15:02:53 -04:00
|
|
|
decompileClasspath
|
2021-01-21 13:44:55 -05:00
|
|
|
mappingPoetJar {
|
|
|
|
transitive = false
|
|
|
|
}
|
|
|
|
mappingPoet {
|
|
|
|
extendsFrom mappingPoetJar
|
2022-04-20 14:45:02 -04:00
|
|
|
extendsFrom asm
|
2021-01-21 13:44:55 -05:00
|
|
|
transitive = true
|
|
|
|
}
|
2022-04-20 13:41:28 -04:00
|
|
|
unpick {
|
|
|
|
extendsFrom asm
|
|
|
|
}
|
2018-12-08 07:32:48 -05:00
|
|
|
}
|
|
|
|
|
2021-03-24 16:04:48 -04:00
|
|
|
def unpickMetaFile = file("unpick-definitions/unpick.json")
|
|
|
|
|
2018-12-08 07:32:48 -05:00
|
|
|
dependencies {
|
2021-10-13 14:29:39 -04:00
|
|
|
enigmaRuntime "cuchaz:enigma-swing:${project.enigma_version}"
|
2021-09-28 11:17:36 -04:00
|
|
|
enigmaRuntime "net.fabricmc:name-proposal:${project.name_proposal_version}"
|
2021-01-26 08:10:08 -05:00
|
|
|
javadocClasspath "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
|
2021-02-23 10:40:14 -05:00
|
|
|
javadocClasspath "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
|
2021-04-01 03:49:22 -04:00
|
|
|
javadocClasspath "com.google.code.findbugs:jsr305:3.0.2" // for some other jsr annotations
|
2021-04-24 05:07:59 -04:00
|
|
|
decompileClasspath "net.fabricmc:cfr:${project.cfr_version}"
|
2021-06-07 09:44:50 -04:00
|
|
|
mappingPoetJar "net.fabricmc:mappingpoet:${project.mappingpoet_version}"
|
2021-03-26 15:04:22 -04:00
|
|
|
unpick "net.fabricmc.unpick:unpick-cli:${project.unpick_version}"
|
2022-04-20 13:41:28 -04:00
|
|
|
asm "org.ow2.asm:asm:${project.asm_version}"
|
|
|
|
asm "org.ow2.asm:asm-tree:${project.asm_version}"
|
|
|
|
asm "org.ow2.asm:asm-commons:${project.asm_version}"
|
|
|
|
asm "org.ow2.asm:asm-util:${project.asm_version}"
|
2018-12-08 07:32:48 -05:00
|
|
|
}
|
|
|
|
|
2019-05-12 21:45:52 -04:00
|
|
|
def setupGroup = "jar setup"
|
|
|
|
def yarnGroup = "yarn"
|
|
|
|
def buildMappingGroup = "mapping build"
|
|
|
|
def mapJarGroup = "jar mapping"
|
2018-10-27 10:16:43 -04:00
|
|
|
def mappingsDir = file("mappings")
|
|
|
|
def cacheFilesMinecraft = file(".gradle/minecraft")
|
2018-10-31 09:05:19 -04:00
|
|
|
def tempDir = file(".gradle/temp")
|
2019-01-09 15:28:08 -05:00
|
|
|
def intermediaryJar = file("${minecraft_version}-intermediary.jar")
|
2021-03-24 16:04:48 -04:00
|
|
|
def unpickedJar = file("${minecraft_version}-intermediary-unpicked.jar")
|
2019-01-09 15:28:08 -05:00
|
|
|
def namedJar = file("${minecraft_version}-named.jar")
|
2022-05-27 07:06:56 -04:00
|
|
|
def serverIntermediaryJar = file("${minecraft_version}-server-intermediary.jar")
|
2018-10-30 07:29:43 -04:00
|
|
|
def libs = new File("build/libs/")
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
def minecraftLibraries = tasks.minecraftLibraries.files
|
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
import com.google.common.hash.Hashing
|
2019-06-28 16:12:16 -04:00
|
|
|
import cuchaz.enigma.command.CheckMappingsCommand
|
2019-06-28 17:55:20 -04:00
|
|
|
import cuchaz.enigma.command.ComposeMappingsCommand
|
2019-06-28 16:12:16 -04:00
|
|
|
import cuchaz.enigma.command.ConvertMappingsCommand
|
2019-11-24 05:53:08 -05:00
|
|
|
import cuchaz.enigma.command.MapSpecializedMethodsCommand
|
2022-09-20 17:37:53 -04:00
|
|
|
import net.fabricmc.filament.task.MapJarTask
|
2018-10-31 12:54:00 -04:00
|
|
|
import net.fabricmc.stitch.commands.CommandMergeTiny
|
2019-06-28 18:17:32 -04:00
|
|
|
import net.fabricmc.stitch.commands.CommandReorderTiny
|
2019-04-18 17:22:36 -04:00
|
|
|
import net.fabricmc.stitch.commands.CommandRewriteIntermediary
|
2020-03-09 15:28:16 -04:00
|
|
|
import net.fabricmc.stitch.commands.tinyv2.CommandMergeTinyV2
|
|
|
|
import net.fabricmc.stitch.commands.tinyv2.CommandReorderTinyV2
|
2021-09-28 11:17:36 -04:00
|
|
|
import net.fabricmc.nameproposal.MappingNameCompleter
|
2019-05-12 21:45:52 -04:00
|
|
|
|
2018-11-15 11:57:32 -05:00
|
|
|
import java.util.zip.GZIPOutputStream
|
2016-08-17 15:23:28 -04:00
|
|
|
|
|
|
|
boolean validateChecksum(File file, String checksum) {
|
|
|
|
if (file != null) {
|
2019-11-07 06:38:33 -05:00
|
|
|
def hash = com.google.common.io.Files.asByteSource(file).hash(Hashing.sha1())
|
2016-08-17 15:23:28 -04:00
|
|
|
def builder = new StringBuilder()
|
|
|
|
hash.asBytes().each {
|
|
|
|
builder.append(Integer.toString((it & 0xFF) + 0x100, 16).substring(1))
|
|
|
|
}
|
|
|
|
return builder.toString().equals(checksum)
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-11-07 13:12:34 -05:00
|
|
|
task downloadIntermediary(type: Download) {
|
2019-06-28 17:55:20 -04:00
|
|
|
group = buildMappingGroup
|
2019-11-07 13:12:34 -05:00
|
|
|
def url = "https://github.com/FabricMC/intermediary/raw/master/mappings/${minecraft_version}.tiny"
|
2019-11-07 13:15:42 -05:00
|
|
|
src com.google.common.net.UrlEscapers.urlFragmentEscaper().escape(url)
|
2019-11-07 13:12:34 -05:00
|
|
|
dest new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny")
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
|
2020-03-09 15:28:16 -04:00
|
|
|
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")
|
|
|
|
|
|
|
|
def output = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-v2.tiny")
|
2021-07-10 07:28:14 -04:00
|
|
|
outputs.file output
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
from({ zipTree(downloadIntermediaryV2.dest) }) {
|
|
|
|
from 'mappings/mappings.tiny'
|
|
|
|
rename 'mappings.tiny', "../${output.name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
into output.parentFile
|
|
|
|
}
|
2020-03-09 15:28:16 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-07 13:12:34 -05:00
|
|
|
task invertIntermediary(dependsOn: downloadIntermediary, type: FileOutput) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2019-11-07 13:12:34 -05:00
|
|
|
def v1Input = downloadIntermediary.dest
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
output = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-inverted.tiny")
|
|
|
|
outputs.file(output)
|
2019-06-28 17:55:20 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
outputs.upToDateWhen { false }
|
2016-10-19 04:58:14 -04:00
|
|
|
|
2019-06-28 17:55:20 -04:00
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":building inverted intermediary")
|
2019-11-07 06:38:33 -05:00
|
|
|
|
|
|
|
String[] v1Args = [
|
|
|
|
v1Input.getAbsolutePath(),
|
|
|
|
output.getAbsolutePath(),
|
|
|
|
"intermediary", "official"
|
2018-10-27 10:16:43 -04:00
|
|
|
]
|
2016-10-19 04:58:14 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
new CommandReorderTiny().run(v1Args)
|
2018-10-27 10:16:43 -04:00
|
|
|
}
|
2016-10-19 04:58:14 -04:00
|
|
|
}
|
|
|
|
|
2021-07-10 07:28:14 -04:00
|
|
|
task invertIntermediaryv2(dependsOn: downloadIntermediaryV2, type: FileOutput) {
|
2020-03-09 15:28:16 -04:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
task patchIntermediary(dependsOn: [mergeMinecraftJars, downloadIntermediary]) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2020-03-09 15:28:16 -04:00
|
|
|
def intermediaryTinyInput = downloadIntermediary.outputs.files.singleFile
|
2019-04-18 17:22:36 -04:00
|
|
|
|
|
|
|
def outputFile = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary-full.tiny")
|
|
|
|
outputs.file(outputFile)
|
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
outputs.upToDateWhen { false }
|
2019-04-18 17:22:36 -04:00
|
|
|
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":patching intermediary")
|
|
|
|
String[] args = [
|
2022-10-23 14:29:44 -04:00
|
|
|
mergeMinecraftJars.output.getAbsolutePath(),
|
2019-11-07 06:38:33 -05:00
|
|
|
intermediaryTinyInput.getAbsolutePath(),
|
|
|
|
outputFile.getAbsolutePath(),
|
|
|
|
"--writeAll"
|
2019-04-18 17:22:36 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
new CommandRewriteIntermediary().run(args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
task mapIntermediaryJar(type: MapJarTask, dependsOn: [downloadIntermediary, mergeMinecraftJars]) {
|
2019-06-28 17:55:20 -04:00
|
|
|
group = mapJarGroup
|
2022-09-20 17:37:53 -04:00
|
|
|
output = intermediaryJar
|
2022-10-23 14:29:44 -04:00
|
|
|
input = mergeMinecraftJars.outputFile
|
2022-09-20 17:37:53 -04:00
|
|
|
mappings = downloadIntermediary.dest
|
2022-10-23 14:29:44 -04:00
|
|
|
classpath.from minecraftLibraries
|
2022-09-20 17:37:53 -04:00
|
|
|
from = 'official'
|
|
|
|
to = 'intermediary'
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
task mapServerIntermediaryJar(type: MapJarTask, dependsOn: [downloadIntermediary, extractBundledServer]) {
|
2022-05-27 07:06:56 -04:00
|
|
|
group = mapJarGroup
|
2022-09-20 17:37:53 -04:00
|
|
|
output = serverIntermediaryJar
|
2022-10-23 14:29:44 -04:00
|
|
|
input = extractBundledServer.outputFile
|
2022-09-20 17:37:53 -04:00
|
|
|
mappings = downloadIntermediary.dest
|
2022-10-23 14:29:44 -04:00
|
|
|
classpath.from minecraftLibraries
|
2022-09-20 17:37:53 -04:00
|
|
|
from = 'official'
|
|
|
|
to = 'intermediary'
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
|
2022-05-27 07:06:56 -04:00
|
|
|
task yarnUnpicked(dependsOn: "unpickIntermediaryJar", type: EnigmaTask) {
|
2019-06-28 17:55:20 -04:00
|
|
|
group = yarnGroup
|
2022-05-27 07:06:56 -04:00
|
|
|
jar = unpickedJar
|
|
|
|
mappings = mappingsDir
|
|
|
|
}
|
2021-09-16 16:03:56 -04:00
|
|
|
|
2022-05-27 07:06:56 -04:00
|
|
|
task yarn(dependsOn: mapIntermediaryJar, type: EnigmaTask) {
|
|
|
|
group = yarnGroup
|
|
|
|
jar = intermediaryJar
|
|
|
|
mappings = mappingsDir
|
|
|
|
}
|
2021-09-16 16:03:56 -04:00
|
|
|
|
2022-05-27 07:06:56 -04:00
|
|
|
task yarnCommon(dependsOn: mapServerIntermediaryJar, type: EnigmaTask) {
|
|
|
|
group = yarnGroup
|
|
|
|
jar = serverIntermediaryJar
|
|
|
|
mappings = mappingsDir
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
|
2021-03-30 17:39:16 -04:00
|
|
|
task checkMappings(dependsOn: mapIntermediaryJar) {
|
2019-06-28 17:55:20 -04:00
|
|
|
group = buildMappingGroup
|
|
|
|
inputs.dir mappingsDir
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":checking mappings")
|
|
|
|
|
|
|
|
String[] args = [
|
2021-02-13 17:57:02 -05:00
|
|
|
intermediaryJar.getAbsolutePath(),
|
2019-11-07 06:38:33 -05:00
|
|
|
mappingsDir.getAbsolutePath()
|
2019-06-28 17:55:20 -04:00
|
|
|
]
|
|
|
|
|
2021-02-13 17:57:02 -05:00
|
|
|
try {
|
|
|
|
new CheckMappingsCommand().run(args)
|
|
|
|
} catch (IllegalStateException ignored) {
|
|
|
|
// just print, don't fail the task
|
|
|
|
}
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-24 05:53:08 -05:00
|
|
|
task buildYarnTiny(dependsOn: mapIntermediaryJar, type: WithV2FileOutput) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2018-10-27 10:16:43 -04:00
|
|
|
inputs.dir mappingsDir
|
|
|
|
if (!libs.exists()) {
|
|
|
|
libs.mkdirs()
|
|
|
|
}
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
v1Output = new File(tempDir, "yarn-mappings.tiny")
|
|
|
|
v2Output = new File(tempDir, "yarn-mappings-v2.tiny")
|
|
|
|
|
|
|
|
outputs.upToDateWhen { false }
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":generating tiny mappings")
|
|
|
|
|
2019-11-24 05:53:08 -05:00
|
|
|
new MapSpecializedMethodsCommand().run(
|
|
|
|
intermediaryJar.getAbsolutePath(),
|
|
|
|
"enigma",
|
|
|
|
mappingsDir.getAbsolutePath(),
|
|
|
|
"tinyv2:intermediary:named",
|
|
|
|
v2Output.getAbsolutePath()
|
|
|
|
)
|
|
|
|
|
|
|
|
new ConvertMappingsCommand().run(
|
|
|
|
"tinyv2",
|
|
|
|
v2Output.getAbsolutePath(),
|
|
|
|
"tiny:intermediary:named",
|
|
|
|
v1Output.getAbsolutePath())
|
2018-10-31 09:05:19 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-28 17:55:20 -04:00
|
|
|
task mergeTiny(dependsOn: ["buildYarnTiny", "invertIntermediary"], type: FileOutput) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2019-11-07 06:38:33 -05:00
|
|
|
def yarnTinyInput = buildYarnTiny.v1Output
|
|
|
|
def intermediaryTinyInput = invertIntermediary.output
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-06-28 18:17:32 -04:00
|
|
|
def unorderedResultMappings = new File(tempDir, "mappings-unordered.tiny")
|
2019-11-07 06:38:33 -05:00
|
|
|
output = new File(tempDir, "mappings.tiny")
|
|
|
|
outputs.file(output)
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
outputs.upToDateWhen { false }
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2018-10-31 09:05:19 -04:00
|
|
|
doLast {
|
2018-12-09 16:14:34 -05:00
|
|
|
logger.lifecycle(":merging yarn and intermediary")
|
2018-10-31 09:05:19 -04:00
|
|
|
String[] args = [
|
2019-11-07 06:38:33 -05:00
|
|
|
intermediaryTinyInput.getAbsolutePath(),
|
|
|
|
yarnTinyInput.getAbsolutePath(),
|
|
|
|
unorderedResultMappings.getAbsolutePath(),
|
|
|
|
"intermediary",
|
|
|
|
"official"
|
2018-10-31 09:05:19 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
new CommandMergeTiny().run(args)
|
2019-06-28 18:17:32 -04:00
|
|
|
|
|
|
|
logger.lifecycle(":reordering merged intermediary")
|
|
|
|
String[] args2 = [
|
2019-11-07 06:38:33 -05:00
|
|
|
unorderedResultMappings.getAbsolutePath(),
|
|
|
|
output.getAbsolutePath(),
|
|
|
|
"official", "intermediary", "named"
|
2019-06-28 18:17:32 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
new CommandReorderTiny().run(args2)
|
2018-10-31 09:05:19 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
task tinyJar(type: Jar, dependsOn: mergeTiny) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2019-11-07 06:38:33 -05:00
|
|
|
outputs.upToDateWhen { false }
|
2019-12-11 06:52:21 -05:00
|
|
|
archiveFileName = "yarn-${yarnVersion}.jar"
|
|
|
|
destinationDirectory.set(file("build/libs"))
|
2018-11-02 12:02:21 -04:00
|
|
|
classifier = ""
|
2019-11-07 06:38:33 -05:00
|
|
|
from(mergeTiny.output) {
|
2018-11-02 11:07:46 -04:00
|
|
|
rename { "mappings/mappings.tiny" }
|
|
|
|
}
|
2022-01-02 13:54:44 -05:00
|
|
|
manifest {
|
|
|
|
attributes("Minecraft-Version-Id": minecraft_version)
|
|
|
|
}
|
2018-11-02 11:07:46 -04:00
|
|
|
}
|
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
task compressTiny(dependsOn: [tinyJar, mergeTiny], type: FileOutput) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2018-12-09 16:14:34 -05:00
|
|
|
def outputFile = new File(libs, "yarn-tiny-${yarnVersion}.gz")
|
2018-10-31 09:05:19 -04:00
|
|
|
outputs.file(outputFile)
|
2019-11-07 06:38:33 -05:00
|
|
|
output = outputFile
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
def inputFile = mergeTiny.output
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
outputs.upToDateWhen { false }
|
2018-10-31 09:05:19 -04:00
|
|
|
|
|
|
|
doLast {
|
2018-10-27 10:16:43 -04:00
|
|
|
logger.lifecycle(":compressing tiny mappings")
|
|
|
|
|
|
|
|
def buffer = new byte[1024]
|
|
|
|
def fileOutputStream = new FileOutputStream(outputFile)
|
|
|
|
def outputStream = new GZIPOutputStream(fileOutputStream)
|
|
|
|
def fileInputStream = new FileInputStream(inputFile)
|
|
|
|
|
|
|
|
def length
|
|
|
|
while ((length = fileInputStream.read(buffer)) > 0) {
|
|
|
|
outputStream.write(buffer, 0, length)
|
|
|
|
}
|
|
|
|
|
|
|
|
fileInputStream.close()
|
|
|
|
outputStream.finish()
|
|
|
|
outputStream.close()
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 08:52:54 -04:00
|
|
|
|
2018-11-02 12:17:55 -04:00
|
|
|
clean.doFirst {
|
|
|
|
delete tempDir, cacheFilesMinecraft
|
|
|
|
}
|
|
|
|
|
2022-04-20 14:45:02 -04:00
|
|
|
tasks.build.dependsOn "compressTiny","tinyJar","v2UnmergedYarnJar", "v2MergedYarnJar", "javadocJar"
|
2016-10-02 11:58:41 -04:00
|
|
|
|
2019-11-07 13:12:34 -05:00
|
|
|
task exportMappingsOfficial(dependsOn: downloadIntermediary) {
|
|
|
|
def composeInput = downloadIntermediary.dest
|
2018-10-27 10:37:37 -04:00
|
|
|
|
2018-10-27 10:16:43 -04:00
|
|
|
doLast {
|
2019-06-28 17:55:20 -04:00
|
|
|
logger.lifecycle(":exporting mappings")
|
|
|
|
String[] args = [
|
2019-11-07 06:38:33 -05:00
|
|
|
"tiny",
|
|
|
|
composeInput.getAbsolutePath(),
|
|
|
|
"enigma",
|
|
|
|
file("mappings/").getAbsolutePath(),
|
|
|
|
"enigma",
|
|
|
|
file("mappings_official/").getAbsolutePath(),
|
|
|
|
"right"
|
2019-06-28 17:55:20 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
new ComposeMappingsCommand().run(args)
|
2019-01-09 15:28:08 -05:00
|
|
|
}
|
|
|
|
}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
task importMappingsOfficial(dependsOn: invertIntermediary) {
|
|
|
|
def composeInput = invertIntermediary.output
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-01-09 15:28:08 -05:00
|
|
|
doLast {
|
2019-06-28 17:55:20 -04:00
|
|
|
logger.lifecycle(":importing mappings")
|
|
|
|
String[] args = [
|
2019-11-07 06:38:33 -05:00
|
|
|
"tiny",
|
|
|
|
composeInput.getAbsolutePath(),
|
|
|
|
"enigma",
|
|
|
|
file("mappings_official/").getAbsolutePath(),
|
|
|
|
"enigma",
|
|
|
|
file("mappings/").getAbsolutePath(),
|
|
|
|
"right"
|
2019-06-28 17:55:20 -04:00
|
|
|
]
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2019-06-28 17:55:20 -04:00
|
|
|
new ComposeMappingsCommand().run(args)
|
2018-10-27 10:16:43 -04:00
|
|
|
}
|
2018-10-31 12:53:07 -04:00
|
|
|
}
|
2018-10-30 07:29:43 -04:00
|
|
|
|
2021-05-14 11:26:02 -04:00
|
|
|
combineUnpickDefinitions {
|
|
|
|
group = 'unpick'
|
|
|
|
input = file('unpick-definitions')
|
|
|
|
output = new File(tempDir, 'definitions.unpick')
|
2021-03-24 16:04:48 -04:00
|
|
|
}
|
|
|
|
|
2021-05-14 11:26:02 -04:00
|
|
|
remapUnpickDefinitionsIntermediary {
|
|
|
|
dependsOn buildYarnTiny
|
|
|
|
group = 'unpick'
|
|
|
|
output = new File(tempDir, 'intermediary-definitions.unpick')
|
|
|
|
mappings = buildYarnTiny.v2Output
|
2021-03-24 16:04:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task unpickIntermediaryJar(type: JavaExec, dependsOn: [mapIntermediaryJar, "constantsJar", remapUnpickDefinitionsIntermediary]) {
|
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
group "unpick"
|
|
|
|
|
2021-07-10 07:28:14 -04:00
|
|
|
mainClass = "daomephsta.unpick.cli.Main"
|
2021-03-25 08:45:12 -04:00
|
|
|
systemProperty "java.util.logging.config.file", file('unpick-logging.properties')
|
2021-03-24 16:04:48 -04:00
|
|
|
classpath configurations.unpick
|
|
|
|
|
|
|
|
doFirst {
|
2021-05-14 11:26:02 -04:00
|
|
|
args intermediaryJar.absolutePath, unpickedJar.absolutePath, remapUnpickDefinitionsIntermediary.output.get().asFile.absolutePath, constantsJar.archiveFile.get().asFile.absolutePath
|
2021-03-24 16:04:48 -04:00
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
minecraftLibraries.files.forEach {
|
2021-03-24 16:04:48 -04:00
|
|
|
args it.absolutePath
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup the build for the unpicked constants
|
|
|
|
|
2021-11-16 13:18:51 -05:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
targetCompatibility = JavaVersion.VERSION_17
|
2021-03-24 16:04:48 -04:00
|
|
|
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
|
|
it.options.encoding = "UTF-8"
|
2021-11-16 13:18:51 -05:00
|
|
|
it.options.release = 17
|
2021-03-24 16:04:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
constants
|
2021-03-30 17:39:16 -04:00
|
|
|
packageDocs // package info files
|
2021-03-24 16:04:48 -04:00
|
|
|
}
|
|
|
|
|
2022-04-15 18:17:53 -04:00
|
|
|
spotless {
|
|
|
|
java {
|
|
|
|
licenseHeaderFile(rootProject.file("HEADER"))
|
|
|
|
}
|
2021-03-28 15:33:12 -04:00
|
|
|
}
|
|
|
|
|
2021-03-24 16:04:48 -04:00
|
|
|
task constantsJar(type: Jar) {
|
|
|
|
from sourceSets.constants.output
|
|
|
|
archiveClassifier = "constants"
|
|
|
|
}
|
|
|
|
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
|
|
archiveClassifier = "sources"
|
|
|
|
from sourceSets.constants.allSource
|
|
|
|
}
|
|
|
|
|
2021-03-30 17:39:16 -04:00
|
|
|
// Only build jars for package infos if we need to actually expose stuff like annotation in the future.
|
|
|
|
|
2021-03-24 16:04:48 -04:00
|
|
|
build.dependsOn constantsJar
|
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
task insertAutoGeneratedEnumMappings(dependsOn : [buildYarnTiny,mapIntermediaryJar], type : FileOutput){
|
|
|
|
group = buildMappingGroup
|
2021-09-28 11:17:36 -04:00
|
|
|
File noEnumV2 = buildYarnTiny.v2Output
|
2019-11-07 06:38:33 -05:00
|
|
|
output = new File(tempDir, "unmerged-named-v2-with-enum.tiny")
|
|
|
|
|
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle(":seeking auto-mappable fields for unmerged mappings")
|
|
|
|
|
2021-09-28 11:17:36 -04:00
|
|
|
MappingNameCompleter.completeNames(
|
|
|
|
intermediaryJar.toPath(),
|
|
|
|
noEnumV2.toPath(),
|
|
|
|
downloadIntermediary.dest.toPath(),
|
|
|
|
output.toPath()
|
|
|
|
)
|
2019-11-07 06:38:33 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-09 15:28:16 -04:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-24 16:04:48 -04:00
|
|
|
task v2UnmergedYarnJar(dependsOn: [insertAutoGeneratedEnumMappings, combineUnpickDefinitions], type: Jar) {
|
2019-11-07 06:38:33 -05:00
|
|
|
def mappings = insertAutoGeneratedEnumMappings.output
|
|
|
|
group = "mapping build"
|
|
|
|
outputs.upToDateWhen { false }
|
2019-12-11 06:52:21 -05:00
|
|
|
archiveFileName = "yarn-${yarnVersion}-v2.jar"
|
2019-11-07 06:38:33 -05:00
|
|
|
|
|
|
|
from(file(mappings)) {
|
|
|
|
rename mappings.name, "mappings/mappings.tiny"
|
2019-05-12 21:45:52 -04:00
|
|
|
}
|
2021-03-24 16:04:48 -04:00
|
|
|
from(combineUnpickDefinitions.output) {
|
2021-05-14 11:26:02 -04:00
|
|
|
rename combineUnpickDefinitions.output.get().asFile.name, "extras/definitions.unpick"
|
2021-03-24 16:04:48 -04:00
|
|
|
}
|
|
|
|
from (file(unpickMetaFile)) {
|
2021-03-26 15:04:22 -04:00
|
|
|
expand version: project.unpick_version
|
2021-03-24 16:04:48 -04:00
|
|
|
rename unpickMetaFile.name, "extras/unpick.json"
|
|
|
|
}
|
2019-12-11 06:52:21 -05:00
|
|
|
destinationDirectory.set(file("build/libs"))
|
2022-01-02 13:54:44 -05:00
|
|
|
manifest {
|
|
|
|
attributes("Minecraft-Version-Id": minecraft_version)
|
|
|
|
}
|
2019-05-12 21:45:52 -04:00
|
|
|
}
|
|
|
|
|
2020-03-09 15:28:16 -04:00
|
|
|
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"
|
|
|
|
}
|
2021-03-24 16:04:48 -04:00
|
|
|
from(combineUnpickDefinitions.output) {
|
2021-05-14 11:26:02 -04:00
|
|
|
rename combineUnpickDefinitions.output.get().asFile.name, "extras/definitions.unpick"
|
2021-03-24 16:04:48 -04:00
|
|
|
}
|
|
|
|
from (file(unpickMetaFile)) {
|
2021-03-26 15:04:22 -04:00
|
|
|
expand version: project.unpick_version
|
2021-03-24 16:04:48 -04:00
|
|
|
rename unpickMetaFile.name, "extras/unpick.json"
|
|
|
|
}
|
2020-03-09 15:28:16 -04:00
|
|
|
destinationDirectory.set(file("build/libs"))
|
2022-01-02 13:54:44 -05:00
|
|
|
manifest {
|
|
|
|
attributes("Minecraft-Version-Id": minecraft_version)
|
|
|
|
}
|
2020-03-09 15:28:16 -04:00
|
|
|
}
|
2019-05-12 21:45:52 -04:00
|
|
|
|
2022-09-20 17:37:53 -04:00
|
|
|
task mapNamedJar(type: MapJarTask, dependsOn: ["mergeV2", "unpickIntermediaryJar"]) {
|
|
|
|
group = mapJarGroup
|
|
|
|
output = namedJar
|
|
|
|
input = unpickedJar
|
|
|
|
mappings = mergeV2.output
|
2022-10-23 14:29:44 -04:00
|
|
|
classpath.from minecraftLibraries
|
2022-09-20 17:37:53 -04:00
|
|
|
from = 'intermediary'
|
|
|
|
to = 'named'
|
|
|
|
classMappings = [
|
|
|
|
"javax/annotation/Nullable": "org/jetbrains/annotations/Nullable",
|
|
|
|
"javax/annotation/Nonnull": "org/jetbrains/annotations/NotNull",
|
|
|
|
"javax/annotation/concurrent/Immutable": "org/jetbrains/annotations/Unmodifiable"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2022-10-23 14:29:44 -04:00
|
|
|
def mcLibsDir = file('build/tmp/mclibs')
|
|
|
|
|
|
|
|
// Task to copy all the mc libs into a single directory.
|
|
|
|
task syncDependencies(type: Sync) {
|
|
|
|
from minecraftLibraries
|
|
|
|
into mcLibsDir
|
|
|
|
}
|
|
|
|
|
2020-04-07 16:13:29 -04:00
|
|
|
def fakeSourceDir = file(".gradle/temp/fakeSource")
|
2022-10-23 14:29:44 -04:00
|
|
|
task genFakeSource(type: JavaExec, dependsOn: ["mergeV2", "mapNamedJar", syncDependencies]) {
|
2020-04-07 16:13:29 -04:00
|
|
|
group = "javadoc generation"
|
|
|
|
outputs.upToDateWhen { false }
|
|
|
|
|
2021-07-10 07:28:14 -04:00
|
|
|
mainClass = "net.fabricmc.mappingpoet.Main"
|
2021-01-21 13:44:55 -05:00
|
|
|
classpath configurations.mappingPoet
|
|
|
|
// use merged v2 so we have all namespaces in jd
|
2022-10-23 14:29:44 -04:00
|
|
|
args mergeV2.output.getAbsolutePath(), namedJar.getAbsolutePath(), fakeSourceDir.getAbsolutePath(), mcLibsDir.getAbsolutePath()
|
2020-04-07 16:13:29 -04:00
|
|
|
|
2021-01-21 13:44:55 -05:00
|
|
|
doLast {
|
2020-04-07 16:13:29 -04:00
|
|
|
logger.lifecycle ":Fake source generated"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-24 16:04:48 -04:00
|
|
|
task decompileCFR(type: JavaExec, dependsOn: [mapNamedJar]) {
|
2021-07-10 07:28:14 -04:00
|
|
|
mainClass = "org.benf.cfr.reader.Main"
|
2020-10-31 15:02:53 -04:00
|
|
|
|
|
|
|
args namedJar.getAbsolutePath(), "--outputdir", file("namedSrc").absolutePath
|
|
|
|
|
|
|
|
doFirst {
|
|
|
|
file("namedSrc").deleteDir()
|
2022-10-23 14:29:44 -04:00
|
|
|
classpath.from configurations.decompileClasspath
|
|
|
|
classpath.from minecraftLibraries
|
2020-10-31 15:02:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-18 09:55:18 -04:00
|
|
|
javadoc {
|
2020-04-07 16:13:29 -04:00
|
|
|
dependsOn genFakeSource
|
|
|
|
group = "javadoc generation"
|
|
|
|
outputs.upToDateWhen { false }
|
2021-01-21 13:44:55 -05:00
|
|
|
|
|
|
|
def mappingPoetJar = project.provider { zipTree configurations.mappingPoetJar.singleFile }
|
|
|
|
|
|
|
|
failOnError = false
|
2021-07-10 07:28:14 -04:00
|
|
|
maxMemory = '2G'
|
2021-01-21 13:44:55 -05:00
|
|
|
|
|
|
|
// verbose = true // enable to debug
|
2020-04-07 16:13:29 -04:00
|
|
|
options {
|
2021-01-21 13:44:55 -05:00
|
|
|
// verbose() // enable to debug
|
2021-11-16 13:18:51 -05:00
|
|
|
source = "17"
|
2020-04-07 16:13:29 -04:00
|
|
|
encoding = 'UTF-8'
|
|
|
|
charSet = 'UTF-8'
|
|
|
|
memberLevel = JavadocMemberLevel.PRIVATE
|
2021-01-21 13:44:55 -05:00
|
|
|
splitIndex true
|
|
|
|
tags(
|
|
|
|
'apiNote:a:API Note:',
|
|
|
|
'implSpec:a:Implementation Requirements:',
|
|
|
|
'implNote:a:Implementation Note:'
|
|
|
|
)
|
|
|
|
taglets "net.fabricmc.mappingpoet.jd.MappingTaglet"
|
|
|
|
// taglet path, header, extra stylesheet settings deferred
|
2021-04-02 08:03:52 -04:00
|
|
|
it.use()
|
2021-01-21 13:44:55 -05:00
|
|
|
|
|
|
|
addBooleanOption "-allow-script-in-comments", true
|
2022-02-16 11:19:57 -05:00
|
|
|
addBooleanOption "-ignore-source-errors", true
|
2020-04-07 16:13:29 -04:00
|
|
|
links(
|
2022-10-28 04:28:42 -04:00
|
|
|
'https://guava.dev/releases/31.1-jre/api/docs/',
|
2022-11-17 03:40:02 -05:00
|
|
|
'https://www.javadoc.io/doc/com.google.code.gson/gson/2.10/',
|
2020-04-07 16:13:29 -04:00
|
|
|
'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/',
|
2022-09-16 12:07:24 -04:00
|
|
|
'https://www.slf4j.org/apidocs/',
|
2021-02-23 10:40:14 -05:00
|
|
|
"https://javadoc.io/doc/org.jetbrains/annotations/${project.jetbrains_annotations_version}/",
|
2020-04-07 16:13:29 -04:00
|
|
|
'https://javadoc.lwjgl.org/',
|
2021-03-12 15:18:08 -05:00
|
|
|
'https://fastutil.di.unimi.it/docs/',
|
2022-10-28 04:28:42 -04:00
|
|
|
'https://javadoc.scijava.org/JOML/',
|
2021-01-26 08:10:08 -05:00
|
|
|
'https://netty.io/4.1/api/',
|
2022-09-16 12:07:24 -04:00
|
|
|
'https://www.oshi.ooo/oshi-core-java11/apidocs/',
|
2022-10-28 04:28:42 -04:00
|
|
|
'https://java-native-access.github.io/jna/5.12.1/javadoc/',
|
2022-09-16 12:07:24 -04:00
|
|
|
'https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/',
|
|
|
|
'https://jopt-simple.github.io/jopt-simple/apidocs/',
|
|
|
|
'https://solutions.weblite.ca/java-objective-c-bridge/docs/',
|
|
|
|
'https://commons.apache.org/proper/commons-logging/apidocs/',
|
|
|
|
'https://commons.apache.org/proper/commons-lang/javadocs/api-release/',
|
|
|
|
'https://commons.apache.org/proper/commons-io/apidocs/',
|
|
|
|
'https://commons.apache.org/proper/commons-codec/archives/1.15/apidocs/',
|
|
|
|
'https://commons.apache.org/proper/commons-compress/apidocs/',
|
|
|
|
'https://hc.apache.org/httpcomponents-client-4.5.x/current/httpclient/apidocs/',
|
2021-01-26 08:10:08 -05:00
|
|
|
"https://maven.fabricmc.net/docs/fabric-loader-${project.fabric_loader_version}/",
|
2021-11-16 13:18:51 -05:00
|
|
|
"https://docs.oracle.com/en/java/javase/17/docs/api/"
|
2020-04-07 16:13:29 -04:00
|
|
|
)
|
2021-11-16 13:18:51 -05:00
|
|
|
// https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html#additional-options-provided-by-the-standard-doclet
|
2021-01-21 13:44:55 -05:00
|
|
|
addBooleanOption 'Xdoclint:html', true
|
|
|
|
addBooleanOption 'Xdoclint:syntax', true
|
|
|
|
addBooleanOption 'Xdoclint:reference', true
|
|
|
|
addBooleanOption 'Xdoclint:accessibility', true
|
2020-04-07 16:13:29 -04:00
|
|
|
}
|
2021-03-30 17:39:16 -04:00
|
|
|
source fileTree(fakeSourceDir) + sourceSets.constants.allJava + sourceSets.packageDocs.allJava
|
2022-10-23 14:29:44 -04:00
|
|
|
classpath = configurations.javadocClasspath.plus minecraftLibraries
|
2021-01-21 13:44:55 -05:00
|
|
|
|
2021-07-10 07:28:14 -04:00
|
|
|
doLast {
|
|
|
|
project.copy {
|
2021-01-21 13:44:55 -05:00
|
|
|
from mappingPoetJar
|
|
|
|
include "copy_on_click.js"
|
|
|
|
into javadoc.outputDirectory
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doFirst {
|
|
|
|
// lazy setting
|
|
|
|
options {
|
|
|
|
tagletPath configurations.mappingPoet.files.toList()
|
2021-07-10 07:28:14 -04:00
|
|
|
header mappingPoetJar.get().filter { it.name == 'javadoc_header.txt' }.singleFile.text.trim() // cannot include line breaks
|
2021-01-21 13:44:55 -05:00
|
|
|
addFileOption "-add-stylesheet", mappingPoetJar.get().filter { it.name == 'forms.css' }.singleFile
|
|
|
|
}
|
|
|
|
}
|
2020-04-07 16:13:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task javadocJar(type: Jar, dependsOn: ["javadoc"]) {
|
|
|
|
group = "javadoc generation"
|
|
|
|
|
|
|
|
from javadoc.destinationDir
|
|
|
|
|
|
|
|
archiveVersion.set yarnVersion
|
2021-01-21 13:44:55 -05:00
|
|
|
archiveClassifier = 'javadoc'
|
2020-04-07 16:13:29 -04:00
|
|
|
}
|
|
|
|
|
2021-04-01 16:45:41 -04:00
|
|
|
generatePackageInfoMappings {
|
|
|
|
dependsOn mapIntermediaryJar
|
|
|
|
inputJar = intermediaryJar
|
|
|
|
packageName = "net/minecraft/unused/packageinfo/"
|
|
|
|
outputDir = file("mappings/net/minecraft/unused/packageinfo")
|
|
|
|
}
|
|
|
|
|
2021-04-13 07:59:43 -04:00
|
|
|
javadocLint {
|
|
|
|
group = "javadoc generation"
|
|
|
|
mappingDirectory = file("mappings")
|
|
|
|
}
|
|
|
|
|
|
|
|
check.dependsOn javadocLint
|
|
|
|
|
2018-10-30 07:29:43 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
maven(MavenPublication) {
|
|
|
|
groupId 'net.fabricmc'
|
2018-12-09 16:14:34 -05:00
|
|
|
artifactId "yarn"
|
|
|
|
version yarnVersion
|
2018-10-30 07:29:43 -04:00
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
artifact(compressTiny.output) {
|
2018-10-30 07:29:43 -04:00
|
|
|
classifier "tiny"
|
2018-11-15 11:57:32 -05:00
|
|
|
builtBy compressTiny
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
2019-11-07 06:38:33 -05:00
|
|
|
artifact(tinyJar)
|
|
|
|
artifact(v2UnmergedYarnJar) {
|
|
|
|
classifier "v2"
|
|
|
|
}
|
2020-03-09 15:28:16 -04:00
|
|
|
artifact(v2MergedYarnJar) {
|
|
|
|
classifier "mergedv2"
|
|
|
|
}
|
2021-03-24 16:04:48 -04:00
|
|
|
artifact(constantsJar) {
|
|
|
|
classifier "constants"
|
|
|
|
}
|
|
|
|
artifact sourcesJar
|
2020-04-07 16:13:29 -04:00
|
|
|
artifact javadocJar
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
|
|
|
repositories {
|
2020-11-06 18:33:17 -05:00
|
|
|
if (ENV.MAVEN_URL) {
|
|
|
|
maven {
|
|
|
|
url ENV.MAVEN_URL
|
2018-10-30 07:29:43 -04:00
|
|
|
credentials {
|
2020-11-06 18:33:17 -05:00
|
|
|
username ENV.MAVEN_USERNAME
|
|
|
|
password ENV.MAVEN_PASSWORD
|
2018-10-30 07:29:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-28 14:42:32 -04:00
|
|
|
// A task to ensure that the version being released has not already been released.
|
|
|
|
task checkVersion {
|
|
|
|
doFirst {
|
|
|
|
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml").text
|
|
|
|
def metadata = new XmlSlurper().parseText(xml)
|
|
|
|
def versions = metadata.versioning.versions.version*.text();
|
|
|
|
if (versions.contains(version)) {
|
|
|
|
throw new RuntimeException("${version} has already been released!")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
publish.mustRunAfter checkVersion
|
|
|
|
|
2018-10-30 07:29:43 -04:00
|
|
|
class FileOutput extends DefaultTask {
|
2019-11-07 06:38:33 -05:00
|
|
|
@OutputFile
|
|
|
|
File output
|
2018-10-31 12:54:00 -04:00
|
|
|
}
|
2019-11-07 06:38:33 -05:00
|
|
|
|
|
|
|
class WithV2FileOutput extends DefaultTask {
|
|
|
|
@OutputFile
|
|
|
|
File v1Output
|
|
|
|
@OutputFile
|
|
|
|
File v2Output
|
2020-03-20 18:57:01 -04:00
|
|
|
}
|
2022-05-27 07:06:56 -04:00
|
|
|
|
|
|
|
abstract class EnigmaTask extends JavaExec {
|
|
|
|
@Input
|
|
|
|
abstract Property<File> getJar()
|
|
|
|
|
|
|
|
@Input
|
|
|
|
abstract Property<File> getMappings()
|
|
|
|
|
|
|
|
EnigmaTask() {
|
|
|
|
classpath = project.configurations.enigmaRuntime
|
|
|
|
mainClass.set('cuchaz.enigma.gui.Main')
|
|
|
|
}
|
|
|
|
|
|
|
|
@TaskAction
|
|
|
|
void exec() {
|
|
|
|
args '-jar'
|
|
|
|
args jar.get().absolutePath
|
|
|
|
args '-mappings'
|
|
|
|
args mappings.get().absolutePath
|
|
|
|
args '-profile'
|
|
|
|
args 'enigma_profile.json'
|
|
|
|
jvmArgs "-Xmx2048m"
|
|
|
|
super.exec()
|
|
|
|
}
|
|
|
|
}
|