Run Mercury in a separate process for memory issues

This allows paperweight to work without requiring the daemon to have
more memory.
This commit is contained in:
Kyle Wood 2020-11-14 19:55:47 -08:00
parent 02e23a178c
commit d0c03da648
25 changed files with 190 additions and 126 deletions

View file

@ -74,6 +74,7 @@ import io.papermc.paperweight.util.ext
import io.papermc.paperweight.util.fromJson
import io.papermc.paperweight.util.gson
import io.papermc.paperweight.util.registering
import java.io.File
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
@ -82,7 +83,6 @@ import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.register
import java.io.File
class Paperweight : Plugin<Project> {
override fun apply(target: Project) {
@ -454,8 +454,7 @@ class Paperweight : Plugin<Project> {
dependsOn(patchSpigot)
apiPom.set(patchSpigotApi.flatMap { it.outputDir.file("pom.xml") })
serverPom.set(patchSpigotServer.flatMap { it.outputDir.file("pom.xml") })
apiOutputDir.set(cache.resolve(Constants.SPIGOT_API_JARS_PATH))
serverOutputDir.set(cache.resolve(Constants.SPIGOT_SERVER_JARS_PATH))
outputDir.set(cache.resolve(Constants.SPIGOT_JARS_PATH))
}
val remapSpigotAt by tasks.registering<RemapSpigotAt> {
@ -470,8 +469,7 @@ class Paperweight : Plugin<Project> {
mappings.set(generateSpigotSrgs.flatMap { it.spigotToSrg })
vanillaJar.set(downloadServerJar.flatMap { it.outputJar })
vanillaRemappedSpigotJar.set(removeSpigotExcludes.flatMap { it.outputZip })
spigotApiDeps.set(downloadSpigotDependencies.flatMap { it.apiOutputDir })
spigotServerDeps.set(downloadSpigotDependencies.flatMap { it.serverOutputDir })
spigotDeps.set(downloadSpigotDependencies.flatMap { it.outputDir })
constructors.set(initialTasks.extractMcp.flatMap { it.constructors })
}

View file

@ -25,12 +25,12 @@ package io.papermc.paperweight.tasks
import io.papermc.paperweight.util.defaultOutput
import io.papermc.paperweight.util.file
import io.papermc.paperweight.util.fileOrNull
import java.io.File
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
abstract class AddMissingSpigotClassMappings : BaseTask() {

View file

@ -28,6 +28,10 @@ import io.papermc.paperweight.util.Git
import io.papermc.paperweight.util.UselessOutputStream
import io.papermc.paperweight.util.ensureParentExists
import io.papermc.paperweight.util.file
import java.net.URI
import java.nio.file.FileSystems
import java.nio.file.Files
import java.util.Date
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
@ -36,10 +40,6 @@ import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import java.net.URI
import java.nio.file.FileSystems
import java.nio.file.Files
import java.util.Date
abstract class ApplyDiffPatches : ControllableOutputTask() {

View file

@ -25,6 +25,7 @@ package io.papermc.paperweight.tasks
import io.papermc.paperweight.PaperweightException
import io.papermc.paperweight.util.Git
import io.papermc.paperweight.util.file
import java.io.File
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
@ -32,7 +33,6 @@ import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.gradle.internal.os.OperatingSystem
import java.io.File
abstract class ApplyGitPatches : ControllableOutputTask() {

View file

@ -23,11 +23,11 @@
package io.papermc.paperweight.tasks
import io.papermc.paperweight.util.Git
import java.io.File
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFile
import java.io.File
abstract class ApplyMcpPatches : ZippedTask() {

View file

@ -22,13 +22,19 @@
package io.papermc.paperweight.tasks
import io.papermc.paperweight.util.file
import io.papermc.paperweight.util.path
import java.io.File
import javax.inject.Inject
import org.cadixdev.at.io.AccessTransformFormats
import org.cadixdev.mercury.Mercury
import org.cadixdev.mercury.at.AccessTransformerRewriter
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.InputFile
import java.io.File
import org.gradle.workers.WorkAction
import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
abstract class ApplySourceAt : ZippedTask() {
@ -39,43 +45,70 @@ abstract class ApplySourceAt : ZippedTask() {
@get:InputFile
abstract val atFile: RegularFileProperty
@get:Inject
abstract val workerExecutor: WorkerExecutor
override fun run(rootDir: File) {
val inputDir = rootDir.resolve("input")
val outputDir = rootDir.resolve("output")
val input = rootDir.resolve("input")
val output = rootDir.resolve("output")
// Move everything into `input/` so we can put output into `output/`
inputDir.mkdirs()
input.mkdirs()
rootDir.listFiles()?.forEach { file ->
if (file != inputDir) {
file.renameTo(inputDir.resolve(file.name))
if (file != input) {
file.renameTo(input.resolve(file.name))
}
}
outputDir.mkdirs()
output.mkdirs()
val at = AccessTransformFormats.FML.read(atFile.path)
Mercury().let { merc ->
merc.classPath.addAll(listOf(
vanillaJar.path,
vanillaRemappedSrgJar.path
))
merc.processors.add(AccessTransformerRewriter.create(at))
merc.rewrite(inputDir.toPath(), outputDir.toPath())
val queue = workerExecutor.processIsolation {
forkOptions.jvmArgs("-Xmx2G")
}
queue.submit(AtAction::class.java) {
classpath.add(vanillaJar.file)
classpath.add(vanillaRemappedSrgJar.file)
at.set(atFile.file)
inputDir.set(input)
outputDir.set(output)
}
queue.await()
// Remove input files
rootDir.listFiles()?.forEach { file ->
if (file != outputDir) {
if (file != output) {
file.deleteRecursively()
}
}
// Move output into root
outputDir.listFiles()?.forEach { file ->
output.listFiles()?.forEach { file ->
file.renameTo(rootDir.resolve(file.name))
}
outputDir.delete()
output.delete()
}
abstract class AtAction : WorkAction<AtParams> {
override fun execute() {
val at = AccessTransformFormats.FML.read(parameters.at.path)
Mercury().let { merc ->
merc.classPath.addAll(parameters.classpath.get().map { it.toPath() })
merc.processors.add(AccessTransformerRewriter.create(at))
merc.rewrite(parameters.inputDir.path, parameters.outputDir.path)
}
}
}
interface AtParams : WorkParameters {
val classpath: ListProperty<File>
val at: RegularFileProperty
val inputDir: RegularFileProperty
val outputDir: RegularFileProperty
}
}

View file

@ -22,12 +22,12 @@
package io.papermc.paperweight.tasks
import javax.inject.Inject
import org.gradle.api.DefaultTask
import org.gradle.api.file.ArchiveOperations
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.ProjectLayout
import org.gradle.api.model.ObjectFactory
import javax.inject.Inject
abstract class BaseTask : DefaultTask() {

View file

@ -28,13 +28,13 @@ import io.papermc.paperweight.util.cache
import io.papermc.paperweight.util.defaultOutput
import io.papermc.paperweight.util.ensureDeleted
import io.papermc.paperweight.util.runJar
import java.util.concurrent.ThreadLocalRandom
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 java.util.concurrent.ThreadLocalRandom
abstract class DecompileVanillaJar : BaseTask() {

View file

@ -25,13 +25,13 @@ package io.papermc.paperweight.tasks
import io.papermc.paperweight.PaperweightException
import io.papermc.paperweight.util.defaultOutput
import io.papermc.paperweight.util.download
import java.math.BigInteger
import java.security.MessageDigest
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.math.BigInteger
import java.security.MessageDigest
abstract class DownloadServerJar : BaseTask() {

View file

@ -23,9 +23,9 @@
package io.papermc.paperweight.tasks
import io.papermc.paperweight.util.file
import java.io.File
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import java.io.File
/**
* Because Spigot doesn't remap all classes, there are class and package name clashes if we don't do this in the source

View file

@ -22,13 +22,13 @@
package io.papermc.paperweight.tasks
import java.io.PrintWriter
import java.util.regex.Pattern
import org.gradle.api.DefaultTask
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 java.io.PrintWriter
import java.util.regex.Pattern
abstract class PatchMcpCsv : DefaultTask() {

View file

@ -24,6 +24,7 @@ package io.papermc.paperweight.tasks
import io.papermc.paperweight.util.defaultOutput
import io.papermc.paperweight.util.file
import java.util.jar.JarFile
import org.cadixdev.at.AccessChange
import org.cadixdev.at.AccessTransform
import org.cadixdev.at.AccessTransformSet
@ -36,7 +37,6 @@ 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 java.util.jar.JarFile
abstract class RemapSpigotAt : BaseTask() {

View file

@ -24,12 +24,12 @@ package io.papermc.paperweight.tasks
import io.papermc.paperweight.PaperweightException
import io.papermc.paperweight.util.getCsvReader
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import java.io.BufferedReader
import java.io.BufferedWriter
import java.io.File
import java.util.regex.Pattern
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
abstract class RemapSrgSources : ZippedTask() {

View file

@ -51,7 +51,9 @@ abstract class WriteLibrariesFile : BaseTask() {
outputFile.file.delete()
outputFile.file.bufferedWriter().use { writer ->
for (file in files) {
writer.appendln("-e=${file.absolutePath}")
if (file.name.endsWith(".jar")) {
writer.appendln("-e=${file.absolutePath}")
}
}
}
}

View file

@ -28,13 +28,13 @@ import io.papermc.paperweight.util.file
import io.papermc.paperweight.util.fileOrNull
import io.papermc.paperweight.util.unzip
import io.papermc.paperweight.util.zip
import java.io.File
import java.util.concurrent.ThreadLocalRandom
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
import java.util.concurrent.ThreadLocalRandom
abstract class ZippedTask : BaseTask() {

View file

@ -32,6 +32,9 @@ import io.papermc.paperweight.util.fromJson
import io.papermc.paperweight.util.gson
import io.papermc.paperweight.util.mcinject
import io.papermc.paperweight.util.rename
import java.io.File
import javax.inject.Inject
import javax.xml.parsers.DocumentBuilderFactory
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.ProjectLayout
@ -47,9 +50,6 @@ import org.gradle.workers.WorkAction
import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
import org.w3c.dom.Element
import java.io.File
import javax.inject.Inject
import javax.xml.parsers.DocumentBuilderFactory
abstract class DownloadTask : DefaultTask() {
@ -182,9 +182,7 @@ abstract class DownloadSpigotDependencies : BaseTask() {
abstract val serverPom: RegularFileProperty
@get:OutputDirectory
abstract val apiOutputDir: DirectoryProperty
@get:OutputDirectory
abstract val serverOutputDir: DirectoryProperty
abstract val outputDir: DirectoryProperty
@get:Inject
abstract val workerExecutor: WorkerExecutor
@ -194,26 +192,23 @@ abstract class DownloadSpigotDependencies : BaseTask() {
val apiSetup = parsePom(apiPom.file)
val serverSetup = parsePom(serverPom.file)
val apiOut = apiOutputDir.file
apiOut.deleteRecursively()
val out = outputDir.file
out.deleteRecursively()
val serverOut = serverOutputDir.file
serverOut.deleteRecursively()
val spigotRepos = mutableSetOf<String>()
spigotRepos += apiSetup.repos
spigotRepos += serverSetup.repos
val artifacts = mutableSetOf<MavenArtifact>()
artifacts += apiSetup.artifacts
artifacts += serverSetup.artifacts
val queue = workerExecutor.noIsolation()
for (art in apiSetup.artifacts) {
for (art in artifacts) {
queue.submit(DownloadWorker::class.java) {
repos.set(apiSetup.repos)
repos.set(spigotRepos)
artifact.set(art.toString())
target.set(apiOut)
downloadToDir.set(true)
}
}
for (art in serverSetup.artifacts) {
queue.submit(DownloadWorker::class.java) {
repos.set(serverSetup.repos)
artifact.set(art.toString())
target.set(serverOut)
target.set(out)
downloadToDir.set(true)
}
}

View file

@ -26,13 +26,13 @@ import io.papermc.paperweight.util.McpConfig
import io.papermc.paperweight.util.file
import io.papermc.paperweight.util.fromJson
import io.papermc.paperweight.util.gson
import java.io.File
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
abstract class Extract : BaseTask() {

View file

@ -26,11 +26,11 @@ import io.papermc.paperweight.tasks.sourceremap.ConstructorsData
import io.papermc.paperweight.tasks.sourceremap.ParamNames
import io.papermc.paperweight.tasks.sourceremap.PatchParameterRemapper
import io.papermc.paperweight.tasks.sourceremap.SrgParameterRemapper
import java.nio.file.Files
import java.nio.file.Path
import org.cadixdev.lorenz.MappingSet
import org.cadixdev.mercury.Mercury
import org.cadixdev.mercury.remapper.MercuryRemapper
import java.nio.file.Files
import java.nio.file.Path
class PatchSourceRemapWorker(
private val mappings: MappingSet,

View file

@ -28,6 +28,8 @@ import io.papermc.paperweight.tasks.sourceremap.parseParamNames
import io.papermc.paperweight.util.Git
import io.papermc.paperweight.util.cache
import io.papermc.paperweight.util.file
import java.io.File
import java.util.zip.ZipFile
import org.cadixdev.lorenz.io.MappingFormats
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFile
@ -39,8 +41,6 @@ import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.gradle.kotlin.dsl.get
import java.io.File
import java.util.zip.ZipFile
abstract class RemapPatches : BaseTask() {

View file

@ -26,6 +26,8 @@ import io.papermc.paperweight.tasks.ZippedTask
import io.papermc.paperweight.util.defaultOutput
import io.papermc.paperweight.util.file
import io.papermc.paperweight.util.path
import java.io.File
import javax.inject.Inject
import org.cadixdev.at.AccessTransformSet
import org.cadixdev.at.io.AccessTransformFormats
import org.cadixdev.lorenz.io.MappingFormats
@ -36,10 +38,13 @@ import org.cadixdev.mercury.extra.BridgeMethodRewriter
import org.cadixdev.mercury.remapper.MercuryRemapper
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import java.io.File
import org.gradle.workers.WorkAction
import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
abstract class RemapSources : ZippedTask() {
@ -51,9 +56,7 @@ abstract class RemapSources : ZippedTask() {
abstract val mappings: RegularFileProperty
@get:InputDirectory
abstract val spigotApiDeps: DirectoryProperty
@get:InputDirectory
abstract val spigotServerDeps: DirectoryProperty
abstract val spigotDeps: DirectoryProperty
@get:InputFile
abstract val constructors: RegularFileProperty
@ -67,6 +70,9 @@ abstract class RemapSources : ZippedTask() {
@get:OutputFile
abstract val parameterNames: RegularFileProperty
@get:Inject
abstract val workerExecutor: WorkerExecutor
override fun init() {
super.init()
generatedAt.convention(defaultOutput("at"))
@ -74,41 +80,71 @@ abstract class RemapSources : ZippedTask() {
}
override fun run(rootDir: File) {
val constructorsData = parseConstructors(constructors.file)
val paramNames: ParamNames = newParamNames()
val srcDir = spigotServerDir.file.resolve("src/main/java")
val mappingSet = MappingFormats.TSRG.read(mappings.path)
val processAt = AccessTransformSet.create()
// Remap any references Spigot maps to SRG
Mercury().let { merc ->
merc.classPath.addAll(listOf(
vanillaJar.path,
vanillaRemappedSpigotJar.path,
spigotApiDir.path.resolve("src/main/java"),
*spigotApiDeps.get().asFileTree.files.map { it.toPath() }.toTypedArray(),
*spigotServerDeps.get().asFileTree.files.map { it.toPath() }.toTypedArray()
))
merc.processors += AccessAnalyzerProcessor.create(processAt, mappingSet)
merc.process(srcDir.toPath())
merc.processors.clear()
merc.processors.addAll(listOf(
MercuryRemapper.create(mappingSet),
BridgeMethodRewriter.create(),
AccessTransformerRewriter.create(processAt),
SrgParameterRemapper(mappingSet, constructorsData, paramNames)
))
merc.rewrite(srcDir.toPath(), rootDir.toPath())
val queue = workerExecutor.processIsolation {
forkOptions.jvmArgs("-Xmx2G")
}
AccessTransformFormats.FML.write(generatedAt.path, processAt)
writeParamNames(paramNames, parameterNames.file)
queue.submit(RemapAction::class.java) {
classpath.add(vanillaJar.file)
classpath.add(vanillaRemappedSpigotJar.file)
classpath.add(spigotApiDir.dir("src/main/java").get().asFile)
classpath.addAll(spigotDeps.get().asFileTree.filter { it.name.endsWith(".jar") }.files)
mappings.set(this@RemapSources.mappings.file)
constructors.set(this@RemapSources.constructors.file)
inputDir.set(srcDir)
outputDir.set(rootDir)
generatedAtOutput.set(generatedAt.file)
paramNamesOutput.set(parameterNames.file)
}
queue.await()
}
abstract class RemapAction : WorkAction<RemapParams> {
override fun execute() {
val mappingSet = MappingFormats.TSRG.read(parameters.mappings.path)
val processAt = AccessTransformSet.create()
val constructorsData = parseConstructors(parameters.constructors.file)
val paramNames: ParamNames = newParamNames()
// Remap any references Spigot maps to SRG
Mercury().let { merc ->
merc.classPath.addAll(parameters.classpath.get().map { it.toPath() })
merc.processors += AccessAnalyzerProcessor.create(processAt, mappingSet)
merc.process(parameters.inputDir.path)
merc.processors.clear()
merc.processors.addAll(listOf(
MercuryRemapper.create(mappingSet),
BridgeMethodRewriter.create(),
AccessTransformerRewriter.create(processAt),
SrgParameterRemapper(mappingSet, constructorsData, paramNames)
))
merc.rewrite(parameters.inputDir.path, parameters.outputDir.path)
}
AccessTransformFormats.FML.write(parameters.generatedAtOutput.path, processAt)
writeParamNames(paramNames, parameters.paramNamesOutput.file)
}
}
interface RemapParams : WorkParameters {
val classpath: ListProperty<File>
val mappings: RegularFileProperty
val constructors: RegularFileProperty
val inputDir: RegularFileProperty
val generatedAtOutput: RegularFileProperty
val outputDir: RegularFileProperty
val paramNamesOutput: RegularFileProperty
}
}

View file

@ -38,9 +38,7 @@ object Constants {
const val MINECRAFT_JARS_PATH = "$JARS_PATH/minecraft"
const val MCP_TOOLS_PATH = "$JARS_PATH/tools"
const val MCP_ZIPS_PATH = "$JARS_PATH/mcp"
private const val SPIGOT_JARS_PATH = "$JARS_PATH/spigot"
const val SPIGOT_API_JARS_PATH = "$SPIGOT_JARS_PATH/api"
const val SPIGOT_SERVER_JARS_PATH = "$SPIGOT_JARS_PATH/server"
const val SPIGOT_JARS_PATH = "$JARS_PATH/spigot"
const val MCP_DATA_DIR = "mcp/data"
const val MCP_MAPPINGS_DIR = "mcp/mappings"

View file

@ -25,7 +25,7 @@ package io.papermc.paperweight.util
import io.papermc.paperweight.PaperweightException
import java.io.File
class MavenArtifact(
data class MavenArtifact(
private val group: String,
private val artifact: String,
private val version: String,

View file

@ -23,6 +23,12 @@
package io.papermc.paperweight.util
import io.papermc.paperweight.PaperweightException
import java.io.File
import java.net.URI
import java.net.URL
import java.time.Instant
import java.time.format.DateTimeFormatter
import java.util.concurrent.TimeUnit
import org.apache.http.HttpHost
import org.apache.http.HttpStatus
import org.apache.http.client.config.CookieSpecs
@ -32,11 +38,6 @@ import org.apache.http.client.methods.HttpGet
import org.apache.http.client.utils.DateUtils
import org.apache.http.impl.client.HttpClientBuilder
import org.gradle.api.provider.Provider
import java.io.File
import java.net.URI
import java.net.URL
import java.util.Date
import java.util.concurrent.TimeUnit
fun download(source: Any, target: Any) {
val url = source.convertToUrl()
@ -72,7 +73,8 @@ private fun download(source: URL, target: File) {
.build()
if (time > 0) {
httpGet.setHeader("If-Modified-Since", DateUtils.formatDate(Date(time)))
val value = DateTimeFormatter.RFC_1123_DATE_TIME.format(Instant.ofEpochMilli(time))
httpGet.setHeader("If-Modified-Since", value)
}
if (etag != null) {
httpGet.setHeader("If-None-Match", etag)

View file

@ -23,8 +23,8 @@
package io.papermc.paperweight.util
import io.papermc.paperweight.PaperweightException
import org.gradle.internal.jvm.Jvm
import java.io.OutputStream
import org.gradle.internal.jvm.Jvm
fun runJar(jar: Any, workingDir: Any, logFile: Any?, jvmArgs: List<String> = listOf(), vararg args: String) {
val jarFile = jar.convertToFile()

View file

@ -30,6 +30,13 @@ import io.papermc.paperweight.PaperweightException
import io.papermc.paperweight.ext.PaperweightExtension
import io.papermc.paperweight.tasks.BaseTask
import io.papermc.paperweight.util.Constants.paperTaskOutput
import java.io.File
import java.io.InputStream
import java.io.OutputStream
import java.nio.file.Path
import java.util.Optional
import kotlin.reflect.KClass
import kotlin.reflect.KProperty
import org.cadixdev.lorenz.MappingSet
import org.cadixdev.lorenz.io.TextMappingFormat
import org.gradle.api.Project
@ -41,13 +48,6 @@ import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.TaskProvider
import java.io.File
import java.io.InputStream
import java.io.OutputStream
import java.nio.file.Path
import java.util.Optional
import kotlin.reflect.KClass
import kotlin.reflect.KProperty
val gson: Gson = Gson()