-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
193 lines (165 loc) · 6.17 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import io.github.legacymoddingmc.legacymappings.task.PrepareEnigmaTask
import io.github.legacymoddingmc.legacymappings.LegacyMappingsPlugin
import kotlin.io.path.exists
// Use RFG to fetch the srg jar
plugins {
id("com.gtnewhorizons.retrofuturagradle") version "1.3.33"
id("io.github.legacymoddingmc.legacy-mappings-plugin")
}
minecraft {
mcVersion.set("1.7.10")
}
repositories {
maven {
name = "Fabric Repository"
url = uri("https://maven.fabricmc.net")
}
}
repositories {
maven {
name = "forge"
url = uri("https://maven.minecraftforge.net")
mavenContent {
includeGroup("net.minecraftforge")
includeGroup("net.minecraftforge.srg2source")
includeGroup("de.oceanlabs.mcp")
includeGroup("cpw.mods")
}
}
exclusiveContent {
forRepository {
ivy {
name = "Enigma releases"
url = uri("https://github.com/LegacyModdingMC/enigma/releases/download/")
patternLayout {
artifact("[revision]/[module]-[revision](-[classifier])(.[ext])")
}
metadataSources {
artifact()
}
}
}
filter {
includeGroup("io.github.legacymoddingmc")
}
}
}
// Fetch build number from Github Actions
val buildNumber = System.getenv().get("BUILD_NUMBER") ?: "local"
val minecraftVersion = "1.7.10"
val mappingVersion = "${minecraftVersion}+build.$buildNumber"
tasks.jar.configure { enabled = false }
tasks.reobfJar.configure { enabled = false }
tasks.reobfJar.configure { enabled = false }
tasks.packageMcLauncher.configure { enabled = false }
tasks.packagePatchedMc.configure { enabled = false }
tasks.compileJava.configure { enabled = false }
minecraft {
useForgeEmbeddedMappings = false
// hack: force generateForgeSrgMappings to rerun by setting a non-downloaded mapping, and outputting to a different
// directory than the one it checks
//
// ~.gradle/caches/minecraft/de/oceanlabs/mcp/mcp_stable/11/rfg_srgs must be empty for this to work
mcpMappingVersion = "11"
}
tasks.generateForgeSrgMappings {
notchToSrg = layout.buildDirectory.file("userdev_local/notch-srg.srg")
notchToMcp = layout.buildDirectory.file("userdev_local/notch-mcp.srg")
srgToMcp = layout.buildDirectory.file("userdev_local/srg-mcp.srg")
mcpToSrg = layout.buildDirectory.file("userdev_local/mcp-srg.srg")
mcpToNotch = layout.buildDirectory.file("userdev_local/mcp-notch.srg")
srgExc = layout.buildDirectory.file("userdev_local/srg.exc")
mcpExc = layout.buildDirectory.file("userdev_local/mcp.exc")
}
if(LegacyMappingsPlugin.mappingsDirExists(project)) {
tasks.generateForgeSrgMappings {
methodsCsv = tasks.exportMappings.flatMap { t -> t.outputCsvDir.file("methods.csv") }
fieldsCsv = tasks.exportMappings.flatMap { t -> t.outputCsvDir.file("fields.csv") }
// TODO use tiny once support for it is implemented
//inputMcpTiny = tasks.exportMappings.flatMap { t -> t.outputTinyFile }
}
tasks.remapDecompiledJar {
paramCsv = tasks.exportMappings.flatMap { t -> t.outputCsvDir.file("params.csv") }
}
}
val v2UnmergedMappingsJar = tasks.register<Jar>("v2UnmergedMappingsJar") {
setDescription("Assembles a Yarn-style jar containing a tiny V2 mapping from the SRG namespace.");
val mappings = tasks.exportMappings.flatMap { t -> t.outputTinyFile }
group = "mapping build"
archiveFileName = "legacymappings-${mappingVersion}-v2.jar"
from(mappings) {
rename("mappings.tiny", "mappings/mappings.tiny")
}
from(project.file("LICENSE.MCP")) {
rename("LICENSE.MCP", "LICENSE")
}
destinationDirectory.set(file("build/libs"))
manifest {
attributes(Pair("Minecraft-Version-Id", minecraftVersion))
}
}
val csvZip = tasks.register<Zip>("csvZip") {
setDescription("Assembles an MCP-style zip containing CSV files for method, field and parameter mappings.");
val mappings = tasks.exportMappings.flatMap { t -> t.outputCsvDir }
group = "mapping build"
archiveFileName = "legacymappings-${mappingVersion}-csv.zip"
from(mappings)
from(project.file("LICENSE.MCP")) {
rename("LICENSE.MCP", "LICENSE")
}
destinationDirectory.set(file("build/libs"))
}
val packageMappings = tasks.register("packageMappings") {
group = "mapping build"
setDescription("Assembles all the mapping archives.");
dependsOn(v2UnmergedMappingsJar, csvZip)
}
tasks.assemble.configure {
dependsOn(packageMappings)
}
val openEnigma = tasks.register<JavaExec>("openEnigma") {
onlyIf(LegacyMappingsPlugin.mappingsDirExists)
group = "internal mapping"
classpath = enigmaRuntime
mainClass.set("org.quiltmc.enigma.gui.Main")
jvmArgs("-Xmx2048M", "-Denigma.legacymodding=true")
args(
"-jar",
tasks.named<PrepareEnigmaTask>("prepareEnigma").get().outputEnigmaJar.get().asFile,
"-mappings",
tasks.named<PrepareEnigmaTask>("prepareEnigma").get().outputEnigmaMapping.get().asFile
)
}
val enigma = tasks.register("enigma") {
setDescription("Opens Enigma for editing the mappings.");
group = "mapping"
}
enigma.configure { dependsOn(tasks.saveEnigma) }
tasks.saveEnigma.configure { dependsOn(openEnigma) }
openEnigma.configure { dependsOn(tasks.prepareEnigma) }
tasks.jar.configure { enabled = false }
tasks.reobfJar.configure { enabled = false }
tasks.reobfJar.configure { enabled = false }
tasks.packageMcLauncher.configure { enabled = false }
tasks.packagePatchedMc.configure { enabled = false }
tasks.compileJava.configure { enabled = false }
val enigmaRuntime: Configuration by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}
dependencies {
enigmaRuntime("io.github.legacymoddingmc:enigma-swing:2.2.1-lmmc:all")
}
legacyMappings {
userdev("net.minecraftforge:forge:1.7.10-10.13.4.1614-1.7.10:userdev")
mcp("de.oceanlabs.mcp:mcp_stable:12-1.7.10@zip")
mcp("de.oceanlabs.mcp:mcp_stable:22-1.8.9@zip")
mcp("de.oceanlabs.mcp:mcp_stable:26-1.9.4@zip")
mcp("de.oceanlabs.mcp:mcp_stable:29-1.10.2@zip")
mcp("de.oceanlabs.mcp:mcp_stable:32-1.11@zip")
mcp("de.oceanlabs.mcp:mcp_stable:39-1.12@zip")
yarn("net.legacyfabric:yarn:1.7.10+build.458:mergedv2")
feather("net.ornithemc:feather:1.7.10+build.26:mergedv2")
layerOrder("yarn", "feather", "mcpPreferOlder")
commentOrder("mcpPreferOlder", "mcpPreferNewer", "yarn", "feather")
}