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}"
|
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
|
2018-12-08 07:32:48 -05:00
|
|
|
id 'maven-publish'
|
2023-08-30 11:19:43 -04:00
|
|
|
id "com.diffplug.spotless" version "6.21.0"
|
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
|
|
|
|
2024-02-07 11:22:55 -05:00
|
|
|
def minecraft_version = "24w06a"
|
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
|
|
|
|
}
|
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}"
|
2023-06-14 10:35:22 -04:00
|
|
|
enigmaRuntime "net.fabricmc:cfr:${project.cfr_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}"
|
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 yarnGroup = "yarn"
|
|
|
|
def buildMappingGroup = "mapping build"
|
|
|
|
def mapJarGroup = "jar mapping"
|
2018-10-27 10:16:43 -04:00
|
|
|
def mappingsDir = file("mappings")
|
2023-03-25 13:43:54 -04:00
|
|
|
def tempDir = file("build/temp/yarn")
|
|
|
|
def cacheFilesMinecraft = new File(tempDir, "minecraft")
|
2018-10-30 07:29:43 -04:00
|
|
|
def libs = new File("build/libs/")
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
def minecraftLibraries = configurations.minecraftLibraries
|
2022-10-23 14:29:44 -04:00
|
|
|
|
2019-06-28 16:12:16 -04:00
|
|
|
import cuchaz.enigma.command.CheckMappingsCommand
|
2022-09-20 17:37:53 -04:00
|
|
|
import net.fabricmc.filament.task.MapJarTask
|
2023-03-25 13:43:54 -04:00
|
|
|
import net.fabricmc.filament.task.DownloadTask
|
|
|
|
import net.fabricmc.filament.task.UnpickJarTask
|
|
|
|
import net.fabricmc.filament.task.base.WithFileInput
|
|
|
|
import net.fabricmc.filament.task.base.WithFileOutput
|
|
|
|
import net.fabricmc.filament.task.enigma.MapSpecializedMethodsTask
|
2023-05-10 13:16:40 -04:00
|
|
|
import net.fabricmc.filament.task.mappingio.ConvertMappingsTask
|
|
|
|
import net.fabricmc.filament.task.mappingio.MergeMappingsTask
|
|
|
|
import net.fabricmc.mappingio.format.MappingFormat
|
2021-09-28 11:17:36 -04:00
|
|
|
import net.fabricmc.nameproposal.MappingNameCompleter
|
2023-03-25 13:43:54 -04:00
|
|
|
import org.gradle.work.DisableCachingByDefault
|
2024-02-08 03:52:35 -05:00
|
|
|
import com.diffplug.spotless.LineEnding
|
|
|
|
import groovy.xml.XmlSlurper
|
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
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('downloadIntermediary', DownloadTask) {
|
2019-06-28 17:55:20 -04:00
|
|
|
group = buildMappingGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
url = "https://github.com/FabricMC/intermediary/raw/master/mappings/${minecraft_version}.tiny"
|
|
|
|
output = new File(cacheFilesMinecraft, "${minecraft_version}-intermediary.tiny")
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('mapIntermediaryJar', MapJarTask) {
|
|
|
|
dependsOn downloadIntermediary, mergeMinecraftJars
|
2019-06-28 17:55:20 -04:00
|
|
|
group = mapJarGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
output = file("${minecraft_version}-intermediary.jar")
|
|
|
|
input = mergeMinecraftJars.output
|
|
|
|
mappings = downloadIntermediary.output
|
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
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('mapServerIntermediaryJar', MapJarTask) {
|
|
|
|
dependsOn downloadIntermediary, extractBundledServer
|
2022-05-27 07:06:56 -04:00
|
|
|
group = mapJarGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
output = file("${minecraft_version}-server-intermediary.jar")
|
|
|
|
input = extractBundledServer.output
|
|
|
|
mappings = downloadIntermediary.output
|
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
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('yarn', EnigmaTask) {
|
|
|
|
dependsOn mapIntermediaryJar
|
2022-05-27 07:06:56 -04:00
|
|
|
group = yarnGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
jar = mapIntermediaryJar.output
|
2022-05-27 07:06:56 -04:00
|
|
|
mappings = mappingsDir
|
|
|
|
}
|
2021-09-16 16:03:56 -04:00
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('yarnCommon', EnigmaTask) {
|
2022-05-27 07:06:56 -04:00
|
|
|
group = yarnGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
jar = mapServerIntermediaryJar.output
|
2022-05-27 07:06:56 -04:00
|
|
|
mappings = mappingsDir
|
2019-06-28 17:55:20 -04:00
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('checkMappings') {
|
2019-06-28 17:55:20 -04:00
|
|
|
group = buildMappingGroup
|
|
|
|
inputs.dir mappingsDir
|
2023-03-25 13:43:54 -04:00
|
|
|
inputs.file mapIntermediaryJar.output
|
2019-06-28 17:55:20 -04:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
def intermediaryJarPath = mapIntermediaryJar.outputFile.absolutePath
|
|
|
|
|
|
|
|
doLast {
|
2019-06-28 17:55:20 -04:00
|
|
|
String[] args = [
|
2023-05-10 13:16:40 -04:00
|
|
|
intermediaryJarPath,
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('mapSpecializedMethods', MapSpecializedMethodsTask) {
|
2023-03-25 13:43:54 -04:00
|
|
|
intermediaryJarFile = mapIntermediaryJar.output
|
|
|
|
mappings = mappingsDir
|
|
|
|
output = new File(tempDir, "yarn-mappings-v2.tiny")
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
inputMappingsFormat = "enigma"
|
|
|
|
outputMappingsFormat = "tinyv2:intermediary:named"
|
|
|
|
}
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('convertToV1', ConvertMappingsTask) {
|
2023-03-25 13:43:54 -04:00
|
|
|
input = mapSpecializedMethods.output
|
|
|
|
output = new File(tempDir, "yarn-mappings.tiny")
|
2024-02-08 03:52:35 -05:00
|
|
|
outputFormat = MappingFormat.TINY_FILE
|
2018-10-31 09:05:19 -04:00
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('mergeTiny', MergeMappingsTask) {
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2019-11-07 06:38:33 -05:00
|
|
|
output = new File(tempDir, "mappings.tiny")
|
2023-05-10 13:16:40 -04:00
|
|
|
mappingInputs.from downloadIntermediary.output
|
|
|
|
mappingInputs.from convertToV1.output
|
2024-02-08 03:52:35 -05:00
|
|
|
outputFormat = MappingFormat.TINY_FILE
|
2018-10-31 09:05:19 -04:00
|
|
|
}
|
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
// Disable the default jar task
|
|
|
|
jar {
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('tinyJar', Jar) {
|
|
|
|
dependsOn mergeTiny
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2019-12-11 06:52:21 -05:00
|
|
|
archiveFileName = "yarn-${yarnVersion}.jar"
|
|
|
|
destinationDirectory.set(file("build/libs"))
|
2023-03-25 13:43:54 -04:00
|
|
|
archiveClassifier = ""
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('compressTiny', FileInputOutput) {
|
|
|
|
dependsOn tinyJar, mergeTiny
|
2019-05-12 21:45:52 -04:00
|
|
|
group = buildMappingGroup
|
2018-10-31 09:05:19 -04:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
input = mergeTiny.output
|
|
|
|
output = new File(libs, "yarn-tiny-${yarnVersion}.gz")
|
2018-10-31 09:05:19 -04:00
|
|
|
|
|
|
|
doLast {
|
2018-10-27 10:16:43 -04:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
sourceSets {
|
|
|
|
constants
|
|
|
|
packageDocs // package info files
|
2019-01-09 15:28:08 -05:00
|
|
|
}
|
2018-10-27 10:16:43 -04:00
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('constantsJar', Jar) {
|
2023-03-25 13:43:54 -04:00
|
|
|
from sourceSets.constants.output
|
|
|
|
archiveClassifier = "constants"
|
2018-10-31 12:53:07 -04:00
|
|
|
}
|
2018-10-30 07:29:43 -04:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
tasks.build.dependsOn "compressTiny","tinyJar","v2UnmergedYarnJar", "v2MergedYarnJar", "javadocJar"
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
// Setup the build for the unpicked constants
|
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
java {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2023-11-24 04:07:58 -05:00
|
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
|
|
|
it.preserveFileTimestamps = false
|
|
|
|
it.reproducibleFileOrder = true
|
|
|
|
}
|
|
|
|
|
2022-04-15 18:17:53 -04:00
|
|
|
spotless {
|
2024-02-08 03:52:35 -05:00
|
|
|
lineEndings = LineEnding.UNIX
|
2023-03-25 13:43:54 -04:00
|
|
|
|
2022-04-15 18:17:53 -04:00
|
|
|
java {
|
|
|
|
licenseHeaderFile(rootProject.file("HEADER"))
|
|
|
|
}
|
2021-03-28 15:33:12 -04:00
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('sourcesJar', Jar) {
|
|
|
|
dependsOn classes
|
2021-03-24 16:04:48 -04:00
|
|
|
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
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('insertAutoGeneratedEnumMappings', FileInputOutput) {
|
|
|
|
dependsOn mapIntermediaryJar, downloadIntermediary
|
2019-11-07 06:38:33 -05:00
|
|
|
group = buildMappingGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
input = mapSpecializedMethods.output
|
2019-11-07 06:38:33 -05:00
|
|
|
output = new File(tempDir, "unmerged-named-v2-with-enum.tiny")
|
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
inputs.file mapIntermediaryJar.output
|
|
|
|
inputs.file downloadIntermediary.output
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
def intermediaryJarPath = mapIntermediaryJar.outputPath
|
|
|
|
def intermediaryMappingsPath = downloadIntermediary.outputPath
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
doLast {
|
2021-09-28 11:17:36 -04:00
|
|
|
MappingNameCompleter.completeNames(
|
2023-05-10 13:16:40 -04:00
|
|
|
intermediaryJarPath,
|
|
|
|
inputPath,
|
|
|
|
intermediaryMappingsPath,
|
|
|
|
outputPath
|
2021-09-28 11:17:36 -04:00
|
|
|
)
|
2019-11-07 06:38:33 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
remapUnpickDefinitionsIntermediary {
|
|
|
|
group = 'unpick'
|
|
|
|
output = new File(tempDir, 'intermediary-definitions.unpick')
|
|
|
|
mappings = insertAutoGeneratedEnumMappings.output
|
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('unpickIntermediaryJar', UnpickJarTask) {
|
2023-03-25 13:43:54 -04:00
|
|
|
group = 'unpick'
|
|
|
|
input = mapIntermediaryJar.output
|
|
|
|
output = file("${minecraft_version}-intermediary-unpicked.jar")
|
|
|
|
unpickDefinition = remapUnpickDefinitionsIntermediary.output
|
|
|
|
constantsJarFile = constantsJar.archiveFile
|
|
|
|
classpath.from minecraftLibraries
|
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('yarnUnpicked', EnigmaTask) {
|
|
|
|
dependsOn "unpickIntermediaryJar"
|
2023-03-25 13:43:54 -04:00
|
|
|
group = yarnGroup
|
|
|
|
jar = unpickIntermediaryJar.output
|
|
|
|
mappings = mappingsDir
|
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('mergeV2', MergeMappingsTask) {
|
|
|
|
group = buildMappingGroup
|
|
|
|
output = new File(tempDir, "merged-v2.tiny")
|
|
|
|
mappingInputs.from downloadIntermediary.output
|
|
|
|
mappingInputs.from insertAutoGeneratedEnumMappings.output
|
2024-02-08 03:52:35 -05:00
|
|
|
outputFormat = MappingFormat.TINY_2_FILE
|
2020-03-09 15:28:16 -04:00
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('v2UnmergedYarnJar', Jar) {
|
|
|
|
dependsOn insertAutoGeneratedEnumMappings, combineUnpickDefinitions
|
2019-11-07 06:38:33 -05:00
|
|
|
def mappings = insertAutoGeneratedEnumMappings.output
|
|
|
|
group = "mapping build"
|
2019-12-11 06:52:21 -05:00
|
|
|
archiveFileName = "yarn-${yarnVersion}-v2.jar"
|
2019-11-07 06:38:33 -05:00
|
|
|
|
|
|
|
from(file(mappings)) {
|
2023-03-25 13:43:54 -04:00
|
|
|
rename mappings.get().asFile.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
|
|
|
}
|
2023-05-10 13:16:40 -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
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('v2MergedYarnJar', Jar) {
|
|
|
|
dependsOn mergeV2
|
|
|
|
def mappings = mergeV2.outputFile
|
2020-03-09 15:28:16 -04:00
|
|
|
group = "mapping build"
|
|
|
|
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
|
|
|
}
|
2023-05-10 13:16:40 -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
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('mapNamedJar', MapJarTask) {
|
|
|
|
dependsOn mergeV2, unpickIntermediaryJar
|
2022-09-20 17:37:53 -04:00
|
|
|
group = mapJarGroup
|
2023-03-25 13:43:54 -04:00
|
|
|
output = file("${minecraft_version}-named.jar")
|
|
|
|
input = unpickIntermediaryJar.output
|
2022-09-20 17:37:53 -04:00
|
|
|
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 = [
|
2023-05-10 13:16:40 -04:00
|
|
|
"javax/annotation/Nullable" : "org/jetbrains/annotations/Nullable",
|
|
|
|
"javax/annotation/Nonnull" : "org/jetbrains/annotations/NotNull",
|
|
|
|
"javax/annotation/concurrent/Immutable": "org/jetbrains/annotations/Unmodifiable"
|
2022-09-20 17:37:53 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
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.
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('syncDependencies', Sync) {
|
2022-10-23 14:29:44 -04:00
|
|
|
from minecraftLibraries
|
|
|
|
into mcLibsDir
|
|
|
|
}
|
|
|
|
|
2020-04-07 16:13:29 -04:00
|
|
|
def fakeSourceDir = file(".gradle/temp/fakeSource")
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('genFakeSource', JavaExec) {
|
|
|
|
dependsOn mergeV2, mapNamedJar, syncDependencies
|
2020-04-07 16:13:29 -04:00
|
|
|
group = "javadoc generation"
|
2023-03-25 13:43:54 -04:00
|
|
|
|
|
|
|
inputs.file mergeV2.output
|
|
|
|
inputs.file mapNamedJar.output
|
|
|
|
inputs.dir mcLibsDir
|
|
|
|
|
|
|
|
outputs.dir fakeSourceDir
|
2020-04-07 16:13:29 -04:00
|
|
|
|
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
|
2023-05-10 13:16:40 -04:00
|
|
|
args mergeV2.outputFile.getAbsolutePath(), mapNamedJar.outputFile.getAbsolutePath(), fakeSourceDir.getAbsolutePath(), mcLibsDir.getAbsolutePath()
|
2020-04-07 16:13:29 -04:00
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('decompileCFR', JavaExec) {
|
2023-05-15 03:51:00 -04:00
|
|
|
def outputDir = file("namedSrc")
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
dependsOn mapNamedJar
|
2021-07-10 07:28:14 -04:00
|
|
|
mainClass = "org.benf.cfr.reader.Main"
|
2023-05-15 03:51:00 -04:00
|
|
|
classpath.from configurations.decompileClasspath
|
|
|
|
classpath.from minecraftLibraries
|
|
|
|
args mapNamedJar.outputFile.getAbsolutePath(), "--outputdir", outputDir.absolutePath
|
2020-10-31 15:02:53 -04:00
|
|
|
|
|
|
|
doFirst {
|
2023-05-15 03:51:00 -04:00
|
|
|
outputDir.deleteDir()
|
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"
|
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(
|
2023-09-01 13:44:21 -04:00
|
|
|
'https://guava.dev/releases/32.1.2-jre/api/docs/',
|
|
|
|
'https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1/',
|
2023-11-28 03:59:28 -05:00
|
|
|
'https://logging.apache.org/log4j/2.x/javadoc/log4j-api/',
|
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/',
|
2023-09-01 13:44:21 -04:00
|
|
|
'https://java-native-access.github.io/jna/5.13.0/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
|
|
|
|
2024-02-08 03:52:35 -05:00
|
|
|
def fs = project.services.get(FileSystemOperations.class)
|
|
|
|
def outputDir = javadoc.destinationDir
|
2023-03-25 13:43:54 -04:00
|
|
|
|
2021-07-10 07:28:14 -04:00
|
|
|
doLast {
|
2023-03-25 13:43:54 -04:00
|
|
|
fs.copy {
|
2021-01-21 13:44:55 -05:00
|
|
|
from mappingPoetJar
|
|
|
|
include "copy_on_click.js"
|
2023-03-25 13:43:54 -04:00
|
|
|
into outputDir
|
2021-01-21 13:44:55 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
def tagletClasspath = configurations.mappingPoet.files.toList()
|
|
|
|
|
2021-01-21 13:44:55 -05:00
|
|
|
doFirst {
|
|
|
|
// lazy setting
|
|
|
|
options {
|
2023-03-25 13:43:54 -04:00
|
|
|
tagletPath tagletClasspath
|
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
|
|
|
}
|
|
|
|
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('javadocJar', Jar) {
|
|
|
|
dependsOn javadoc
|
2020-04-07 16:13:29 -04:00
|
|
|
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 {
|
2023-03-25 13:43:54 -04:00
|
|
|
inputJar = mapIntermediaryJar.output
|
2021-04-01 16:45:41 -04:00
|
|
|
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 {
|
2024-02-08 03:52:35 -05:00
|
|
|
register("maven", MavenPublication) {
|
2018-10-30 07:29:43 -04:00
|
|
|
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.
|
2023-05-10 13:16:40 -04:00
|
|
|
tasks.register('checkVersion') {
|
2021-04-28 14:42:32 -04:00
|
|
|
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
|
|
|
|
|
2019-11-07 06:38:33 -05:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
abstract class FileInputOutput extends DefaultTask implements WithFileInput, WithFileOutput {
|
2020-03-20 18:57:01 -04:00
|
|
|
}
|
2022-05-27 07:06:56 -04:00
|
|
|
|
2023-03-25 13:43:54 -04:00
|
|
|
@DisableCachingByDefault
|
2022-05-27 07:06:56 -04:00
|
|
|
abstract class EnigmaTask extends JavaExec {
|
2023-03-25 13:43:54 -04:00
|
|
|
@InputFile
|
|
|
|
abstract RegularFileProperty getJar()
|
2022-05-27 07:06:56 -04:00
|
|
|
|
|
|
|
@Input
|
|
|
|
abstract Property<File> getMappings()
|
|
|
|
|
|
|
|
EnigmaTask() {
|
|
|
|
classpath = project.configurations.enigmaRuntime
|
|
|
|
mainClass.set('cuchaz.enigma.gui.Main')
|
2023-04-28 07:48:03 -04:00
|
|
|
jvmArgs "-Xmx2048m"
|
2022-05-27 07:06:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@TaskAction
|
|
|
|
void exec() {
|
|
|
|
args '-jar'
|
2023-03-25 13:43:54 -04:00
|
|
|
args jar.get().asFile.absolutePath
|
2022-05-27 07:06:56 -04:00
|
|
|
args '-mappings'
|
|
|
|
args mappings.get().absolutePath
|
|
|
|
args '-profile'
|
|
|
|
args 'enigma_profile.json'
|
|
|
|
super.exec()
|
|
|
|
}
|
|
|
|
}
|