Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
git config --global user.name "GitHub Actions"
./gradlew build --no-daemon --stacktrace
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
uses: mikepenz/action-junit-report@v6
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/config-kotlin.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ testing {
val test by getting(JvmTestSuite::class) {
useKotlinTest(embeddedKotlinVersion)
dependencies {
implementation("org.junit.jupiter:junit-jupiter-engine:6.0.0")
implementation("org.junit.jupiter:junit-jupiter-params:6.0.0")
implementation("org.junit.platform:junit-platform-launcher:6.0.0")
implementation("org.junit.jupiter:junit-jupiter-engine:6.0.3")
implementation("org.junit.jupiter:junit-jupiter-params:6.0.3")
implementation("org.junit.platform:junit-platform-launcher:6.0.3")
}

targets.configureEach {
Expand Down
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
asm = "9.9"
asm = "9.9.1"
lorenz = "0.5.8"
hypo = "1.2.4"
serialize = "1.9.0"
Expand Down Expand Up @@ -44,13 +44,13 @@ jst = { module = "io.canvasmc.jst:jst-cli-bundle", version.ref = "jst" }
tinyRemapper = { module = "net.fabricmc:tiny-remapper", version.ref = "tinyRemapper" }

# test
mockk = "io.mockk:mockk:1.14.6"
mockk = "io.mockk:mockk:1.14.9"

# Gradle
gradle-licenser = "net.kyori:indra-licenser-spotless:4.0.0"
gradle-spotless = "com.diffplug.spotless:spotless-plugin-gradle:8.0.0"
gradle-shadow = "com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.2.2"
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:6.2.0"
gradle-shadow = "com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.3.2"
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:6.4.2"
gradle-plugin-kotlin = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin" }
gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:2.0.0"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import io.papermc.paperweight.core.tasks.patching.ApplyFilePatches
import io.papermc.paperweight.core.tasks.patching.RebuildFilePatches
import io.papermc.paperweight.core.tasks.patchroulette.PatchRouletteTasks
import io.papermc.paperweight.core.util.coreExt
import io.papermc.paperweight.core.util.createBuildTasks
import io.papermc.paperweight.tasks.*
import io.papermc.paperweight.util.*
import io.papermc.paperweight.util.constants.*
Expand Down Expand Up @@ -143,18 +142,7 @@ abstract class PaperweightCore : Plugin<Project> {
}
}

val jar = target.tasks.named("jar", AbstractArchiveTask::class)
tasks.generateReobfMappings {
inputJar.set(jar.flatMap { it.archiveFile })
}
tasks.generateRelocatedReobfMappings {
inputJar.set(jar.flatMap { it.archiveFile })
}
val (mappedJar, reobfJar) = target.createBuildTasks(
ext.spigot,
ext.reobfPackagesToFix,
tasks.generateRelocatedReobfMappings.flatMap { it.outputMappings },
)
val serverJar = target.tasks.named("jar", AbstractArchiveTask::class).flatMap { it.archiveFile }

PaperclipTasks(
target,
Expand All @@ -163,8 +151,7 @@ abstract class PaperweightCore : Plugin<Project> {
tasks.extractFromBundler.flatMap { it.versionJson },
tasks.extractFromBundler.flatMap { it.serverLibrariesList },
tasks.downloadServerJar.flatMap { it.outputJar },
mappedJar,
reobfJar,
serverJar,
ext.minecraftVersion,
ext.activeFork.map { it.name }.orElse("paper")
)
Expand Down Expand Up @@ -213,10 +200,10 @@ abstract class PaperweightCore : Plugin<Project> {
tasks.afterEvaluate()

devBundleTasks.configureAfterEvaluate(
mappedJar,
serverJar,
)

if (coreExt.updatingMinecraft.oldPaperCommit.isPresent) {
if (coreExt.updatingMinecraft.oldPaperCommit.isPresent || target.providers.gradleProperty("updatingMinecraft").orNull == "true") {
tasks.paperPatchingTasks.applyBasePatches.configure {
additionalRemote = layout.cache.resolve(
"$OLD_PAPER_PATH/${coreExt.updatingMinecraft.oldPaperCommit.get()}/paper-server/src/minecraft/java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,8 @@ abstract class PaperweightCoreExtension @Inject constructor(objects: ObjectFacto
listOf("/*.class", "/net/minecraft/**", "/com/mojang/math/**")
)

val reobfPackagesToFix: ListProperty<String> = objects.listProperty()

val spigot = objects.newInstance<SpigotExtension>().also { spigot ->
spigot.enabled.convention(
spigot.buildDataRef.zip(spigot.packageVersion) { ref, pkg -> ref.isNotBlank() && pkg.isNotBlank() }
.orElse(false)
)
}
val paper = objects.newInstance<PaperExtension>(project)

@Suppress("unused")
fun spigot(action: Action<in SpigotExtension>) {
action.execute(spigot)
}

@Suppress("unused")
fun paper(action: Action<in PaperExtension>) {
action.execute(paper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class AllTasks(
cache: Path = project.layout.cache,
extension: PaperweightCoreExtension = project.coreExt,
downloadService: Provider<DownloadService> = project.download
) : SpigotTasks(project) {
) : InitialTasks(project) {

val downloadMcLibrariesSources by tasks.registering<DownloadMcLibraries> {
mcLibrariesFile.set(extractFromBundler.flatMap { it.serverLibrariesTxt })
Expand Down Expand Up @@ -74,30 +74,4 @@ open class AllTasks(

downloader.set(downloadService)
}

val generateReobfMappings by tasks.registering<GenerateReobfMappings> {
inputMappings.set(patchMappings.flatMap { it.outputMappings })
notchToSpigotMappings.set(generateSpigotMappings.flatMap { it.notchToSpigotMappings })
sourceMappings.set(generateMappings.flatMap { it.outputMappings })
// TODO: spigot uses javac now(?) so is this needed anymore?
// spigotRecompiledClasses.set(remapSpigotSources.flatMap { it.spigotRecompiledClasses })

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())

fromNamespace.set(DEOBF_NAMESPACE)
toNamespace.set(SPIGOT_NAMESPACE)

outputMappings.set(cache.resolve(PATCHED_REOBF_MOJANG_SPIGOT_MAPPINGS))
}

val generateRelocatedReobfMappings by tasks.registering<GenerateRelocatedReobfMappings> {
inputMappings.set(patchReobfMappings.flatMap { it.outputMappings })
outputMappings.set(cache.resolve(RELOCATED_PATCHED_REOBF_MOJANG_SPIGOT_MAPPINGS))
craftBukkitPackageVersion.set(extension.spigot.packageVersion)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ class CoreTasks(

val macheRemapJar by tasks.registering(RunCodebook::class) {
serverJar.set(extractFromBundler.flatMap { it.serverJar })
serverMappings.set(downloadMappings.flatMap { it.outputFile })

remapperArgs.set(mache.map { it.remapperArgs })
codebookArgs.set(mache.map { it.remapperArgs })
codebookClasspath.from(project.configurations.named(MACHE_CODEBOOK_CONFIG))
minecraftClasspath.from(project.configurations.named(MACHE_MINECRAFT_LIBRARIES_CONFIG))
remapperClasspath.from(project.configurations.named(MACHE_REMAPPER_CONFIG))
paramMappings.from(project.configurations.named(MACHE_PARAM_MAPPINGS_CONFIG))
constants.from(project.configurations.named(MACHE_CONSTANTS_CONFIG))

outputJar.set(layout.cache.resolve(FINAL_REMAPPED_CODEBOOK_JAR))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ class DevBundleTasks(

minecraftVersion.set(project.coreExt.minecraftVersion)
mojangMappedPaperclipFile.set(paperclipForDevBundle.flatMap { it.outputZip })
reobfMappingsFile.set(
project.coreExt.spigot.enabled.flatMap {
if (it) {
coreTasks.generateRelocatedReobfMappings.flatMap { t -> t.outputMappings }
} else {
null
}
}
)
}

fun configureAfterEvaluate(serverJar: Provider<RegularFile>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ open class InitialTasks(
}
private val versionManifest = downloadMcVersionManifest.flatMap { it.outputFile }.map { gson.fromJson<MinecraftVersionManifest>(it) }

val downloadMappings by tasks.registering<CacheableDownloadTask> {
url.set(versionManifest.map { version -> version.serverMappingsDownload().url })
expectedHash.set(versionManifest.map { version -> version.serverMappingsDownload().hash() })
outputFile.set(cache.resolve(SERVER_MAPPINGS))

downloader.set(downloadService)
}

val downloadServerJar by tasks.registering<DownloadServerJar> {
downloadUrl.set(versionManifest.map { version -> version.serverDownload().url })
expectedHash.set(versionManifest.map { version -> version.serverDownload().hash() })
Expand All @@ -96,18 +88,4 @@ open class InitialTasks(
serverLibraryJars.set(cache.resolve(MINECRAFT_JARS_PATH))
serverJar.set(cache.resolve(SERVER_JAR))
}

val filterVanillaJar by tasks.registering<FilterJar> {
inputJar.set(extractFromBundler.flatMap { it.serverJar })
includes.set(extension.vanillaJarIncludes)
}

val generateMappings by tasks.registering<GenerateMappings> {
vanillaJar.set(filterVanillaJar.flatMap { it.outputJar })
libraries.from(extractFromBundler.map { it.serverLibraryJars.asFileTree })

vanillaMappings.set(downloadMappings.flatMap { it.outputFile })

outputMappings.set(cache.resolve(MOJANG_MAPPINGS))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package io.papermc.paperweight.core.taskcontainers

import com.google.gson.JsonObject
import io.papermc.paperweight.core.util.reobfRequiresDebug
import io.papermc.paperweight.tasks.*
import io.papermc.paperweight.util.*
import io.papermc.paperweight.util.constants.*
Expand All @@ -46,28 +45,16 @@ class PaperclipTasks(
private val bundlerVersionJson: Provider<RegularFile>,
private val serverLibrariesList: Provider<RegularFile>,
private val vanillaJar: Provider<RegularFile>,
mojangJar: Provider<RegularFile>,
reobfJar: Provider<RegularFile>,
serverJar: Provider<RegularFile>,
private val mcVersion: Provider<String>,
private val forkName: Provider<String>
) {
init {
val (createBundlerJar, createPaperclipJar, createPublisherJar) = project.createTasks("mojmap")
val (createReobfBundlerJar, createReobfPaperclipJar, createReobfPublisherJar) = project.createTasks("reobf")

createBundlerJar.serverJar(mojangJar)
createReobfBundlerJar.serverJar(reobfJar) {
reobfRequiresDebug()
}
val (createBundlerJar, createPaperclipJar, createPublisherJar) = project.createTasks()

createBundlerJar.serverJar(serverJar)
createPaperclipJar.bundlerJar(createBundlerJar)
createReobfPaperclipJar.bundlerJar(createReobfBundlerJar) {
reobfRequiresDebug()
}

createReobfPublisherJar {
reobfRequiresDebug()
}
createPublisherJar.paperclipJar(createPaperclipJar)
}

private fun Project.createTasks(
Expand Down Expand Up @@ -98,7 +85,6 @@ class PaperclipTasks(
group = "bundling"
description = "Build a ready-to-publish paperclip jar"

inputZip.set(paperclipJarTask.flatMap { it.outputZip })
outputZip.convention(layout.buildDirectory.file(jarName("publisher", classifier).map { "libs/$it" }))
}
return Triple(bundlerJarTask, paperclipJarTask, publisherJarTask)
Expand All @@ -115,7 +101,7 @@ class PaperclipTasks(
).joinToString("-") + ".jar"
}
} else {
val buildNum = project.providers.environmentVariable("BUILD_NUMBER").orElse("local")
val buildNum = providers.environmentVariable("BUILD_NUMBER").orElse("local")
forkName.zip(buildNum) { name, build ->
"$name-build.$build.jar"
}
Expand Down Expand Up @@ -172,6 +158,15 @@ class PaperclipTasks(
op.execute(this)
}

private fun TaskProvider<CreatePublisherJar>.paperclipJar(
createPaperclipJar: TaskProvider<CreatePaperclipJar>,
op: Action<CreatePublisherJar> = Action {},
) = configure {
inputZip.set(createPaperclipJar.flatMap { it.outputZip })

op.execute(this)
}

companion object {
fun NamedDomainObjectContainer<CreateBundlerJar.VersionArtifact>.registerVersionArtifact(
name: String,
Expand Down
Loading
Loading