Move constants into a package for wildcard import support
Also add more entries in .editorconfig to help IntelliJ, and explicitly list which packages should always have wildcard imports.
This commit is contained in:
parent
00db3813d5
commit
f5d09e8d1d
75 changed files with 421 additions and 612 deletions
|
@ -1,4 +1,85 @@
|
|||
[*.{kt,kts}]
|
||||
max_line_length=150
|
||||
# noinspection EditorConfigKeyCorrectness
|
||||
kotlin_imports_layout=ascii
|
||||
[*.{kt,kts}]
|
||||
max_line_length = 150
|
||||
kotlin_imports_layout = ascii
|
||||
no-wildcard-imports = no-wildcard-imports
|
||||
ij_continuation_indent_size = 4
|
||||
ij_kotlin_packages_to_use_import_on_demand = io.papermc.paperweight.util.**, io.papermc.paperweight.tasks.*, org.gradle.kotlin.dsl.*, kotlin.io.path.*
|
||||
ij_kotlin_parameter_annotation_wrap = off
|
||||
ij_kotlin_space_after_comma = true
|
||||
ij_kotlin_space_after_extend_colon = true
|
||||
ij_kotlin_space_after_type_colon = true
|
||||
ij_kotlin_space_before_catch_parentheses = true
|
||||
ij_kotlin_space_before_comma = false
|
||||
ij_kotlin_space_before_extend_colon = true
|
||||
ij_kotlin_space_before_for_parentheses = true
|
||||
ij_kotlin_space_before_if_parentheses = true
|
||||
ij_kotlin_space_before_lambda_arrow = true
|
||||
ij_kotlin_space_before_type_colon = false
|
||||
ij_kotlin_space_before_when_parentheses = true
|
||||
ij_kotlin_space_before_while_parentheses = true
|
||||
ij_kotlin_spaces_around_additive_operators = true
|
||||
ij_kotlin_spaces_around_assignment_operators = true
|
||||
ij_kotlin_spaces_around_equality_operators = true
|
||||
ij_kotlin_spaces_around_function_type_arrow = true
|
||||
ij_kotlin_spaces_around_logical_operators = true
|
||||
ij_kotlin_spaces_around_multiplicative_operators = true
|
||||
ij_kotlin_spaces_around_range = false
|
||||
ij_kotlin_spaces_around_relational_operators = true
|
||||
ij_kotlin_spaces_around_unary_operator = false
|
||||
ij_kotlin_spaces_around_when_arrow = true
|
||||
ij_kotlin_variable_annotation_wrap = off
|
||||
ij_kotlin_while_on_new_line = false
|
||||
ij_kotlin_wrap_elvis_expressions = 1
|
||||
ij_kotlin_wrap_expression_body_functions = 1
|
||||
ij_kotlin_wrap_first_method_in_call_chain = false
|
||||
ij_kotlin_name_count_to_use_star_import = 8
|
||||
ij_kotlin_name_count_to_use_star_import_for_members = 5
|
||||
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
|
||||
ij_kotlin_keep_blank_lines_before_right_brace = 2
|
||||
ij_kotlin_keep_blank_lines_in_code = 2
|
||||
ij_kotlin_keep_blank_lines_in_declarations = 2
|
||||
ij_kotlin_keep_first_column_comment = true
|
||||
ij_kotlin_keep_indents_on_empty_lines = false
|
||||
ij_kotlin_keep_line_breaks = true
|
||||
ij_kotlin_lbrace_on_next_line = false
|
||||
ij_kotlin_line_comment_add_space = false
|
||||
ij_kotlin_line_comment_at_first_column = true
|
||||
ij_kotlin_method_annotation_wrap = split_into_lines
|
||||
ij_kotlin_method_call_chain_wrap = normal
|
||||
ij_kotlin_method_parameters_new_line_after_left_paren = true
|
||||
ij_kotlin_method_parameters_right_paren_on_new_line = true
|
||||
ij_kotlin_method_parameters_wrap = on_every_item
|
||||
ij_kotlin_align_in_columns_case_branch = false
|
||||
ij_kotlin_align_multiline_binary_operation = false
|
||||
ij_kotlin_align_multiline_extends_list = false
|
||||
ij_kotlin_align_multiline_method_parentheses = false
|
||||
ij_kotlin_align_multiline_parameters = true
|
||||
ij_kotlin_align_multiline_parameters_in_calls = false
|
||||
ij_kotlin_allow_trailing_comma = false
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = false
|
||||
ij_kotlin_assignment_wrap = normal
|
||||
ij_kotlin_blank_lines_after_class_header = 0
|
||||
ij_kotlin_blank_lines_around_block_when_branches = 0
|
||||
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
|
||||
ij_kotlin_block_comment_at_first_column = true
|
||||
ij_kotlin_call_parameters_new_line_after_left_paren = true
|
||||
ij_kotlin_call_parameters_right_paren_on_new_line = true
|
||||
ij_kotlin_call_parameters_wrap = on_every_item
|
||||
ij_kotlin_catch_on_new_line = false
|
||||
ij_kotlin_class_annotation_wrap = split_into_lines
|
||||
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
|
||||
ij_kotlin_continuation_indent_for_chained_calls = false
|
||||
ij_kotlin_continuation_indent_for_expression_bodies = false
|
||||
ij_kotlin_continuation_indent_in_argument_lists = false
|
||||
ij_kotlin_continuation_indent_in_elvis = false
|
||||
ij_kotlin_continuation_indent_in_if_conditions = false
|
||||
ij_kotlin_continuation_indent_in_parameter_lists = false
|
||||
ij_kotlin_continuation_indent_in_supertype_lists = false
|
||||
ij_kotlin_else_on_new_line = false
|
||||
ij_kotlin_enum_constants_wrap = off
|
||||
ij_kotlin_extends_list_wrap = normal
|
||||
ij_kotlin_field_annotation_wrap = split_into_lines
|
||||
ij_kotlin_finally_on_new_line = false
|
||||
ij_kotlin_if_rparen_on_new_line = true
|
||||
ij_kotlin_import_nested_classes = false
|
||||
|
|
2
.github/workflows/deploy-snapshot.yml
vendored
2
.github/workflows/deploy-snapshot.yml
vendored
|
@ -1,7 +1,7 @@
|
|||
name: Deploy Snapshot
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
branches: [ 'main' ]
|
||||
paths-ignore:
|
||||
- 'license/*'
|
||||
- 'readme.md'
|
||||
|
|
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
|
@ -1,7 +1,7 @@
|
|||
name: Deploy
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
tags: [ 'v*' ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -1,9 +1,9 @@
|
|||
name: Test
|
||||
on:
|
||||
push:
|
||||
branches: ['*']
|
||||
branches: [ '*' ]
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
branches: [ '*' ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.artifacts.repositories.PasswordCredentials
|
||||
import org.gradle.api.publish.maven.MavenPom
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
|
||||
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
||||
import org.gradle.kotlin.dsl.credentials
|
||||
import org.gradle.kotlin.dsl.existing
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.getValue
|
||||
import org.gradle.kotlin.dsl.maven
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
import org.gradle.kotlin.dsl.registering
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
plugins {
|
||||
`maven-publish`
|
||||
|
@ -192,6 +179,7 @@ fun MavenPom.pomConfig() {
|
|||
fun version(): String {
|
||||
return project.version.toString()
|
||||
}
|
||||
|
||||
fun localVersion(): String {
|
||||
return if (isSnapshot) {
|
||||
version().substringBefore('-') + "-LOCAL-SNAPSHOT"
|
||||
|
|
|
@ -26,13 +26,10 @@ import io.papermc.paperweight.DownloadService
|
|||
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
|
||||
import io.papermc.paperweight.core.taskcontainers.AllTasks
|
||||
import io.papermc.paperweight.core.tasks.PaperweightCoreUpstreamData
|
||||
import io.papermc.paperweight.tasks.GeneratePaperclipPatch
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.tasks.patchremap.RemapPatches
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.initSubmodules
|
||||
import io.papermc.paperweight.util.registering
|
||||
import io.papermc.paperweight.util.setupServerProject
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.io.File
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
@ -43,7 +40,7 @@ import org.gradle.kotlin.dsl.*
|
|||
|
||||
class PaperweightCore : Plugin<Project> {
|
||||
override fun apply(target: Project) {
|
||||
val ext = target.extensions.create(Constants.EXTENSION, PaperweightCoreExtension::class)
|
||||
val ext = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightCoreExtension::class)
|
||||
|
||||
target.gradle.sharedServices.registerIfAbsent("download", DownloadService::class) {}
|
||||
|
||||
|
@ -57,15 +54,15 @@ class PaperweightCore : Plugin<Project> {
|
|||
// which are required for configuration
|
||||
target.layout.initSubmodules()
|
||||
|
||||
target.configurations.create(Constants.PARAM_MAPPINGS_CONFIG)
|
||||
target.configurations.create(Constants.REMAPPER_CONFIG)
|
||||
target.configurations.create(Constants.DECOMPILER_CONFIG)
|
||||
target.configurations.create(Constants.PAPERCLIP_CONFIG)
|
||||
target.configurations.create(PARAM_MAPPINGS_CONFIG)
|
||||
target.configurations.create(REMAPPER_CONFIG)
|
||||
target.configurations.create(DECOMPILER_CONFIG)
|
||||
target.configurations.create(PAPERCLIP_CONFIG)
|
||||
|
||||
val tasks = AllTasks(target)
|
||||
target.createPatchRemapTask(tasks)
|
||||
|
||||
target.tasks.register<PaperweightCoreUpstreamData>(Constants.PAPERWEIGHT_PREPARE_DOWNSTREAM) {
|
||||
target.tasks.register<PaperweightCoreUpstreamData>(PAPERWEIGHT_PREPARE_DOWNSTREAM) {
|
||||
dependsOn(tasks.applyPatches)
|
||||
vanillaJar.set(tasks.downloadServerJar.flatMap { it.outputJar })
|
||||
remappedJar.set(tasks.copyResources.flatMap { it.outputJar })
|
||||
|
@ -80,8 +77,8 @@ class PaperweightCore : Plugin<Project> {
|
|||
|
||||
dataFile.set(
|
||||
target.layout.file(
|
||||
providers.gradleProperty(Constants.PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY)
|
||||
.orElse(providers.gradleProperty(Constants.PAPERWEIGHT_PREPARE_DOWNSTREAM))
|
||||
providers.gradleProperty(PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY)
|
||||
.orElse(providers.gradleProperty(PAPERWEIGHT_PREPARE_DOWNSTREAM))
|
||||
.map { File(it) }
|
||||
)
|
||||
)
|
||||
|
@ -105,8 +102,8 @@ class PaperweightCore : Plugin<Project> {
|
|||
|
||||
val (_, reobfJar) = serverProj.setupServerProject(
|
||||
target,
|
||||
cache.resolve(Constants.FINAL_REMAPPED_JAR),
|
||||
cache.resolve(Constants.SERVER_LIBRARIES),
|
||||
cache.resolve(FINAL_REMAPPED_JAR),
|
||||
cache.resolve(SERVER_LIBRARIES),
|
||||
ext.paper.reobfPackagesToFix
|
||||
) {
|
||||
mappingsFile.set(tasks.patchReobfMappings.flatMap { it.outputMappings })
|
||||
|
@ -121,7 +118,7 @@ class PaperweightCore : Plugin<Project> {
|
|||
paperclipJar {
|
||||
with(target.tasks.named("jar", Jar::class).get())
|
||||
|
||||
val paperclipConfig = target.configurations.named(Constants.PAPERCLIP_CONFIG)
|
||||
val paperclipConfig = target.configurations.named(PAPERCLIP_CONFIG)
|
||||
dependsOn(paperclipConfig, generatePaperclipPatch)
|
||||
|
||||
val paperclipZip = target.zipTree(paperclipConfig.map { it.singleFile })
|
||||
|
|
|
@ -22,11 +22,8 @@
|
|||
|
||||
package io.papermc.paperweight.core.extension
|
||||
|
||||
import io.papermc.paperweight.util.dirFrom
|
||||
import io.papermc.paperweight.util.fileFrom
|
||||
import io.papermc.paperweight.util.path
|
||||
import kotlin.io.path.name
|
||||
import kotlin.io.path.useDirectoryEntries
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
|
|
|
@ -22,15 +22,13 @@
|
|||
|
||||
package io.papermc.paperweight.core.extension
|
||||
|
||||
import io.papermc.paperweight.util.dirFrom
|
||||
import io.papermc.paperweight.util.dirWithDefault
|
||||
import io.papermc.paperweight.util.fileFrom
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.kotlin.dsl.listProperty
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
open class PaperExtension(objects: ObjectFactory, layout: ProjectLayout) {
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
package io.papermc.paperweight.core.extension
|
||||
|
||||
import io.papermc.paperweight.util.dirWithDefault
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.kotlin.dsl.property
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
open class PaperweightCoreExtension(objects: ObjectFactory, layout: ProjectLayout) {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.core.extension
|
||||
|
||||
import io.papermc.paperweight.util.dirFrom
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
|
||||
|
|
|
@ -25,16 +25,12 @@ package io.papermc.paperweight.core.taskcontainers
|
|||
import io.papermc.paperweight.core.ext
|
||||
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.fileExists
|
||||
import io.papermc.paperweight.util.isBaseExecution
|
||||
import io.papermc.paperweight.util.registering
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Path
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
|
@ -60,11 +56,11 @@ open class AllTasks(
|
|||
vanillaJar.set(downloadServerJar.flatMap { it.outputJar })
|
||||
includes.set(listOf("/data/**", "/assets/**", "version.json", "yggdrasil_session_pubkey.der", "pack.mcmeta"))
|
||||
|
||||
outputJar.set(cache.resolve(Constants.FINAL_REMAPPED_JAR))
|
||||
outputJar.set(cache.resolve(FINAL_REMAPPED_JAR))
|
||||
}
|
||||
|
||||
val decompileJar by tasks.registering<RunForgeFlower> {
|
||||
executable.from(project.configurations.named(Constants.DECOMPILER_CONFIG))
|
||||
executable.from(project.configurations.named(DECOMPILER_CONFIG))
|
||||
|
||||
inputJar.set(copyResources.flatMap { it.outputJar })
|
||||
libraries.from(downloadMcLibraries.map { it.outputDir.asFileTree })
|
||||
|
@ -147,17 +143,17 @@ open class AllTasks(
|
|||
notchToSpigotMappings.set(generateSpigotMappings.flatMap { it.notchToSpigotMappings })
|
||||
sourceMappings.set(generateMappings.flatMap { it.outputMappings })
|
||||
|
||||
reobfMappings.set(cache.resolve(Constants.REOBF_MOJANG_SPIGOT_MAPPINGS))
|
||||
reobfMappings.set(cache.resolve(REOBF_MOJANG_SPIGOT_MAPPINGS))
|
||||
}
|
||||
|
||||
val patchReobfMappings by tasks.registering<PatchMappings> {
|
||||
inputMappings.set(generateReobfMappings.flatMap { it.reobfMappings })
|
||||
patch.set(extension.paper.reobfMappingsPatch.fileExists(project))
|
||||
|
||||
fromNamespace.set(Constants.DEOBF_NAMESPACE)
|
||||
toNamespace.set(Constants.SPIGOT_NAMESPACE)
|
||||
fromNamespace.set(DEOBF_NAMESPACE)
|
||||
toNamespace.set(SPIGOT_NAMESPACE)
|
||||
|
||||
outputMappings.set(cache.resolve(Constants.PATCHED_REOBF_MOJANG_SPIGOT_MAPPINGS))
|
||||
outputMappings.set(cache.resolve(PATCHED_REOBF_MOJANG_SPIGOT_MAPPINGS))
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
|
@ -165,6 +161,6 @@ open class AllTasks(
|
|||
group = "paper"
|
||||
source.set(decompileJar.flatMap { it.outputJar })
|
||||
paperServerDir.set(extension.paper.paperServerDir)
|
||||
target.set(cache.resolve(Constants.MC_DEV_DIR))
|
||||
target.set(cache.resolve(MC_DEV_DIR))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,7 @@ import io.papermc.paperweight.DownloadService
|
|||
import io.papermc.paperweight.core.ext
|
||||
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.BuildDataInfo
|
||||
import io.papermc.paperweight.util.contents
|
||||
import io.papermc.paperweight.util.download
|
||||
import io.papermc.paperweight.util.gson
|
||||
import io.papermc.paperweight.util.registering
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
|
|
|
@ -30,14 +30,8 @@ import io.papermc.paperweight.DownloadService
|
|||
import io.papermc.paperweight.core.ext
|
||||
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MinecraftManifest
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.download
|
||||
import io.papermc.paperweight.util.fromJson
|
||||
import io.papermc.paperweight.util.gson
|
||||
import io.papermc.paperweight.util.registering
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Path
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
|
@ -54,8 +48,8 @@ open class InitialTasks(
|
|||
) {
|
||||
|
||||
val downloadMcManifest by tasks.registering<DownloadTask> {
|
||||
url.set(Constants.MC_MANIFEST_URL)
|
||||
outputFile.set(cache.resolve(Constants.MC_MANIFEST))
|
||||
url.set(MC_MANIFEST_URL)
|
||||
outputFile.set(cache.resolve(MC_MANIFEST))
|
||||
|
||||
outputs.upToDateWhen { false }
|
||||
|
||||
|
@ -69,7 +63,7 @@ open class InitialTasks(
|
|||
manifest.versions.first { it.id == version }.url
|
||||
}
|
||||
)
|
||||
outputFile.set(cache.resolve(Constants.VERSION_JSON))
|
||||
outputFile.set(cache.resolve(VERSION_JSON))
|
||||
|
||||
downloader.set(downloadService)
|
||||
}
|
||||
|
@ -83,7 +77,7 @@ open class InitialTasks(
|
|||
}
|
||||
}
|
||||
)
|
||||
outputFile.set(cache.resolve(Constants.MC_LIBRARIES))
|
||||
outputFile.set(cache.resolve(MC_LIBRARIES))
|
||||
}
|
||||
|
||||
val downloadMappings by tasks.registering<DownloadTask> {
|
||||
|
@ -92,7 +86,7 @@ open class InitialTasks(
|
|||
version["downloads"]["server_mappings"]["url"].string
|
||||
}
|
||||
)
|
||||
outputFile.set(cache.resolve(Constants.SERVER_MAPPINGS))
|
||||
outputFile.set(cache.resolve(SERVER_MAPPINGS))
|
||||
|
||||
downloader.set(downloadService)
|
||||
}
|
||||
|
|
|
@ -26,12 +26,8 @@ import io.papermc.paperweight.DownloadService
|
|||
import io.papermc.paperweight.core.ext
|
||||
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.download
|
||||
import io.papermc.paperweight.util.fileExists
|
||||
import io.papermc.paperweight.util.registering
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Path
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
|
@ -61,7 +57,7 @@ open class SpigotTasks(
|
|||
libraries.from(downloadMcLibraries.map { it.outputDir.asFileTree })
|
||||
mcLibraries.set(setupMcLibraries.flatMap { it.outputFile })
|
||||
|
||||
serverLibraries.set(cache.resolve(Constants.SERVER_LIBRARIES))
|
||||
serverLibraries.set(cache.resolve(SERVER_LIBRARIES))
|
||||
}
|
||||
|
||||
val generateSpigotMappings by tasks.registering<GenerateSpigotMappings> {
|
||||
|
@ -73,9 +69,9 @@ open class SpigotTasks(
|
|||
|
||||
sourceMappings.set(generateMappings.flatMap { it.outputMappings })
|
||||
|
||||
outputMappings.set(cache.resolve(Constants.SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
notchToSpigotMappings.set(cache.resolve(Constants.OBF_SPIGOT_MAPPINGS))
|
||||
spigotFieldMappings.set(cache.resolve(Constants.SPIGOT_MOJANG_YARN_FIELDS_MAPPINGS))
|
||||
outputMappings.set(cache.resolve(SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
notchToSpigotMappings.set(cache.resolve(OBF_SPIGOT_MAPPINGS))
|
||||
spigotFieldMappings.set(cache.resolve(SPIGOT_MOJANG_YARN_FIELDS_MAPPINGS))
|
||||
}
|
||||
|
||||
val spigotRemapJar by tasks.registering<SpigotRemapJar> {
|
||||
|
@ -104,17 +100,17 @@ open class SpigotTasks(
|
|||
libraries.from(downloadMcLibraries.map { it.outputDir.asFileTree })
|
||||
inputMappings.set(generateSpigotMappings.flatMap { it.outputMappings })
|
||||
|
||||
outputMappings.set(cache.resolve(Constants.CLEANED_SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
outputMappings.set(cache.resolve(CLEANED_SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
}
|
||||
|
||||
val patchMappings by tasks.registering<PatchMappings> {
|
||||
inputMappings.set(cleanupMappings.flatMap { it.outputMappings })
|
||||
patch.set(extension.paper.mappingsPatch.fileExists(project))
|
||||
|
||||
fromNamespace.set(Constants.SPIGOT_NAMESPACE)
|
||||
toNamespace.set(Constants.DEOBF_NAMESPACE)
|
||||
fromNamespace.set(SPIGOT_NAMESPACE)
|
||||
toNamespace.set(DEOBF_NAMESPACE)
|
||||
|
||||
outputMappings.set(cache.resolve(Constants.PATCHED_SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
outputMappings.set(cache.resolve(PATCHED_SPIGOT_MOJANG_YARN_MAPPINGS))
|
||||
}
|
||||
|
||||
val filterSpigotExcludes by tasks.registering<FilterSpigotExcludes> {
|
||||
|
@ -181,7 +177,7 @@ open class SpigotTasks(
|
|||
dependsOn(patchSpigot)
|
||||
apiPom.set(patchSpigotApi.flatMap { it.outputDir.file("pom.xml") })
|
||||
serverPom.set(patchSpigotServer.flatMap { it.outputDir.file("pom.xml") })
|
||||
outputDir.set(cache.resolve(Constants.SPIGOT_JARS_PATH))
|
||||
outputDir.set(cache.resolve(SPIGOT_JARS_PATH))
|
||||
|
||||
downloader.set(downloadService)
|
||||
}
|
||||
|
|
|
@ -24,12 +24,8 @@ package io.papermc.paperweight.core.taskcontainers
|
|||
|
||||
import io.papermc.paperweight.DownloadService
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.tasks.DownloadMcLibraries
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.download
|
||||
import io.papermc.paperweight.util.registering
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Path
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
|
@ -46,9 +42,9 @@ open class VanillaTasks(
|
|||
|
||||
val downloadMcLibraries by tasks.registering<DownloadMcLibraries> {
|
||||
mcLibrariesFile.set(setupMcLibraries.flatMap { it.outputFile })
|
||||
mcRepo.set(Constants.MC_LIBRARY_URL)
|
||||
outputDir.set(cache.resolve(Constants.MINECRAFT_JARS_PATH))
|
||||
sourcesOutputDir.set(cache.resolve(Constants.MINECRAFT_SOURCES_PATH))
|
||||
mcRepo.set(MC_LIBRARY_URL)
|
||||
outputDir.set(cache.resolve(MINECRAFT_JARS_PATH))
|
||||
sourcesOutputDir.set(cache.resolve(MINECRAFT_SOURCES_PATH))
|
||||
|
||||
downloader.set(downloadService)
|
||||
}
|
||||
|
@ -58,17 +54,17 @@ open class VanillaTasks(
|
|||
libraries.from(downloadMcLibraries.map { it.outputDir.asFileTree })
|
||||
|
||||
vanillaMappings.set(downloadMappings.flatMap { it.outputFile })
|
||||
paramMappings.fileProvider(project.configurations.named(Constants.PARAM_MAPPINGS_CONFIG).map { it.singleFile })
|
||||
paramMappings.fileProvider(project.configurations.named(PARAM_MAPPINGS_CONFIG).map { it.singleFile })
|
||||
|
||||
outputMappings.set(cache.resolve(Constants.MOJANG_YARN_MAPPINGS))
|
||||
outputMappings.set(cache.resolve(MOJANG_YARN_MAPPINGS))
|
||||
}
|
||||
|
||||
val remapJar by tasks.registering<RemapJar> {
|
||||
inputJar.set(filterVanillaJar.flatMap { it.outputJar })
|
||||
mappingsFile.set(generateMappings.flatMap { it.outputMappings })
|
||||
fromNamespace.set(Constants.OBF_NAMESPACE)
|
||||
toNamespace.set(Constants.DEOBF_NAMESPACE)
|
||||
remapper.from(project.configurations.named(Constants.REMAPPER_CONFIG))
|
||||
fromNamespace.set(OBF_NAMESPACE)
|
||||
toNamespace.set(DEOBF_NAMESPACE)
|
||||
remapper.from(project.configurations.named(REMAPPER_CONFIG))
|
||||
}
|
||||
|
||||
val fixJar by tasks.registering<FixJar> {
|
||||
|
|
|
@ -22,13 +22,9 @@
|
|||
|
||||
package io.papermc.paperweight.core.tasks
|
||||
|
||||
import io.papermc.paperweight.util.UpstreamData
|
||||
import io.papermc.paperweight.util.gson
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.bufferedWriter
|
||||
import kotlin.io.path.createDirectories
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
package io.papermc.paperweight.core
|
||||
|
||||
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import org.gradle.api.Project
|
||||
|
||||
val Project.ext: PaperweightCoreExtension
|
||||
get() = extensions.getByName(Constants.EXTENSION) as PaperweightCoreExtension
|
||||
get() = extensions.getByName(PAPERWEIGHT_EXTENSION) as PaperweightCoreExtension
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight
|
||||
|
||||
import io.papermc.paperweight.util.convertToPath
|
||||
import io.papermc.paperweight.util.convertToUrl
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.net.URL
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.attribute.FileTime
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -22,12 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.ensureParentExists
|
||||
import io.papermc.paperweight.util.orNull
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.at.AccessChange
|
||||
|
@ -41,14 +36,7 @@ import org.cadixdev.bombe.jar.JarEntryTransformer
|
|||
import org.cadixdev.bombe.type.signature.MethodSignature
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Classpath
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
|
@ -194,7 +182,8 @@ fun AccessTransform?.apply(currentModifier: Int): Int {
|
|||
ModifierChange.ADD -> {
|
||||
value = value or Opcodes.ACC_FINAL
|
||||
}
|
||||
else -> {}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
|
|
@ -23,15 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.Command
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.UselessOutputStream
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.findOutputDir
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.unzip
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.util.Date
|
||||
|
|
|
@ -23,14 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.findOutputDir
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.unzip
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
|
|
|
@ -23,13 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import com.github.salomonbrys.kotson.fromJson
|
||||
import io.papermc.paperweight.util.ClassNameChange
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.McDev
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.gson
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
|
|
|
@ -22,11 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.copyRecursively
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
|
|
|
@ -43,16 +43,21 @@ import dev.denwav.hypo.mappings.contributors.RemoveUnusedMappings
|
|||
import dev.denwav.hypo.model.ClassProviderRoot
|
||||
import dev.denwav.hypo.model.data.ClassData
|
||||
import dev.denwav.hypo.model.data.types.PrimitiveType
|
||||
import io.papermc.paperweight.util.ClassNameChange
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.gson
|
||||
import io.papermc.paperweight.util.isLibraryJar
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.util.Collections
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.collections.MutableList
|
||||
import kotlin.collections.MutableMap
|
||||
import kotlin.collections.asSequence
|
||||
import kotlin.collections.joinToString
|
||||
import kotlin.collections.listOf
|
||||
import kotlin.collections.mutableListOf
|
||||
import kotlin.collections.plusAssign
|
||||
import kotlin.collections.set
|
||||
import kotlin.collections.toList
|
||||
import kotlin.collections.withIndex
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.lorenz.MappingSet
|
||||
import org.cadixdev.lorenz.model.ClassMapping
|
||||
|
@ -60,15 +65,7 @@ import org.cadixdev.lorenz.model.TopLevelClassMapping
|
|||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Classpath
|
||||
import org.gradle.api.tasks.CompileClasspath
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
|
@ -256,8 +253,8 @@ abstract class CleanupMappings : JavaLauncherTask() {
|
|||
|
||||
val mappings = MappingFormats.TINY.read(
|
||||
parameters.inputMappings.path,
|
||||
Constants.SPIGOT_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
SPIGOT_NAMESPACE,
|
||||
DEOBF_NAMESPACE
|
||||
)
|
||||
|
||||
val caseOnlyChanges = Collections.synchronizedList(mutableListOf<ClassNameChange>())
|
||||
|
@ -283,8 +280,8 @@ abstract class CleanupMappings : JavaLauncherTask() {
|
|||
MappingFormats.TINY.write(
|
||||
cleanedMappings,
|
||||
parameters.outputMappings.path,
|
||||
Constants.SPIGOT_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
SPIGOT_NAMESPACE,
|
||||
DEOBF_NAMESPACE
|
||||
)
|
||||
|
||||
parameters.caseOnlyNameChanges.path.bufferedWriter(Charsets.UTF_8).use { writer ->
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Command
|
||||
import io.papermc.paperweight.util.UselessOutputStream
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Console
|
||||
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.zip
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.DownloadService
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
|
|
|
@ -22,12 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.walk
|
||||
import io.papermc.paperweight.util.zip
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -22,15 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.AsmUtil
|
||||
import io.papermc.paperweight.util.ClassNodeCache
|
||||
import io.papermc.paperweight.util.SyntheticUtil
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.walk
|
||||
import io.papermc.paperweight.util.writeZip
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.FileSystem
|
||||
import java.nio.file.Path
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -22,15 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.AsmUtil
|
||||
import io.papermc.paperweight.util.ClassNodeCache
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.walk
|
||||
import io.papermc.paperweight.util.writeZip
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.FileSystem
|
||||
import java.nio.file.Path
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -33,14 +33,8 @@ import dev.denwav.hypo.mappings.contributors.CopyMappingsDown
|
|||
import dev.denwav.hypo.mappings.contributors.PropagateMappingsUp
|
||||
import dev.denwav.hypo.mappings.contributors.RemoveUnusedMappings
|
||||
import dev.denwav.hypo.model.ClassProviderRoot
|
||||
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.isLibraryJar
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.lorenz.MappingSet
|
||||
|
@ -59,14 +53,7 @@ import org.cadixdev.lorenz.model.TopLevelClassMapping
|
|||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Classpath
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
|
@ -171,7 +158,7 @@ abstract class GenerateMappings : JavaLauncherTask() {
|
|||
}
|
||||
|
||||
ensureParentExists(parameters.outputMappings)
|
||||
MappingFormats.TINY.write(filledMerged, parameters.outputMappings.path, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
MappingFormats.TINY.write(filledMerged, parameters.outputMappings.path, OBF_NAMESPACE, DEOBF_NAMESPACE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,6 +173,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): MergeResult<TopLevelClassMapping?> {
|
||||
throw IllegalStateException("Unexpectedly merged class: ${left.fullObfuscatedName}")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateTopLevelClassMappings(
|
||||
left: TopLevelClassMapping,
|
||||
right: TopLevelClassMapping,
|
||||
|
@ -207,6 +195,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): MergeResult<InnerClassMapping?> {
|
||||
throw IllegalStateException("Unexpectedly merged class: ${left.fullObfuscatedName}")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateInnerClassMappings(
|
||||
left: InnerClassMapping,
|
||||
right: InnerClassMapping,
|
||||
|
@ -229,6 +218,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): FieldMapping? {
|
||||
throw IllegalStateException("Unexpectedly merged field: ${left.fullObfuscatedName}")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateFieldMappings(
|
||||
left: FieldMapping,
|
||||
strictRightDuplicate: FieldMapping?,
|
||||
|
@ -240,6 +230,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): FieldMapping? {
|
||||
return target.createFieldMapping(left.signature, left.deobfuscatedName)
|
||||
}
|
||||
|
||||
override fun addLeftFieldMapping(
|
||||
left: FieldMapping,
|
||||
target: ClassMapping<*, *>,
|
||||
|
@ -257,6 +248,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): MergeResult<MethodMapping?> {
|
||||
throw IllegalStateException("Unexpectedly merged method: ${left.fullObfuscatedName}")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateMethodMappings(
|
||||
left: MethodMapping,
|
||||
standardRightDuplicate: MethodMapping?,
|
||||
|
@ -289,6 +281,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): MergeResult<TopLevelClassMapping?> {
|
||||
return emptyMergeResult()
|
||||
}
|
||||
|
||||
override fun addRightInnerClassMapping(
|
||||
right: InnerClassMapping?,
|
||||
target: ClassMapping<*, *>?,
|
||||
|
@ -296,6 +289,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): MergeResult<InnerClassMapping?> {
|
||||
return emptyMergeResult()
|
||||
}
|
||||
|
||||
override fun addRightFieldMapping(
|
||||
right: FieldMapping?,
|
||||
target: ClassMapping<*, *>?,
|
||||
|
@ -303,6 +297,7 @@ class ParamsMergeHandler : MappingSetMergerHandler {
|
|||
): FieldMapping? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun addRightMethodMapping(
|
||||
right: MethodMapping?,
|
||||
target: ClassMapping<*, *>?,
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.sigpipe.jbsdiff.Diff
|
||||
import java.io.IOException
|
||||
import java.nio.file.Path
|
||||
|
@ -34,7 +31,6 @@ import java.security.MessageDigest
|
|||
import java.security.NoSuchAlgorithmException
|
||||
import java.util.Properties
|
||||
import javax.inject.Inject
|
||||
import kotlin.collections.listOf
|
||||
import kotlin.collections.set
|
||||
import kotlin.experimental.and
|
||||
import kotlin.io.path.*
|
||||
|
|
|
@ -42,10 +42,8 @@ import dev.denwav.hypo.mappings.contributors.PropagateMappingsUp
|
|||
import dev.denwav.hypo.mappings.contributors.RemoveUnusedMappings
|
||||
import dev.denwav.hypo.model.ClassProviderRoot
|
||||
import dev.denwav.hypo.model.data.ClassData
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.orNull
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.bombe.type.signature.FieldSignature
|
||||
|
@ -53,14 +51,7 @@ import org.cadixdev.lorenz.MappingSet
|
|||
import org.cadixdev.lorenz.model.ClassMapping
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Classpath
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
|
@ -192,17 +183,17 @@ abstract class GenerateReobfMappings : JavaLauncherTask() {
|
|||
override fun execute() {
|
||||
val baseMappings = MappingFormats.TINY.read(
|
||||
parameters.inputMappings.path,
|
||||
Constants.SPIGOT_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
SPIGOT_NAMESPACE,
|
||||
DEOBF_NAMESPACE
|
||||
)
|
||||
|
||||
val notchToSpigot = MappingFormats.TINY.read(
|
||||
parameters.notchToSpigotMappings.path,
|
||||
Constants.OBF_NAMESPACE,
|
||||
Constants.SPIGOT_NAMESPACE
|
||||
OBF_NAMESPACE,
|
||||
SPIGOT_NAMESPACE
|
||||
)
|
||||
|
||||
val fieldMappings = MappingFormats.TINY.read(parameters.sourceMappings.path, Constants.OBF_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
val fieldMappings = MappingFormats.TINY.read(parameters.sourceMappings.path, OBF_NAMESPACE, DEOBF_NAMESPACE)
|
||||
val spigotFieldMappings = filterFieldMappings(notchToSpigot).reverse().merge(fieldMappings)
|
||||
|
||||
val outputMappings = copyFieldMappings(baseMappings, spigotFieldMappings).reverse()
|
||||
|
@ -229,8 +220,8 @@ abstract class GenerateReobfMappings : JavaLauncherTask() {
|
|||
MappingFormats.TINY.write(
|
||||
cleanedOutputMappings,
|
||||
parameters.reobfMappings.path,
|
||||
Constants.DEOBF_NAMESPACE,
|
||||
Constants.SPIGOT_NAMESPACE
|
||||
DEOBF_NAMESPACE,
|
||||
SPIGOT_NAMESPACE
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -241,6 +232,7 @@ abstract class GenerateReobfMappings : JavaLauncherTask() {
|
|||
registry.submitChange(RemoveMappingChange.of(MemberReference.of(fieldMapping)))
|
||||
}
|
||||
}
|
||||
|
||||
override fun name(): String = "RemoveFieldMappings"
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,17 @@
|
|||
|
||||
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.orNull
|
||||
import io.papermc.paperweight.util.parentClass
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.collections.Map
|
||||
import kotlin.collections.MutableMap
|
||||
import kotlin.collections.component1
|
||||
import kotlin.collections.component2
|
||||
import kotlin.collections.component3
|
||||
import kotlin.collections.component4
|
||||
import kotlin.collections.hashMapOf
|
||||
import kotlin.collections.iterator
|
||||
import kotlin.collections.set
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.bombe.type.signature.FieldSignature
|
||||
import org.cadixdev.bombe.type.signature.MethodSignature
|
||||
|
@ -97,8 +102,8 @@ abstract class GenerateSpigotMappings : DefaultTask() {
|
|||
|
||||
val sourceMappings = MappingFormats.TINY.read(
|
||||
sourceMappings.path,
|
||||
Constants.OBF_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
OBF_NAMESPACE,
|
||||
DEOBF_NAMESPACE
|
||||
)
|
||||
|
||||
val synths = hashMapOf<String, MutableMap<String, MutableMap<String, String>>>()
|
||||
|
@ -123,15 +128,15 @@ abstract class GenerateSpigotMappings : DefaultTask() {
|
|||
MappingFormats.TINY.write(
|
||||
notchToSpigotSet,
|
||||
notchToSpigotMappings.path,
|
||||
Constants.OBF_NAMESPACE,
|
||||
Constants.SPIGOT_NAMESPACE
|
||||
OBF_NAMESPACE,
|
||||
SPIGOT_NAMESPACE
|
||||
)
|
||||
|
||||
MappingFormats.TINY.write(
|
||||
spigotToNamedSet,
|
||||
outputMappings.path,
|
||||
Constants.SPIGOT_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
SPIGOT_NAMESPACE,
|
||||
DEOBF_NAMESPACE
|
||||
)
|
||||
|
||||
val fieldSourceMappings = extractFieldMappings(sourceMappings, classMappingSet)
|
||||
|
@ -197,6 +202,7 @@ class SpigotMappingsMergerHandler(private val synths: Synths) : MappingSetMerger
|
|||
): MergeResult<InnerClassMapping?> {
|
||||
throw IllegalStateException("Unexpectedly merged class: ${left.fullObfuscatedName}")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateInnerClassMappings(
|
||||
left: InnerClassMapping,
|
||||
right: InnerClassMapping,
|
||||
|
@ -219,6 +225,7 @@ class SpigotMappingsMergerHandler(private val synths: Synths) : MappingSetMerger
|
|||
"Unexpected added class from Spigot: ${left.fullObfuscatedName} - ${left.fullDeobfuscatedName}"
|
||||
)
|
||||
}
|
||||
|
||||
override fun addRightInnerClassMapping(
|
||||
right: InnerClassMapping,
|
||||
target: ClassMapping<*, *>,
|
||||
|
@ -237,6 +244,7 @@ class SpigotMappingsMergerHandler(private val synths: Synths) : MappingSetMerger
|
|||
): FieldMapping {
|
||||
throw IllegalStateException("Unexpectedly merged field: ${left.fullObfuscatedName}")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateFieldMappings(
|
||||
left: FieldMapping,
|
||||
strictRightDuplicate: FieldMapping?,
|
||||
|
@ -259,6 +267,7 @@ class SpigotMappingsMergerHandler(private val synths: Synths) : MappingSetMerger
|
|||
): MergeResult<MethodMapping?> {
|
||||
throw IllegalStateException("Unexpectedly merged method: $left")
|
||||
}
|
||||
|
||||
override fun mergeDuplicateMethodMappings(
|
||||
left: MethodMapping,
|
||||
standardRightDuplicate: MethodMapping?,
|
||||
|
@ -290,6 +299,7 @@ class SpigotMappingsMergerHandler(private val synths: Synths) : MappingSetMerger
|
|||
return MergeResult(newMapping)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addLeftMethodMapping(
|
||||
left: MethodMapping,
|
||||
target: ClassMapping<*, *>,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.initSubmodules
|
||||
import io.papermc.paperweight.util.*
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
|
|
|
@ -22,14 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.AsmUtil
|
||||
import io.papermc.paperweight.util.MavenArtifact
|
||||
import io.papermc.paperweight.util.SyntheticUtil
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.isLibraryJar
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.walk
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.walk
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.StandardCopyOption
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.DefaultTask
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.at.AccessTransformSet
|
||||
import org.cadixdev.at.io.AccessTransformFormats
|
||||
|
|
|
@ -22,23 +22,12 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.commentRegex
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
|
||||
@CacheableTask
|
||||
abstract class PatchMappings : DefaultTask() {
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import java.util.concurrent.Executors
|
||||
|
|
|
@ -22,10 +22,8 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import org.cadixdev.at.io.AccessTransformFormats
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
|
@ -56,7 +54,7 @@ abstract class RemapAccessTransform : BaseTask() {
|
|||
@TaskAction
|
||||
fun run() {
|
||||
val at = AccessTransformFormats.FML.read(inputFile.path)
|
||||
val mappingSet = MappingFormats.TINY.read(mappings.path, Constants.SPIGOT_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
val mappingSet = MappingFormats.TINY.read(mappings.path, SPIGOT_NAMESPACE, DEOBF_NAMESPACE)
|
||||
|
||||
val resultAt = at.remap(mappingSet)
|
||||
AccessTransformFormats.FML.write(outputFile.path, resultAt)
|
||||
|
|
|
@ -22,28 +22,14 @@
|
|||
|
||||
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.path
|
||||
import io.papermc.paperweight.util.runJar
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Classpath
|
||||
import org.gradle.api.tasks.CompileClasspath
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
|
||||
@CacheableTask
|
||||
abstract class RemapJar : JavaLauncherTask() {
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.ensureParentExists
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.atlas.Atlas
|
||||
|
|
|
@ -22,18 +22,8 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.copyRecursively
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.findOutputDir
|
||||
import io.papermc.paperweight.util.isLibraryJar
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.zip
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Files
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
|
@ -46,43 +36,12 @@ import org.cadixdev.mercury.SourceRewriter
|
|||
import org.cadixdev.mercury.at.AccessTransformerRewriter
|
||||
import org.cadixdev.mercury.extra.AccessAnalyzerProcessor
|
||||
import org.cadixdev.mercury.remapper.MercuryRemapper
|
||||
import org.eclipse.jdt.core.dom.ASTNode
|
||||
import org.eclipse.jdt.core.dom.ASTVisitor
|
||||
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration
|
||||
import org.eclipse.jdt.core.dom.Expression
|
||||
import org.eclipse.jdt.core.dom.FieldAccess
|
||||
import org.eclipse.jdt.core.dom.IBinding
|
||||
import org.eclipse.jdt.core.dom.IMethodBinding
|
||||
import org.eclipse.jdt.core.dom.ITypeBinding
|
||||
import org.eclipse.jdt.core.dom.IVariableBinding
|
||||
import org.eclipse.jdt.core.dom.Initializer
|
||||
import org.eclipse.jdt.core.dom.LambdaExpression
|
||||
import org.eclipse.jdt.core.dom.MethodDeclaration
|
||||
import org.eclipse.jdt.core.dom.MethodInvocation
|
||||
import org.eclipse.jdt.core.dom.MethodReference
|
||||
import org.eclipse.jdt.core.dom.Modifier
|
||||
import org.eclipse.jdt.core.dom.Name
|
||||
import org.eclipse.jdt.core.dom.QualifiedName
|
||||
import org.eclipse.jdt.core.dom.SimpleName
|
||||
import org.eclipse.jdt.core.dom.SuperFieldAccess
|
||||
import org.eclipse.jdt.core.dom.SuperMethodInvocation
|
||||
import org.eclipse.jdt.core.dom.ThisExpression
|
||||
import org.eclipse.jdt.core.dom.TypeDeclaration
|
||||
import org.eclipse.jdt.core.dom.VariableDeclarationFragment
|
||||
import org.eclipse.jdt.core.dom.*
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.CompileClasspath
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
|
@ -204,8 +163,8 @@ abstract class RemapSources : JavaLauncherTask() {
|
|||
override fun execute() {
|
||||
val mappingSet = MappingFormats.TINY.read(
|
||||
parameters.mappings.path,
|
||||
Constants.SPIGOT_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
SPIGOT_NAMESPACE,
|
||||
DEOBF_NAMESPACE
|
||||
)
|
||||
|
||||
val additionalAt = parameters.additionalAts.pathOrNull?.let { AccessTransformFormats.FML.read(it) }
|
||||
|
@ -338,7 +297,7 @@ abstract class RemapSources : JavaLauncherTask() {
|
|||
|
||||
// find declaring method
|
||||
var parentNode: ASTNode? = node
|
||||
loop@while (parentNode != null) {
|
||||
loop@ while (parentNode != null) {
|
||||
when (parentNode) {
|
||||
is MethodDeclaration, is AnonymousClassDeclaration, is LambdaExpression, is Initializer -> break@loop
|
||||
}
|
||||
|
|
|
@ -22,11 +22,8 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.openZip
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.at.AccessChange
|
||||
import org.cadixdev.at.AccessTransform
|
||||
|
@ -108,7 +105,7 @@ abstract class RemapSpigotAt : BaseTask() {
|
|||
}
|
||||
}
|
||||
|
||||
val mappings = MappingFormats.TINY.read(mapping.path, Constants.SPIGOT_NAMESPACE, Constants.DEOBF_NAMESPACE)
|
||||
val mappings = MappingFormats.TINY.read(mapping.path, SPIGOT_NAMESPACE, DEOBF_NAMESPACE)
|
||||
val remappedAt = outputAt.remap(mappings)
|
||||
|
||||
AccessTransformFormats.FML.write(outputFile.path, remappedAt)
|
||||
|
|
|
@ -22,14 +22,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.deleteForcefully
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.isLibraryJar
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.runJar
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -23,14 +23,8 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.Constants.paperTaskOutput
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.runJar
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.util.concurrent.ThreadLocalRandom
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -23,24 +23,12 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.Constants.paperTaskOutput
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.runJar
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Classpath
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
|
||||
@CacheableTask
|
||||
abstract class SpigotRemapJar : JavaLauncherTask() {
|
||||
|
|
|
@ -22,14 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.util.defaultOutput
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.ensureDeleted
|
||||
import io.papermc.paperweight.util.findOutputDir
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.unzip
|
||||
import io.papermc.paperweight.util.zip
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
|
|
|
@ -23,11 +23,7 @@
|
|||
package io.papermc.paperweight.tasks
|
||||
|
||||
import io.papermc.paperweight.DownloadService
|
||||
import io.papermc.paperweight.util.MavenArtifact
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.util.set
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import javax.inject.Inject
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
|
@ -38,15 +34,7 @@ import org.gradle.api.file.ProjectLayout
|
|||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.CacheableTask
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
|
@ -266,7 +254,8 @@ abstract class DownloadWorker : WorkAction<DownloadParams> {
|
|||
try {
|
||||
val sourceArtifact = artifact.copy(classifier = "sources")
|
||||
sourceArtifact.downloadToDir(parameters.downloader.get(), sourceDir, parameters.repos.get())
|
||||
} catch (ignored: Exception) {}
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
artifact.downloadToFile(parameters.downloader.get(), target, parameters.repos.get())
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
package io.papermc.paperweight.tasks.patchremap
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
package io.papermc.paperweight.tasks.patchremap
|
||||
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
import org.cadixdev.at.AccessTransformSet
|
||||
|
@ -58,7 +58,7 @@ class PatchSourceRemapWorker(
|
|||
fun remap() {
|
||||
setup()
|
||||
|
||||
println("mapping to ${Constants.DEOBF_NAMESPACE}")
|
||||
println("mapping to $DEOBF_NAMESPACE")
|
||||
|
||||
merc.rewrite(inputDir, outputDir)
|
||||
|
||||
|
|
|
@ -23,15 +23,9 @@
|
|||
package io.papermc.paperweight.tasks.patchremap
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.tasks.BaseTask
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.McDev
|
||||
import io.papermc.paperweight.util.cache
|
||||
import io.papermc.paperweight.util.copyRecursively
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.nio.file.Path
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
|
@ -140,11 +134,7 @@ abstract class RemapPatches : BaseTask() {
|
|||
|
||||
val limit = limitPatches.map { it.toInt() }.orElse(patchesToRemap.size).get()
|
||||
|
||||
val mappings = MappingFormats.TINY.read(
|
||||
mappingsFile.path,
|
||||
Constants.SPIGOT_NAMESPACE,
|
||||
Constants.DEOBF_NAMESPACE
|
||||
)
|
||||
val mappings = MappingFormats.TINY.read(mappingsFile.path, SPIGOT_NAMESPACE, DEOBF_NAMESPACE)
|
||||
|
||||
// This should pull in any libraries needed for type bindings
|
||||
val configFiles = project.project(":Paper-Server").configurations["runtimeClasspath"].resolve().map { it.toPath() }
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
package io.papermc.paperweight.util
|
||||
|
||||
import java.nio.file.FileSystem
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.readBytes
|
||||
import kotlin.io.path.*
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.tree.ClassNode
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (c) 2021 Kyle Wood (DenWav)
|
||||
* 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 org.gradle.api.Task
|
||||
|
||||
object Constants {
|
||||
const val EXTENSION = "paperweight"
|
||||
const val PAPERWEIGHT_DEBUG = "paperweight.debug"
|
||||
|
||||
const val MC_LIBRARY_URL = "https://libraries.minecraft.net/"
|
||||
|
||||
const val MC_MANIFEST_URL = "https://launchermeta.mojang.com/mc/game/version_manifest.json"
|
||||
|
||||
const val PARAM_MAPPINGS_CONFIG = "paramMappings"
|
||||
const val REMAPPER_CONFIG = "remapper"
|
||||
const val DECOMPILER_CONFIG = "decompiler"
|
||||
const val PAPERCLIP_CONFIG = "paperclip"
|
||||
|
||||
const val CACHE_PATH = "caches"
|
||||
private const val PAPER_PATH = "paperweight"
|
||||
|
||||
const val UPSTREAMS = "$PAPER_PATH/upstreams"
|
||||
const val UPSTREAM_WORK_DIR_PROPERTY = "paperweightUpstreamWorkDir"
|
||||
const val PAPERWEIGHT_PREPARE_DOWNSTREAM = "prepareForDownstream"
|
||||
const val PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY = "paperweightDownstreamDataFile"
|
||||
|
||||
private const val JARS_PATH = "$PAPER_PATH/jars"
|
||||
const val MINECRAFT_JARS_PATH = "$JARS_PATH/minecraft"
|
||||
const val MINECRAFT_SOURCES_PATH = "$JARS_PATH/minecraft-sources"
|
||||
|
||||
const val SPIGOT_JARS_PATH = "$JARS_PATH/spigot"
|
||||
|
||||
private const val MAPPINGS_DIR = "$PAPER_PATH/mappings"
|
||||
const val SERVER_MAPPINGS = "$MAPPINGS_DIR/server_mappings.txt"
|
||||
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 OBF_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/official-spigot.tiny"
|
||||
const val SPIGOT_MOJANG_YARN_FIELDS_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn+fields.csrg"
|
||||
const val CLEANED_SPIGOT_MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn-cleaned.tiny"
|
||||
const val PATCHED_SPIGOT_MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn-patched.tiny"
|
||||
const val REOBF_MOJANG_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/mojang+yarn-spigot-reobf.tiny"
|
||||
const val PATCHED_REOBF_MOJANG_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/mojang+yarn-spigot-reobf-patched.tiny"
|
||||
|
||||
const val OBF_NAMESPACE = "official"
|
||||
const val SPIGOT_NAMESPACE = "spigot"
|
||||
const val DEOBF_NAMESPACE = "mojang+yarn"
|
||||
|
||||
private const val DATA_PATH = "$PAPER_PATH/data"
|
||||
const val MC_MANIFEST = "$DATA_PATH/McManifest.json"
|
||||
const val VERSION_JSON = "$DATA_PATH/McVersion.json"
|
||||
const val MC_LIBRARIES = "$DATA_PATH/McLibraries.txt"
|
||||
const val SERVER_LIBRARIES = "$DATA_PATH/ServerLibraries.txt"
|
||||
|
||||
private const val TASK_CACHE = "$PAPER_PATH/taskCache"
|
||||
|
||||
const val FINAL_REMAPPED_JAR = "$TASK_CACHE/minecraft.jar"
|
||||
|
||||
const val MC_DEV_DIR = "mcdev-source"
|
||||
|
||||
fun Task.paperTaskOutput(ext: String) = paperTaskOutput(name, ext)
|
||||
fun paperTaskOutput(name: String, ext: String) = "$TASK_CACHE/$name.$ext"
|
||||
}
|
|
@ -25,7 +25,7 @@ package io.papermc.paperweight.util
|
|||
import io.papermc.paperweight.DownloadService
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.createDirectories
|
||||
import kotlin.io.path.*
|
||||
|
||||
data class MavenArtifact(
|
||||
private val group: String,
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.cadixdev.mercury.at.AccessTransformerRewriter
|
|||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.kotlin.dsl.submit
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.workers.WorkAction
|
||||
import org.gradle.workers.WorkParameters
|
||||
import org.gradle.workers.WorkerExecutor
|
||||
|
|
82
paperweight-lib/src/main/kotlin/util/constants/constants.kt
Normal file
82
paperweight-lib/src/main/kotlin/util/constants/constants.kt
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* paperweight is a Gradle plugin for the PaperMC project.
|
||||
*
|
||||
* Copyright (c) 2021 Kyle Wood (DenWav)
|
||||
* 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.constants
|
||||
|
||||
import org.gradle.api.Task
|
||||
|
||||
const val PAPERWEIGHT_EXTENSION = "paperweight"
|
||||
const val PAPERWEIGHT_DEBUG = "paperweight.debug"
|
||||
|
||||
const val MC_LIBRARY_URL = "https://libraries.minecraft.net/"
|
||||
|
||||
const val MC_MANIFEST_URL = "https://launchermeta.mojang.com/mc/game/version_manifest.json"
|
||||
|
||||
const val PARAM_MAPPINGS_CONFIG = "paramMappings"
|
||||
const val REMAPPER_CONFIG = "remapper"
|
||||
const val DECOMPILER_CONFIG = "decompiler"
|
||||
const val PAPERCLIP_CONFIG = "paperclip"
|
||||
|
||||
const val CACHE_PATH = "caches"
|
||||
private const val PAPER_PATH = "paperweight"
|
||||
|
||||
const val UPSTREAMS = "$PAPER_PATH/upstreams"
|
||||
const val UPSTREAM_WORK_DIR_PROPERTY = "paperweightUpstreamWorkDir"
|
||||
const val PAPERWEIGHT_PREPARE_DOWNSTREAM = "prepareForDownstream"
|
||||
const val PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY = "paperweightDownstreamDataFile"
|
||||
|
||||
private const val JARS_PATH = "$PAPER_PATH/jars"
|
||||
const val MINECRAFT_JARS_PATH = "$JARS_PATH/minecraft"
|
||||
const val MINECRAFT_SOURCES_PATH = "$JARS_PATH/minecraft-sources"
|
||||
|
||||
const val SPIGOT_JARS_PATH = "$JARS_PATH/spigot"
|
||||
|
||||
private const val MAPPINGS_DIR = "$PAPER_PATH/mappings"
|
||||
const val SERVER_MAPPINGS = "$MAPPINGS_DIR/server_mappings.txt"
|
||||
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 OBF_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/official-spigot.tiny"
|
||||
const val SPIGOT_MOJANG_YARN_FIELDS_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn+fields.csrg"
|
||||
const val CLEANED_SPIGOT_MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn-cleaned.tiny"
|
||||
const val PATCHED_SPIGOT_MOJANG_YARN_MAPPINGS = "$MAPPINGS_DIR/spigot-mojang+yarn-patched.tiny"
|
||||
const val REOBF_MOJANG_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/mojang+yarn-spigot-reobf.tiny"
|
||||
const val PATCHED_REOBF_MOJANG_SPIGOT_MAPPINGS = "$MAPPINGS_DIR/mojang+yarn-spigot-reobf-patched.tiny"
|
||||
|
||||
const val OBF_NAMESPACE = "official"
|
||||
const val SPIGOT_NAMESPACE = "spigot"
|
||||
const val DEOBF_NAMESPACE = "mojang+yarn"
|
||||
|
||||
private const val DATA_PATH = "$PAPER_PATH/data"
|
||||
const val MC_MANIFEST = "$DATA_PATH/McManifest.json"
|
||||
const val VERSION_JSON = "$DATA_PATH/McVersion.json"
|
||||
const val MC_LIBRARIES = "$DATA_PATH/McLibraries.txt"
|
||||
const val SERVER_LIBRARIES = "$DATA_PATH/ServerLibraries.txt"
|
||||
|
||||
private const val TASK_CACHE = "$PAPER_PATH/taskCache"
|
||||
|
||||
const val FINAL_REMAPPED_JAR = "$TASK_CACHE/minecraft.jar"
|
||||
|
||||
const val MC_DEV_DIR = "mcdev-source"
|
||||
|
||||
fun Task.paperTaskOutput(ext: String) = paperTaskOutput(name, ext)
|
||||
fun paperTaskOutput(name: String, ext: String) = "$TASK_CACHE/$name.$ext"
|
|
@ -48,6 +48,7 @@ val Provider<out FileSystemLocation>.path: Path
|
|||
get() = get().path
|
||||
val Provider<out FileSystemLocation>.pathOrNull: Path?
|
||||
get() = orNull?.path
|
||||
|
||||
fun FileSystemLocationProperty<*>.set(path: Path?) = set(path?.toFile())
|
||||
fun FileSystemLocationProperty<*>.pathProvider(path: Provider<Path?>) = fileProvider(path.map { it.toFile() })
|
||||
|
||||
|
|
|
@ -23,16 +23,17 @@
|
|||
package io.papermc.paperweight.util
|
||||
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.OutputStream
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.provider.ProviderFactory
|
||||
|
||||
class Git(val repo: Path, val env: Map<String, String> = emptyMap()) {
|
||||
class Git(private val repo: Path, private val env: Map<String, String> = emptyMap()) {
|
||||
|
||||
@Suppress("unused")
|
||||
constructor(repo: Any) : this(repo.convertToPath())
|
||||
|
@ -81,6 +82,7 @@ class Git(val repo: Path, val env: Map<String, String> = emptyMap()) {
|
|||
fun add(ignoreGitIgnore: Provider<Boolean>, vararg args: String): Array<String> {
|
||||
return add(ignoreGitIgnore.get(), *args)
|
||||
}
|
||||
|
||||
fun add(ignoreGitIgnore: Boolean, vararg args: String): Array<String> {
|
||||
return if (ignoreGitIgnore) {
|
||||
arrayOf("add", "--force", *args)
|
||||
|
@ -97,7 +99,7 @@ class Command(private val processBuilder: ProcessBuilder, private val command: S
|
|||
private var errStream: OutputStream = UselessOutputStream
|
||||
|
||||
fun run(): Int {
|
||||
if (System.getProperty(Constants.PAPERWEIGHT_DEBUG, "false") == "true") {
|
||||
if (System.getProperty(PAPERWEIGHT_DEBUG, "false") == "true") {
|
||||
// Override all settings for debug
|
||||
setup(System.out, System.err)
|
||||
println()
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
|
||||
package io.papermc.paperweight.util
|
||||
|
||||
import io.papermc.paperweight.tasks.FixJarForReobf
|
||||
import io.papermc.paperweight.tasks.RemapJar
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.forEachLine
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
|
@ -85,9 +84,9 @@ private fun Project.createBuildTasks(packagesToFix: Provider<List<String>?>, reo
|
|||
|
||||
reobfConfig()
|
||||
|
||||
fromNamespace.set(Constants.DEOBF_NAMESPACE)
|
||||
toNamespace.set(Constants.SPIGOT_NAMESPACE)
|
||||
remapper.from(rootProject.configurations.named(Constants.REMAPPER_CONFIG))
|
||||
fromNamespace.set(DEOBF_NAMESPACE)
|
||||
toNamespace.set(SPIGOT_NAMESPACE)
|
||||
remapper.from(rootProject.configurations.named(REMAPPER_CONFIG))
|
||||
|
||||
outputJar.set(buildDir.resolve("libs/${shadowJar.get().archiveBaseName.get()}-reobf.jar"))
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import com.github.salomonbrys.kotson.fromJson
|
|||
import com.google.gson.*
|
||||
import io.papermc.paperweight.DownloadService
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.tasks.BaseTask
|
||||
import io.papermc.paperweight.util.Constants.paperTaskOutput
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
@ -71,8 +71,9 @@ inline fun <reified T> Gson.fromJson(file: Any): T =
|
|||
file.convertToPath().bufferedReader(Charsets.UTF_8).use { fromJson(it) }
|
||||
|
||||
val ProjectLayout.cache: Path
|
||||
get() = projectDirectory.file(".gradle/${Constants.CACHE_PATH}").path
|
||||
fun ProjectLayout.cacheDir(path: String) = projectDirectory.dir(".gradle/${Constants.CACHE_PATH}").dir(path)
|
||||
get() = projectDirectory.file(".gradle/CACHE_PATH").path
|
||||
|
||||
fun ProjectLayout.cacheDir(path: String) = projectDirectory.dir(".gradle/$CACHE_PATH").dir(path)
|
||||
fun ProjectLayout.initSubmodules() {
|
||||
Git(projectDirectory.path)("submodule", "update", "--init").executeOut()
|
||||
}
|
||||
|
@ -88,6 +89,7 @@ inline fun <reified T : Task> TaskContainer.providerFor(name: String): TaskProvi
|
|||
register<T>(name)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : Task> TaskContainer.configureTask(name: String, noinline configure: T.() -> Unit): TaskProvider<T> {
|
||||
return if (names.contains(name)) {
|
||||
named(name, configure)
|
||||
|
@ -105,7 +107,7 @@ fun commentRegex(): Regex {
|
|||
}
|
||||
|
||||
val Project.isBaseExecution: Boolean
|
||||
get() = providers.gradleProperty(Constants.PAPERWEIGHT_PREPARE_DOWNSTREAM)
|
||||
get() = providers.gradleProperty(PAPERWEIGHT_PREPARE_DOWNSTREAM)
|
||||
.forUseAtConfigurationTime()
|
||||
.orElse(provider { "false" })
|
||||
.map { it == "false" }
|
||||
|
@ -183,9 +185,11 @@ fun BaseTask.defaultOutput(name: String, ext: String): RegularFileProperty {
|
|||
layout.cache.resolve(paperTaskOutput(name, ext)).toFile()
|
||||
}
|
||||
}
|
||||
|
||||
fun BaseTask.defaultOutput(ext: String): RegularFileProperty {
|
||||
return defaultOutput(name, ext)
|
||||
}
|
||||
|
||||
fun BaseTask.defaultOutput(): RegularFileProperty {
|
||||
return defaultOutput("jar")
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ import io.papermc.paperweight.patcher.tasks.SimpleRebuildGitPatches
|
|||
import io.papermc.paperweight.patcher.upstream.PatchTaskConfig
|
||||
import io.papermc.paperweight.patcher.upstream.PatcherUpstream
|
||||
import io.papermc.paperweight.patcher.upstream.RepoPatcherUpstream
|
||||
import io.papermc.paperweight.tasks.GeneratePaperclipPatch
|
||||
import io.papermc.paperweight.tasks.GenerateReobfMappings
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import org.gradle.api.Plugin
|
||||
|
@ -49,7 +49,7 @@ import org.gradle.kotlin.dsl.registering
|
|||
class PaperweightPatcher : Plugin<Project> {
|
||||
|
||||
override fun apply(target: Project) {
|
||||
val patcher = target.extensions.create(Constants.EXTENSION, PaperweightPatcherExtension::class)
|
||||
val patcher = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightPatcherExtension::class)
|
||||
|
||||
target.gradle.sharedServices.registerIfAbsent("download", DownloadService::class) {}
|
||||
|
||||
|
@ -59,16 +59,16 @@ class PaperweightPatcher : Plugin<Project> {
|
|||
delete(target.layout.cache)
|
||||
}
|
||||
|
||||
target.configurations.create(Constants.REMAPPER_CONFIG)
|
||||
target.configurations.create(Constants.PAPERCLIP_CONFIG)
|
||||
target.configurations.create(REMAPPER_CONFIG)
|
||||
target.configurations.create(PAPERCLIP_CONFIG)
|
||||
|
||||
val workDirProp = target.providers.gradleProperty(Constants.UPSTREAM_WORK_DIR_PROPERTY).forUseAtConfigurationTime()
|
||||
val dataFileProp = target.providers.gradleProperty(Constants.PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY)
|
||||
.orElse(target.providers.gradleProperty(Constants.PAPERWEIGHT_PREPARE_DOWNSTREAM)).forUseAtConfigurationTime()
|
||||
val workDirProp = target.providers.gradleProperty(UPSTREAM_WORK_DIR_PROPERTY).forUseAtConfigurationTime()
|
||||
val dataFileProp = target.providers.gradleProperty(PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY)
|
||||
.orElse(target.providers.gradleProperty(PAPERWEIGHT_PREPARE_DOWNSTREAM)).forUseAtConfigurationTime()
|
||||
|
||||
val applyPatches by target.tasks.registering { group = "paperweight" }
|
||||
val rebuildPatches by target.tasks.registering { group = "paperweight" }
|
||||
val downstreamData = target.tasks.register(Constants.PAPERWEIGHT_PREPARE_DOWNSTREAM)
|
||||
val downstreamData = target.tasks.register(PAPERWEIGHT_PREPARE_DOWNSTREAM)
|
||||
val generateReobfMappings by target.tasks.registering(GenerateReobfMappings::class)
|
||||
|
||||
val upstreamDataTaskRef = AtomicReference<TaskProvider<PaperweightPatcherUpstreamData>>(null)
|
||||
|
@ -111,7 +111,7 @@ class PaperweightPatcher : Plugin<Project> {
|
|||
sourceMappings.pathProvider(upstreamData.map { it.sourceMappings })
|
||||
inputJar.set(serverProj.tasks.named("shadowJar", Jar::class).flatMap { it.archiveFile })
|
||||
|
||||
reobfMappings.set(target.layout.cache.resolve(Constants.REOBF_MOJANG_SPIGOT_MAPPINGS))
|
||||
reobfMappings.set(target.layout.cache.resolve(REOBF_MOJANG_SPIGOT_MAPPINGS))
|
||||
}
|
||||
|
||||
val (_, reobfJar) = serverProj.setupServerProject(
|
||||
|
@ -132,7 +132,7 @@ class PaperweightPatcher : Plugin<Project> {
|
|||
paperclipJar {
|
||||
with(target.tasks.named("jar", Jar::class).get())
|
||||
|
||||
val paperclipConfig = target.configurations.named(Constants.PAPERCLIP_CONFIG)
|
||||
val paperclipConfig = target.configurations.named(PAPERCLIP_CONFIG)
|
||||
dependsOn(paperclipConfig, generatePaperclipPatch)
|
||||
|
||||
val paperclipZip = target.zipTree(paperclipConfig.map { it.singleFile })
|
||||
|
|
|
@ -28,10 +28,8 @@ import io.papermc.paperweight.patcher.upstream.DefaultRepoPatcherUpstream
|
|||
import io.papermc.paperweight.patcher.upstream.PaperRepoPatcherUpstream
|
||||
import io.papermc.paperweight.patcher.upstream.PatcherUpstream
|
||||
import io.papermc.paperweight.patcher.upstream.RepoPatcherUpstream
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.cacheDir
|
||||
import io.papermc.paperweight.util.dirWithDefault
|
||||
import io.papermc.paperweight.util.fileFrom
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.ExtensiblePolymorphicDomainObjectContainer
|
||||
import org.gradle.api.Project
|
||||
|
@ -67,7 +65,7 @@ open class PaperweightPatcherExtension(private val objects: ObjectFactory, layou
|
|||
*
|
||||
* This means a project which is several upstreams deep will all use the upstreams directory defined by the root project.
|
||||
*/
|
||||
val upstreamsDir: Property<Directory> = objects.directoryProperty().convention(layout.cacheDir(Constants.UPSTREAMS))
|
||||
val upstreamsDir: Property<Directory> = objects.directoryProperty().convention(layout.cacheDir(UPSTREAMS))
|
||||
|
||||
init {
|
||||
upstreams.registerFactory(PatcherUpstream::class.java) { name -> DefaultPatcherUpstream(name, objects, tasks) }
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
package io.papermc.paperweight.patcher.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
|
|
|
@ -22,15 +22,12 @@
|
|||
|
||||
package io.papermc.paperweight.patcher.tasks
|
||||
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.Constants.PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY
|
||||
import io.papermc.paperweight.util.Constants.PAPERWEIGHT_PREPARE_DOWNSTREAM
|
||||
import io.papermc.paperweight.util.Constants.UPSTREAM_WORK_DIR_PROPERTY
|
||||
import io.papermc.paperweight.util.UpstreamData
|
||||
import io.papermc.paperweight.util.deleteForcefully
|
||||
import io.papermc.paperweight.util.fromJson
|
||||
import io.papermc.paperweight.util.gson
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.*
|
||||
import io.papermc.paperweight.util.constants.*
|
||||
import kotlin.collections.emptyList
|
||||
import kotlin.collections.listOf
|
||||
import kotlin.collections.plus
|
||||
import kotlin.collections.set
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
|
@ -77,7 +74,7 @@ abstract class PaperweightPatcherUpstreamData : DefaultTask() {
|
|||
params.projectProperties[PAPERWEIGHT_DOWNSTREAM_FILE_PROPERTY] = upstreamDataFile.absolutePathString()
|
||||
params.projectProperties[PAPERWEIGHT_PREPARE_DOWNSTREAM] = upstreamDataFile.absolutePathString() // TODO remove after next version
|
||||
|
||||
params.systemPropertiesArgs[Constants.PAPERWEIGHT_DEBUG] = System.getProperty(Constants.PAPERWEIGHT_DEBUG, "false")
|
||||
params.systemPropertiesArgs[PAPERWEIGHT_DEBUG] = System.getProperty(PAPERWEIGHT_DEBUG, "false")
|
||||
|
||||
NestedRootBuildRunner.runNestedRootBuild(null, params as StartParameterInternal, services)
|
||||
|
||||
|
|
|
@ -22,15 +22,8 @@
|
|||
|
||||
package io.papermc.paperweight.patcher.tasks
|
||||
|
||||
import io.papermc.paperweight.tasks.ControllableOutputTask
|
||||
import io.papermc.paperweight.tasks.applyGitPatches
|
||||
import io.papermc.paperweight.tasks.checkoutRepoFromUpstream
|
||||
import io.papermc.paperweight.tasks.recreateCloneDirectory
|
||||
import io.papermc.paperweight.util.Git
|
||||
import io.papermc.paperweight.util.McDev
|
||||
import io.papermc.paperweight.util.deleteRecursively
|
||||
import io.papermc.paperweight.util.path
|
||||
import io.papermc.paperweight.util.pathOrNull
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.io.path.*
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
|
|
|
@ -22,17 +22,20 @@
|
|||
|
||||
package io.papermc.paperweight.patcher.tasks
|
||||
|
||||
import io.papermc.paperweight.tasks.ControllableOutputTask
|
||||
import io.papermc.paperweight.tasks.*
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.nio.file.Path
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.Future
|
||||
import kotlin.io.path.*
|
||||
import kotlin.io.path.createDirectories
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.options.Option
|
||||
|
||||
abstract class SimpleRebuildGitPatches : ControllableOutputTask() {
|
||||
|
|
|
@ -24,7 +24,7 @@ package io.papermc.paperweight.patcher.upstream
|
|||
|
||||
import io.papermc.paperweight.patcher.tasks.SimpleApplyGitPatches
|
||||
import io.papermc.paperweight.patcher.tasks.SimpleRebuildGitPatches
|
||||
import io.papermc.paperweight.util.providerFor
|
||||
import io.papermc.paperweight.util.*
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
|
|
|
@ -23,15 +23,13 @@
|
|||
package io.papermc.paperweight.patcher.upstream
|
||||
|
||||
import io.papermc.paperweight.patcher.tasks.PaperweightPatcherUpstreamData
|
||||
import io.papermc.paperweight.util.providerFor
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.NamedDomainObjectContainer
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.kotlin.dsl.domainObjectContainer
|
||||
import org.gradle.kotlin.dsl.newInstance
|
||||
import org.gradle.kotlin.dsl.property
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
open class DefaultPatcherUpstream(
|
||||
private val name: String,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package io.papermc.paperweight.patcher.upstream
|
||||
|
||||
import io.papermc.paperweight.patcher.tasks.CheckoutRepo
|
||||
import io.papermc.paperweight.util.providerFor
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
import org.gradle.api.model.ObjectFactory
|
||||
|
|
|
@ -46,8 +46,8 @@ maintain a consistent code style. Adjust any errors `ktlint` can't fix itself be
|
|||
|
||||
### IDE Setup
|
||||
|
||||
It's recommended to run the `ktlintApplyToIdea` and `addKtlintFormatGitPreCommitHook` tasks to configure your
|
||||
IDE with `ktlint` style settings and to automatically format this project's code before committing:
|
||||
It's recommended to run the `ktlintApplyToIdea` and `addKtlintFormatGitPreCommitHook` tasks to configure your IDE
|
||||
with `ktlint` style settings and to automatically format this project's code before committing:
|
||||
|
||||
```
|
||||
./gradlew ktlintApplyToIdea addKtlintFormatGitPreCommitHook
|
||||
|
|
Loading…
Reference in a new issue