Merge branch 'proximyst' into testing/hypo
This commit is contained in:
commit
7d200300c2
6 changed files with 22 additions and 14 deletions
|
@ -93,7 +93,7 @@ dependencies {
|
|||
shade("org.cadixdev:lorenz-io-proguard:$lorenzVersion")
|
||||
shade("org.cadixdev:atlas:0.2.0")
|
||||
shade("org.cadixdev:at:0.1.0-rc1")
|
||||
shade("org.cadixdev:mercury:0.1.0-rc2-PW-SNAPSHOT")
|
||||
shade("org.cadixdev:mercury:0.1.0-rc2-SNAPSHOT")
|
||||
|
||||
shade("net.fabricmc:lorenz-tiny:3.0.0")
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ class Paperweight : Plugin<Project> {
|
|||
}
|
||||
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
return createBuildTasks(parent.ext, spigotTasks)
|
||||
return createBuildTasks(parent, spigotTasks)
|
||||
}
|
||||
|
||||
private fun Project.createTasks(): TaskContainers {
|
||||
|
@ -323,7 +323,7 @@ class Paperweight : Plugin<Project> {
|
|||
|
||||
val filterVanillaJar by tasks.registering<FilterJar> {
|
||||
inputJar.set(downloadServerJar.flatMap { it.outputJar })
|
||||
includes.set(listOf("/*.class", "/net/minecraft/**"))
|
||||
includes.set(listOf("/*.class", "/net/minecraft/**", "/com/mojang/math/**"))
|
||||
}
|
||||
|
||||
return GeneralTasks(buildDataInfo, downloadServerJar, filterVanillaJar)
|
||||
|
@ -450,7 +450,7 @@ class Paperweight : Plugin<Project> {
|
|||
|
||||
val patchCraftBukkit by tasks.registering<ApplyDiffPatches> {
|
||||
sourceJar.set(spigotDecompileJar.flatMap { it.outputJar })
|
||||
sourceBasePath.set("net/minecraft/server")
|
||||
sourceBasePath.set(".")
|
||||
branch.set("patched")
|
||||
patchDir.set(extension.craftBukkit.patchDir)
|
||||
|
||||
|
@ -523,7 +523,7 @@ class Paperweight : Plugin<Project> {
|
|||
)
|
||||
}
|
||||
|
||||
private fun Project.createBuildTasks(ext: PaperweightExtension, spigotTasks: SpigotTasks): TaskProvider<RemapJar> {
|
||||
private fun Project.createBuildTasks(parent: Project, spigotTasks: SpigotTasks): TaskProvider<RemapJar> {
|
||||
val shadowJar: TaskProvider<Jar> = tasks.named("shadowJar", Jar::class.java)
|
||||
|
||||
val reobfJar by tasks.registering<RemapJar> {
|
||||
|
@ -531,7 +531,6 @@ class Paperweight : Plugin<Project> {
|
|||
inputJar.fileProvider(shadowJar.map { it.outputs.files.singleFile })
|
||||
|
||||
mappingsFile.set(spigotTasks.patchMappings.flatMap { it.outputMappings })
|
||||
// packageVersion.set(ext.versionPackage)
|
||||
fromNamespace.set(Constants.DEOBF_NAMESPACE)
|
||||
toNamespace.set(Constants.SPIGOT_NAMESPACE)
|
||||
remapper.fileProvider(rootProject.configurations.named(Constants.REMAPPER_CONFIG).map { it.singleFile })
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.ext
|
||||
|
||||
import java.io.File
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
@ -35,3 +36,6 @@ fun ObjectFactory.dirFrom(base: DirectoryProperty, name: String): DirectoryPrope
|
|||
|
||||
fun ObjectFactory.fileFrom(base: DirectoryProperty, name: String): RegularFileProperty =
|
||||
fileProperty().convention(base.file(name))
|
||||
|
||||
fun File.listFilesRecursively(): Set<File>? =
|
||||
listFiles()?.flatMapTo(mutableSetOf()) { setOf(it) + (it.listFilesRecursively() ?: emptySet()) }
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.ext.listFilesRecursively
|
||||
import io.papermc.paperweight.util.Command
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.UselessOutputStream
|
||||
|
@ -71,9 +72,9 @@ abstract class ApplyDiffPatches : ControllableOutputTask() {
|
|||
val outputDirFile = basePatchDirFile.resolve(sourceBasePath.get())
|
||||
outputDirFile.deleteRecursively()
|
||||
|
||||
val patchList = patchDir.file.listFiles() ?: throw PaperweightException(
|
||||
"Patch directory does not exist ${patchDir.file}"
|
||||
)
|
||||
val patchList = patchDir.file.listFilesRecursively()
|
||||
?.filter { it.isFile }
|
||||
?: throw PaperweightException("Patch directory does not exist ${patchDir.file}")
|
||||
if (patchList.isEmpty()) {
|
||||
throw PaperweightException("No patch files found in ${patchDir.file}")
|
||||
}
|
||||
|
@ -82,7 +83,7 @@ abstract class ApplyDiffPatches : ControllableOutputTask() {
|
|||
val uri = URI.create("jar:" + sourceJar.file.toURI())
|
||||
FileSystems.newFileSystem(uri, mapOf<String, Any>()).use { fs ->
|
||||
for (file in patchList) {
|
||||
val javaName = file.name.replaceAfterLast('.', "java")
|
||||
val javaName = file.toRelativeString(patchDir.file).replaceAfterLast('.', "java")
|
||||
val out = outputDirFile.resolve(javaName)
|
||||
val sourcePath = fs.getPath(sourceBasePath.get(), javaName)
|
||||
|
||||
|
@ -100,7 +101,7 @@ abstract class ApplyDiffPatches : ControllableOutputTask() {
|
|||
|
||||
// Apply patches
|
||||
for (file in patchList) {
|
||||
val javaName = file.name.replaceAfterLast('.', "java")
|
||||
val javaName = file.toRelativeString(patchDir.file).replaceAfterLast('.', "java")
|
||||
|
||||
if (printOutput.get()) {
|
||||
println("Patching ${javaName.removeSuffix(".java")}")
|
||||
|
|
|
@ -25,6 +25,8 @@ package io.papermc.paperweight.tasks
|
|||
import io.papermc.paperweight.util.Constants.paperTaskOutput
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.ensureParentExists
|
||||
import io.papermc.paperweight.util.file
|
||||
import io.papermc.paperweight.util.runJar
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
@ -71,7 +73,7 @@ abstract class RemapJar : BaseTask() {
|
|||
@TaskAction
|
||||
fun run() {
|
||||
val logFile = layout.cache.resolve(paperTaskOutput("log"))
|
||||
logFile.delete()
|
||||
ensureDeleted(logFile)
|
||||
|
||||
val args = mutableListOf(
|
||||
inputJar.file.absolutePath,
|
||||
|
@ -88,6 +90,8 @@ abstract class RemapJar : BaseTask() {
|
|||
if (rebuildSourceFilenames.get()) {
|
||||
args += "--rebuildsourcefilenames"
|
||||
}
|
||||
|
||||
ensureParentExists(logFile)
|
||||
runJar(remapper, layout.cache, logFile, jvmArgs = listOf("-Xmx512m"), args = *args.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ abstract class RemapJarAtlas : BaseTask() {
|
|||
override fun execute() {
|
||||
val mappings = MappingFormats.TINY.read(parameters.mappingsFile.path, parameters.fromNamespace.get(), parameters.toNamespace.get())
|
||||
|
||||
val oldPack = "net/minecraft/server"
|
||||
val newPack = "$oldPack/v${parameters.packageVersion.get()}"
|
||||
val oldPack = "net/minecraft"
|
||||
val newPack = "$oldPack/server/v${parameters.packageVersion.get()}"
|
||||
Atlas().let { atlas ->
|
||||
atlas.install { ctx -> JarEntryRemappingTransformer(LorenzRemapper(mappings, ctx.inheritanceProvider())) }
|
||||
atlas.install { JarEntryRemappingTransformer(PackageRemapper(oldPack, newPack)) }
|
||||
|
|
Loading…
Reference in a new issue