aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-07-05 00:24:04 +0200
committernea <nea@nea.moe>2023-07-05 00:24:04 +0200
commit38213481142779e252e9be1fd69f794035c91f2e (patch)
tree905b50750e7eab1654e6aeb57da018df4ff54261 /src
parente67c8466eb180a75002c28d35f73776b10aab30d (diff)
downloadmcprepack-master.tar.gz
mcprepack-master.tar.bz2
mcprepack-master.zip
Add option to publish proguard mappings to mavenHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/mcprepack/App.kt34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/main/kotlin/mcprepack/App.kt b/src/main/kotlin/mcprepack/App.kt
index ede9b47..b41cd4c 100644
--- a/src/main/kotlin/mcprepack/App.kt
+++ b/src/main/kotlin/mcprepack/App.kt
@@ -26,12 +26,19 @@ val gson = GsonBuilder()
.setPrettyPrinting()
.create()
+enum class Versions(val pubVersion: String, val accessVersion: String, val mcpVersion: String) {
+ _10809("1.8.9", "1.8.9", "22-1.8.9"),
+ _11200("1.12", "1.12", "39-1.12"),
+ ;
+}
+
@OptIn(ExperimentalPathApi::class)
fun main(): Unit = lifecycle("Repacking") {
val mavenModulePub = "test"
- val pubVersion = "1.12"
- val accessVersion = "1.12"
- val mcpVersion = "39-1.12"
+ val whichOne = Versions._10809
+ val pubVersion = whichOne.pubVersion
+ val accessVersion = whichOne.accessVersion
+ val mcpVersion = whichOne.mcpVersion
WorkContext.setupWorkSpace()
val downloadDebugFiles = true
@@ -464,16 +471,21 @@ fun main(): Unit = lifecycle("Repacking") {
publishing {
"""
)
+ data class Publication(val classifier: String?, val path: Path, val extension: String = "jar")
- fun pub(artifactId: String, version: String, artifacts: Map<String?, Path>) {
+ fun pub(artifactId: String, version: String, artifacts: List<Publication>) {
it.append(
"""
publications.create<MavenPublication>("artifactId") {
${
- artifacts.map { (classifier, path) ->
+ artifacts.map { (classifier, path, extension) ->
"this.artifact(file(${gson.toJson(path.toAbsolutePath().toString())})) {" +
(if (classifier == null) ""
- else "this.classifier = ${gson.toJson(classifier)};") + "this.extension = \"jar\"}"
+ else "this.classifier = ${gson.toJson(classifier)};") + "this.extension = ${
+ gson.toJson(
+ extension
+ )
+ }}"
}.joinToString(separator = "\n")
}
this.groupId = allGroupId
@@ -484,7 +496,15 @@ fun main(): Unit = lifecycle("Repacking") {
)
}
- pub("mcp-yarn", pubVersion, mapOf(null to yarnCompatibleJar, "v2" to yarnCompatibleJar))
+ pub(
+ "mcp-yarn",
+ pubVersion,
+ listOf(
+ Publication(null, yarnCompatibleJar),
+ Publication("v2", yarnCompatibleJar),
+ Publication("official", proguardLog, "txt")
+ )
+ )
it.append(
"""
publications.filterIsInstance<MavenPublication>().forEach {