-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
124 lines (105 loc) · 3.58 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
124 lines (105 loc) · 3.58 KB
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
import io.papermc.unpick.task.*
import io.papermc.unpick.util.ArtifactVersionProvider
plugins {
java
`maven-publish`
id("mc-base")
}
repositories {
mavenCentral()
maven("https://maven.fabricmc.net/")
}
val enigma = configurations.register("enigma")
mcBase {
mcVersion = providers.gradleProperty("minecraft_version")
}
dependencies {
enigma("cuchaz:enigma-swing:4.0.2")
enigma("org.vineflower:vineflower:1.12.0") // sync with mache
enigma(project(":enigma-plugin", "runtimeElements"))
}
val downloadJar = tasks.register<DownloadFile>("downloadJar") {
group = "unpick"
url = mcBase.manifest.map { it.downloads.client.url }
expectedSha1 = mcBase.manifest.map { it.downloads.client.sha1 }
output = project.layout.buildDirectory.file("client.jar")
}
val generateUnpickData = tasks.register<GenerateUnpickData>("generateUnpickData") {
group = "unpick"
definitions = project.layout.projectDirectory.dir("definitions")
output = temporaryDir.resolve("unpick_combined.unpick")
}
val unpickJar = tasks.register<UnpickJar>("unpickJar") {
group = "unpick"
input = downloadJar.flatMap { it.output }
output = project.layout.buildDirectory.file("client-unpicked.jar")
definitions = generateUnpickData.flatMap { it.output }
classpath.setFrom(configurations.minecraft)
}
tasks.register<EnigmaRunner>("enigma") {
group = "unpick"
description = "Runs the Enigma mapping tool"
classpath(enigma)
mainClass = "cuchaz.enigma.gui.Main"
val selectedJar = if (project.findProperty("unpick") != null) {
unpickJar.flatMap { it.output }
} else {
downloadJar.flatMap { it.output }
}
inputJar = selectedJar
libraries.setFrom(configurations.minecraft)
}
tasks.register<CheckUnpickDefinitions>("checkUnpickDefinitions") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
input = project.layout.projectDirectory.dir("definitions")
classpath.setFrom(
downloadJar.flatMap { it.output },
configurations.minecraft
)
}
val artifactVersionProvider = providers.of(ArtifactVersionProvider::class) {
parameters {
repoUrl = "https://artifactory.papermc.io/artifactory/releases/"
version = mcBase.mcVersion
ci = providers.environmentVariable("CI").map { it.toBooleanStrict() }.orElse(false)
}
}
val exportZip = tasks.register<Zip>("exportZip") {
group = LifecycleBasePlugin.BUILD_GROUP
from(generateUnpickData.flatMap { it.output })
rename { "extras/definitions.unpick" } // for legacy compatibility with yarn
}
publishing {
publications.withType<MavenPublication>().configureEach {
pom {
name = "Unpick definitions"
description = "Unpick definitions for Minecraft: Java Edition."
organization {
name = "PaperMC"
url = "https://github.com/PaperMC"
}
}
artifactId = "unpick-definitions"
}
repositories {
maven("https://artifactory.papermc.io/artifactory/releases/") {
name = "paper"
credentials(PasswordCredentials::class)
}
}
publications.register<MavenPublication>("export") {
artifact(generateUnpickData.flatMap { it.output })
version = artifactVersionProvider.get()
}
publications.register<MavenPublication>("exportZip") {
artifact(exportZip)
version = artifactVersionProvider.get()
}
}
val printVersion = tasks.register("printVersion") {
val version = artifactVersionProvider.get()
inputs.property("version", version)
doFirst {
println(version)
}
}