Update license, fix deployment, improve mappings, fix reobfJar
Also move Atlas to a separate JVM process isolation worker so we can have better control over memory requirements and don't require the Gradle daemon run with extra memory. Sorry for so many changes in one commit, this is probably my worst one yet.
This commit is contained in:
parent
831a148485
commit
9ee9f4bb1b
55 changed files with 565 additions and 303 deletions
|
@ -1,3 +1,4 @@
|
|||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.publish.maven.MavenPom
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
|
@ -21,11 +22,18 @@ java {
|
|||
withSourcesJar()
|
||||
}
|
||||
|
||||
val sourcesJar by tasks.existing
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
// we handle publications ourselves
|
||||
isAutomatedPublishing = false
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
|
@ -83,13 +91,19 @@ idea {
|
|||
}
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
fun ShadowJar.configureStandard() {
|
||||
configurations = listOf(shade)
|
||||
|
||||
dependencies {
|
||||
exclude(dependency("org.jetbrains.kotlin:.*:.*"))
|
||||
}
|
||||
|
||||
mergeServiceFiles()
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
configureStandard()
|
||||
|
||||
val prefix = "paper.libs"
|
||||
listOf(
|
||||
"com.github.salomonbrys.kotson",
|
||||
|
@ -109,18 +123,32 @@ tasks.shadowJar {
|
|||
}
|
||||
}
|
||||
|
||||
val devShadowJar by tasks.registering(ShadowJar::class) {
|
||||
configureStandard()
|
||||
|
||||
from(project.sourceSets.main.get().output)
|
||||
|
||||
archiveClassifier.set("dev")
|
||||
}
|
||||
|
||||
val isSnapshot = version().endsWith("-SNAPSHOT")
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
register<MavenPublication>("shadow") {
|
||||
pluginConfig(version())
|
||||
artifact(tasks.shadowJar) {
|
||||
classifier = null
|
||||
}
|
||||
}
|
||||
register<MavenPublication>("maven") {
|
||||
standardConfig(version())
|
||||
}
|
||||
register<MavenPublication>("shadowLocal") {
|
||||
pluginConfig(localVersion())
|
||||
artifact(devShadowJar) {
|
||||
classifier = null
|
||||
}
|
||||
}
|
||||
register<MavenPublication>("mavenLocal") {
|
||||
standardConfig(localVersion())
|
||||
|
@ -157,6 +185,9 @@ fun MavenPublication.standardConfig(versionName: String) {
|
|||
version = versionName
|
||||
|
||||
from(components["java"])
|
||||
artifact(devShadowJar) {
|
||||
classifier = "dev"
|
||||
}
|
||||
|
||||
withoutBuildIdentifier()
|
||||
pom {
|
||||
|
@ -169,8 +200,7 @@ fun MavenPublication.pluginConfig(versionName: String) {
|
|||
artifactId = "io.papermc.paperweight.gradle.plugin"
|
||||
version = versionName
|
||||
|
||||
project.shadow.component(this)
|
||||
artifact(project.tasks.named("sourcesJar"))
|
||||
artifact(sourcesJar)
|
||||
|
||||
for (artifact in artifacts) {
|
||||
if (artifact.classifier == "all") {
|
||||
|
@ -185,7 +215,8 @@ fun MavenPublication.pluginConfig(versionName: String) {
|
|||
}
|
||||
|
||||
fun MavenPom.pomConfig() {
|
||||
val repoUrl = "https://github.com/DemonWav/paperweight"
|
||||
val repoPath = "PaperMC/paperweight"
|
||||
val repoUrl = "https://github.com/$repoPath"
|
||||
|
||||
name.set("paperweight")
|
||||
description.set("Gradle plugin for the PaperMC project")
|
||||
|
@ -218,7 +249,7 @@ fun MavenPom.pomConfig() {
|
|||
scm {
|
||||
url.set(repoUrl)
|
||||
connection.set("scm:git:$repoUrl.git")
|
||||
developerConnection.set(connection)
|
||||
developerConnection.set("scm:git:git@github.com:$repoPath.git")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
some code and systems originally from ForgeGradle.
|
||||
paperweight is a Gradle plugin for the PaperMC project.
|
||||
|
||||
Copyright (C) 2020 Kyle Wood
|
||||
Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
Contributors
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
License as published by the Free Software Foundation;
|
||||
version 2.1 only, no later versions.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -376,6 +376,7 @@ class Paperweight : Plugin<Project> {
|
|||
patchMappings.set(extension.paper.mappingsPatch)
|
||||
|
||||
outputMappings.set(cache.resolve(Constants.PATCHED_SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
outputMappingsReversed.set(cache.resolve(Constants.PATCHED_MOJANG_YARN_SPIGOT_MAPPINGS))
|
||||
}
|
||||
|
||||
val spigotRemapJar by tasks.registering<SpigotRemapJar> {
|
||||
|
@ -484,17 +485,17 @@ class Paperweight : Plugin<Project> {
|
|||
private fun Project.createBuildTasks(spigotTasks: SpigotTasks) {
|
||||
val shadowJar: TaskProvider<Jar> = tasks.named("shadowJar", Jar::class.java)
|
||||
|
||||
val reobfJar by tasks.registering<RemapJar> {
|
||||
val reobfJar by tasks.registering<RemapJarAtlas> {
|
||||
dependsOn(shadowJar)
|
||||
inputJar.fileProvider(shadowJar.map { it.outputs.files.singleFile })
|
||||
|
||||
mappingsFile.set(spigotTasks.patchMappings.flatMap { it.outputMappings })
|
||||
mappingsFile.set(spigotTasks.patchMappings.flatMap { it.outputMappingsReversed })
|
||||
fromNamespace.set(Constants.DEOBF_NAMESPACE)
|
||||
toNamespace.set(Constants.SPIGOT_NAMESPACE)
|
||||
singleThreaded.set(false) // not worried about param names
|
||||
rebuildSourceFilenames.set(false)
|
||||
// singleThreaded.set(false) // not worried about param names
|
||||
// rebuildSourceFilenames.set(false)
|
||||
|
||||
remapper.fileProvider(rootProject.configurations.named(Constants.REMAPPER_CONFIG).map { it.singleFile })
|
||||
// remapper.fileProvider(rootProject.configurations.named(Constants.REMAPPER_CONFIG).map { it.singleFile })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -22,16 +22,15 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.AtlasHelper
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.emptyMergeResult
|
||||
import io.papermc.paperweight.util.ensureParentExists
|
||||
import io.papermc.paperweight.util.path
|
||||
import java.nio.file.FileSystems
|
||||
import java.nio.file.Files
|
||||
import org.cadixdev.atlas.Atlas
|
||||
import org.cadixdev.bombe.asm.jar.JarEntryRemappingTransformer
|
||||
import javax.inject.Inject
|
||||
import org.cadixdev.lorenz.MappingSet
|
||||
import org.cadixdev.lorenz.asm.LorenzRemapper
|
||||
import org.cadixdev.lorenz.merge.FieldMergeStrategy
|
||||
import org.cadixdev.lorenz.merge.MappingSetMerger
|
||||
import org.cadixdev.lorenz.merge.MappingSetMergerHandler
|
||||
|
@ -49,6 +48,7 @@ import org.gradle.api.file.RegularFileProperty
|
|||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.workers.WorkerExecutor
|
||||
|
||||
abstract class GenerateMappings : DefaultTask() {
|
||||
|
||||
|
@ -63,6 +63,9 @@ abstract class GenerateMappings : DefaultTask() {
|
|||
@get:OutputFile
|
||||
abstract val outputMappings: RegularFileProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val workerExecutor: WorkerExecutor
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
val vanillaMappings = MappingFormats.PROGUARD.createReader(vanillaMappings.path).use { it.read() }.reverse()
|
||||
|
@ -82,18 +85,10 @@ abstract class GenerateMappings : DefaultTask() {
|
|||
).merge()
|
||||
|
||||
// Fill out any missing inheritance info in the mappings
|
||||
val atlasOut = Files.createTempFile("paperweight", "jar")
|
||||
try {
|
||||
Atlas().use { atlas ->
|
||||
atlas.install { ctx -> JarEntryRemappingTransformer(LorenzRemapper(merged, ctx.inheritanceProvider())) }
|
||||
atlas.run(vanillaJar.path, atlasOut)
|
||||
}
|
||||
} finally {
|
||||
Files.deleteIfExists(atlasOut)
|
||||
}
|
||||
val filledMerged = AtlasHelper.using(workerExecutor).fillInheritance(merged, vanillaJar.path)
|
||||
|
||||
ensureParentExists(outputMappings)
|
||||
MappingFormats.TINY.write(merged, outputMappings.path, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
MappingFormats.TINY.write(filledMerged, outputMappings.path, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,14 +203,14 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
target: MappingSet?,
|
||||
context: MergeContext?
|
||||
): MergeResult<TopLevelClassMapping?> {
|
||||
return MergeResult(null)
|
||||
return emptyMergeResult()
|
||||
}
|
||||
override fun addRightInnerClassMapping(
|
||||
right: InnerClassMapping?,
|
||||
target: ClassMapping<*, *>?,
|
||||
context: MergeContext?
|
||||
): MergeResult<InnerClassMapping?> {
|
||||
return MergeResult(null)
|
||||
return emptyMergeResult()
|
||||
}
|
||||
override fun addRightFieldMapping(
|
||||
right: FieldMapping?,
|
||||
|
@ -229,6 +224,6 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
target: ClassMapping<*, *>?,
|
||||
context: MergeContext?
|
||||
): MergeResult<MethodMapping?> {
|
||||
return MergeResult(null)
|
||||
return emptyMergeResult()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -24,6 +24,7 @@ package io.papermc.paperweight.tasks
|
|||
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.emptyMergeResult
|
||||
import io.papermc.paperweight.util.file
|
||||
import io.papermc.paperweight.util.orNull
|
||||
import io.papermc.paperweight.util.parentClass
|
||||
|
@ -369,7 +370,7 @@ class SpigotMappingsMergerHandler(
|
|||
context: MergeContext
|
||||
): MergeResult<MethodMapping?> {
|
||||
// Check if Spigot maps this from a synthetic method name
|
||||
var obfName = left.obfuscatedName
|
||||
var obfName: String? = null
|
||||
val synthMethods = synths[left.parent.fullObfuscatedName]?.get(left.obfuscatedDescriptor)
|
||||
if (synthMethods != null) {
|
||||
// This is a reverse lookup
|
||||
|
@ -381,11 +382,20 @@ class SpigotMappingsMergerHandler(
|
|||
}
|
||||
}
|
||||
|
||||
if (obfName == null) {
|
||||
return emptyMergeResult()
|
||||
}
|
||||
|
||||
val newMapping = target.getOrCreateMethodMapping(obfName, left.descriptor)
|
||||
newMapping.deobfuscatedName = left.deobfuscatedName
|
||||
return MergeResult(newMapping)
|
||||
}
|
||||
|
||||
override fun addLeftFieldMapping(left: FieldMapping, target: ClassMapping<*, *>, context: MergeContext): FieldMapping? {
|
||||
// We don't want mappings Spigot thinks exist but don't
|
||||
return null
|
||||
}
|
||||
|
||||
// Disable non-spigot mappings
|
||||
override fun addRightFieldMapping(
|
||||
right: FieldMapping,
|
||||
|
@ -402,7 +412,7 @@ class SpigotMappingsMergerHandler(
|
|||
): MergeResult<MethodMapping?> {
|
||||
// Check if spigot changes this method automatically
|
||||
val synthMethods = synths[right.parentClass.fullObfuscatedName]?.get(right.obfuscatedDescriptor)
|
||||
val newName = synthMethods?.get(right.obfuscatedName) ?: return MergeResult(null)
|
||||
val newName = synthMethods?.get(right.obfuscatedName) ?: return emptyMergeResult()
|
||||
|
||||
val newClassMapping = context.left.getClassMapping(right.parentClass.fullObfuscatedName).orNull
|
||||
val newMethodMapping = newClassMapping?.getMethodMapping(MethodSignature(newName, right.descriptor))?.orNull
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -45,6 +45,8 @@ abstract class PatchMappings : DefaultTask() {
|
|||
|
||||
@get:OutputFile
|
||||
abstract val outputMappings: RegularFileProperty
|
||||
@get:OutputFile
|
||||
abstract val outputMappingsReversed: RegularFileProperty
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
|
@ -76,5 +78,6 @@ abstract class PatchMappings : DefaultTask() {
|
|||
}
|
||||
|
||||
MappingFormats.TINY.write(mappings, outputMappings.path, Constants.SPIGOT_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
MappingFormats.TINY.write(mappings.reverse(), outputMappingsReversed.path, Constants.DEOBF_NAMESPACE, Constants.SPIGOT_NAMESPACE)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
74
src/main/kotlin/tasks/RemapJarAtlas.kt
Normal file
74
src/main/kotlin/tasks/RemapJarAtlas.kt
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*/
|
||||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.AtlasHelper
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.ensureParentExists
|
||||
import io.papermc.paperweight.util.path
|
||||
import java.nio.file.Files
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.workers.WorkerExecutor
|
||||
|
||||
abstract class RemapJarAtlas : BaseTask() {
|
||||
|
||||
@get:InputFile
|
||||
abstract val inputJar: RegularFileProperty
|
||||
|
||||
@get:InputFile
|
||||
abstract val mappingsFile: RegularFileProperty
|
||||
|
||||
@get:Input
|
||||
abstract val fromNamespace: Property<String>
|
||||
@get:Input
|
||||
abstract val toNamespace: Property<String>
|
||||
|
||||
@get:OutputFile
|
||||
abstract val outputJar: RegularFileProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val workerExecutor: WorkerExecutor
|
||||
|
||||
override fun init() {
|
||||
outputJar.convention(defaultOutput())
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
ensureParentExists(outputJar)
|
||||
ensureDeleted(outputJar)
|
||||
|
||||
val mappings = MappingFormats.TINY.read(mappingsFile.path, fromNamespace.get(), toNamespace.get())
|
||||
|
||||
val result = AtlasHelper.using(workerExecutor).remap(mappings, inputJar)
|
||||
Files.move(result, outputJar.path)
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -29,6 +29,7 @@ import io.papermc.paperweight.util.ensureParentExists
|
|||
import io.papermc.paperweight.util.file
|
||||
import io.papermc.paperweight.util.orNull
|
||||
import io.papermc.paperweight.util.path
|
||||
import javax.inject.Inject
|
||||
import org.cadixdev.at.AccessChange
|
||||
import org.cadixdev.at.AccessTransform
|
||||
import org.cadixdev.at.AccessTransformSet
|
||||
|
@ -42,6 +43,10 @@ import org.gradle.api.file.RegularFileProperty
|
|||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.kotlin.dsl.submit
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
import org.gradle.workers.WorkerExecutor
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.ClassWriter
|
||||
|
@ -60,6 +65,9 @@ abstract class ApplyAccessTransform : BaseTask() {
|
|||
@get:OutputFile
|
||||
abstract val outputJar: RegularFileProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val workerExecutor: WorkerExecutor
|
||||
|
||||
override fun init() {
|
||||
outputJar.convention(defaultOutput())
|
||||
}
|
||||
|
@ -69,14 +77,34 @@ abstract class ApplyAccessTransform : BaseTask() {
|
|||
ensureParentExists(outputJar.file)
|
||||
ensureDeleted(outputJar.file)
|
||||
|
||||
val at = AccessTransformFormats.FML.read(atFile.path)
|
||||
|
||||
Atlas().apply {
|
||||
install {
|
||||
AtJarEntryTransformer(at)
|
||||
}
|
||||
run(inputJar.path, outputJar.path)
|
||||
val queue = workerExecutor.processIsolation {
|
||||
forkOptions.jvmArgs("-Xmx1G")
|
||||
}
|
||||
|
||||
queue.submit(AtlasAction::class) {
|
||||
inputJar.set(this@ApplyAccessTransform.inputJar.file)
|
||||
atFile.set(this@ApplyAccessTransform.atFile.file)
|
||||
outputJar.set(this@ApplyAccessTransform.outputJar.file)
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AtlasAction : WorkAction<AtlasParameters> {
|
||||
override fun execute() {
|
||||
val at = AccessTransformFormats.FML.read(parameters.atFile.path)
|
||||
|
||||
Atlas().apply {
|
||||
install {
|
||||
AtJarEntryTransformer(at)
|
||||
}
|
||||
run(parameters.inputJar.path, parameters.outputJar.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface AtlasParameters : WorkParameters {
|
||||
val inputJar: RegularFileProperty
|
||||
val atFile: RegularFileProperty
|
||||
val outputJar: RegularFileProperty
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +122,7 @@ class AccessTransformerVisitor(
|
|||
writer: ClassWriter
|
||||
) : ClassVisitor(Opcodes.ASM7, writer) {
|
||||
|
||||
var classTransform: AccessTransformSet.Class? = null
|
||||
private var classTransform: AccessTransformSet.Class? = null
|
||||
|
||||
override fun visit(
|
||||
version: Int,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
113
src/main/kotlin/util/AtlasHelper.kt
Normal file
113
src/main/kotlin/util/AtlasHelper.kt
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
* USA
|
||||
*/
|
||||
|
||||
package io.papermc.paperweight.util
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import org.cadixdev.atlas.Atlas
|
||||
import org.cadixdev.bombe.asm.jar.JarEntryRemappingTransformer
|
||||
import org.cadixdev.lorenz.MappingSet
|
||||
import org.cadixdev.lorenz.asm.LorenzRemapper
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.kotlin.dsl.submit
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
import org.gradle.workers.WorkerExecutor
|
||||
|
||||
class AtlasHelper private constructor(private val workerExecutor: WorkerExecutor) {
|
||||
|
||||
fun remap(mappings: MappingSet, inputJar: Any): Path {
|
||||
val (outputJar, _) = runAtlas(mappings, inputJar)
|
||||
return outputJar
|
||||
}
|
||||
|
||||
fun fillInheritance(mappings: MappingSet, inputJar: Any): MappingSet {
|
||||
val (outputJar, outputMappings) = runAtlas(mappings, inputJar)
|
||||
try {
|
||||
return outputMappings
|
||||
} finally {
|
||||
Files.deleteIfExists(outputJar)
|
||||
}
|
||||
}
|
||||
|
||||
private fun runAtlas(mappings: MappingSet, input: Any): AtlasOutput {
|
||||
val inputFile = input.convertToFile()
|
||||
|
||||
val tempMappingsFile = Files.createTempFile("in-mappings", "tiny")
|
||||
val tempOutputMappingsFile = Files.createTempFile("out-mappings", "tiny")
|
||||
val outputJarFile = Files.createTempFile("output", "jar")
|
||||
|
||||
MappingFormats.TINY.write(mappings, tempMappingsFile, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
|
||||
val resultMappings: MappingSet = try {
|
||||
val queue = workerExecutor.processIsolation {
|
||||
forkOptions.jvmArgs("-Xmx1G")
|
||||
}
|
||||
|
||||
queue.submit(AtlasRunner::class) {
|
||||
inputJar.set(inputFile)
|
||||
outputJar.set(outputJarFile.toFile())
|
||||
mappingsFile.set(tempMappingsFile.toFile())
|
||||
outputMappingsFile.set(tempOutputMappingsFile.toFile())
|
||||
}
|
||||
|
||||
queue.await()
|
||||
|
||||
MappingFormats.TINY.read(tempOutputMappingsFile, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
} finally {
|
||||
Files.deleteIfExists(tempMappingsFile)
|
||||
Files.deleteIfExists(tempOutputMappingsFile)
|
||||
}
|
||||
|
||||
return AtlasOutput(outputJarFile, resultMappings)
|
||||
}
|
||||
|
||||
private data class AtlasOutput(
|
||||
val outputJar: Path,
|
||||
val outputMappings: MappingSet
|
||||
)
|
||||
|
||||
companion object {
|
||||
fun using(workerExecutor: WorkerExecutor) = AtlasHelper(workerExecutor)
|
||||
}
|
||||
|
||||
abstract class AtlasRunner : WorkAction<AtlasParameters> {
|
||||
override fun execute() {
|
||||
val mappings = MappingFormats.TINY.read(parameters.mappingsFile.path, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
|
||||
Atlas().let { atlas ->
|
||||
atlas.install { ctx -> JarEntryRemappingTransformer(LorenzRemapper(mappings, ctx.inheritanceProvider())) }
|
||||
atlas.run(parameters.inputJar.path, parameters.outputJar.path)
|
||||
}
|
||||
|
||||
MappingFormats.TINY.write(mappings, parameters.outputMappingsFile.path, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
}
|
||||
}
|
||||
|
||||
interface AtlasParameters : WorkParameters {
|
||||
val inputJar: RegularFileProperty
|
||||
val outputJar: RegularFileProperty
|
||||
val mappingsFile: RegularFileProperty
|
||||
val outputMappingsFile: RegularFileProperty
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -49,6 +49,7 @@ object Constants {
|
|||
const val MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/official-mojang+yarn.tiny"
|
||||
const val SPIGOT_MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn.tiny"
|
||||
const val PATCHED_SPIGOT_MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn-patch.tiny"
|
||||
const val PATCHED_MOJANG_YARN_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/mojang+yarn-spigot-patch.tiny"
|
||||
|
||||
const val OBF_NAMESPACE = "official"
|
||||
const val SPIGOT_NAMESPACE = "spigot"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -23,16 +23,15 @@
|
|||
package io.papermc.paperweight.util
|
||||
|
||||
import net.fabricmc.lorenztiny.TinyMappingFormat
|
||||
import org.cadixdev.lorenz.io.proguard.ProGuardFormat
|
||||
import org.cadixdev.lorenz.io.srg.csrg.CSrgMappingFormat
|
||||
import org.cadixdev.lorenz.io.MappingFormat
|
||||
import org.cadixdev.lorenz.io.MappingFormats as Formats
|
||||
|
||||
/*
|
||||
* Since we shade our dependencies into a single jar the service locator doens't work,
|
||||
* so we just have our own references to the formats
|
||||
* One place for all of the formats we use
|
||||
*/
|
||||
object MappingFormats {
|
||||
|
||||
val TINY = TinyMappingFormat.STANDARD
|
||||
val CSRG = CSrgMappingFormat()
|
||||
val PROGUARD = ProGuardFormat()
|
||||
val CSRG: MappingFormat = Formats.CSRG
|
||||
val PROGUARD: MappingFormat = Formats.byId("proguard")
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
@ -37,6 +37,7 @@ import java.nio.file.Path
|
|||
import java.util.Optional
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KProperty
|
||||
import org.cadixdev.lorenz.merge.MergeResult
|
||||
import org.cadixdev.lorenz.model.ClassMapping
|
||||
import org.cadixdev.lorenz.model.MemberMapping
|
||||
import org.gradle.api.Project
|
||||
|
@ -157,6 +158,12 @@ inline fun <reified T : Any> Project.contents(contentFile: Any, crossinline conv
|
|||
val MemberMapping<*, *>.parentClass: ClassMapping<*, *>
|
||||
get() = parent as ClassMapping<*, *>
|
||||
|
||||
private val emptyMergeResult = MergeResult(null)
|
||||
fun <T> emptyMergeResult(): MergeResult<T?> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return emptyMergeResult as MergeResult<T?>
|
||||
}
|
||||
|
||||
// We have to create our own task delegate because the ones Gradle provides don't work in plugin dev environments
|
||||
inline fun <reified T : Task> TaskContainer.registering(noinline configure: T.() -> Unit): TaskDelegateProvider<T> {
|
||||
return TaskDelegateProvider(this, T::class, configure)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project. It uses
|
||||
* some code and systems originally from ForgeGradle.
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (C) 2020 Kyle Wood
|
||||
* Copyright (c) 2020 Kyle Wood (DemonWav)
|
||||
* Contributors
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 only, no later versions.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
|
Loading…
Reference in a new issue