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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
name: Deploy Snapshot
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
name: Deploy
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
name: Test
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/config-kotlin.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ testing {
val test by getting(JvmTestSuite::class) {
useKotlinTest(embeddedKotlinVersion)
dependencies {
implementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
implementation("org.junit.platform:junit-platform-launcher:1.10.1")
implementation("org.junit.jupiter:junit-jupiter-engine:5.12.2")
implementation("org.junit.jupiter:junit-jupiter-params:5.12.2")
implementation("org.junit.platform:junit-platform-launcher:1.12.2")
}

targets.configureEach {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.gradle.plugin.devel.PluginDeclaration
fun Configuration.compatibilityAttributes(objects: ObjectFactory) {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, objects.named("8.12"))
attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, objects.named("8.14"))
}
}

Expand Down
22 changes: 11 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[versions]
asm = "9.7.1"
asm = "9.8"
lorenz = "0.5.8"
hypo = "1.2.4"
serialize = "1.5.1"
serialize = "1.8.1"
jst = "1.0.68+paper.2-SNAPSHOT"
tinyRemapper = "0.10.4"
tinyRemapper = "0.11.1"

[libraries]
asm-core = { module = "org.ow2.asm:asm", version.ref = "asm" }
asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "asm" }

httpclient = "org.apache.httpcomponents:httpclient:4.5.14"
kotson = "com.github.salomonbrys.kotson:kotson:2.5.0"
coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2"
jgit = "org.eclipse.jgit:org.eclipse.jgit:7.0.0.202409031743-r"
gson = "com.google.code.gson:gson:2.10.1"
coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
jgit = "org.eclipse.jgit:org.eclipse.jgit:7.2.1.202505142326-r"
gson = "com.google.code.gson:gson:2.13.1"

cadix-lorenz-core = { module = "org.cadixdev:lorenz", version.ref = "lorenz" }
cadix-lorenz-asm = { module = "org.cadixdev:lorenz-asm", version.ref = "lorenz" }
Expand Down Expand Up @@ -42,15 +42,15 @@ jst = { module = "io.papermc.jst:jst-cli-bundle", version.ref = "jst" }
tinyRemapper = { module = "net.fabricmc:tiny-remapper", version.ref = "tinyRemapper" }

# test
mockk = "io.mockk:mockk:1.13.8"
mockk = "io.mockk:mockk:1.14.2"

# Gradle
gradle-licenser = "net.kyori:indra-licenser-spotless:3.1.3"
gradle-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.23.1"
gradle-shadow = "com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.5"
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:5.1.2"
gradle-spotless = "com.diffplug.spotless:spotless-plugin-gradle:7.0.3"
gradle-shadow = "com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.6"
gradle-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:5.2.0"
gradle-plugin-kotlin = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin" }
gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:1.2.1"
gradle-plugin-publish = "com.gradle.publish:plugin-publish-plugin:1.3.1"

[bundles]
asm = ["asm-core", "asm-tree"]
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-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 3 additions & 3 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ import org.gradle.api.attributes.Bundling
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.LibraryElements
import org.gradle.api.attributes.Usage
import org.gradle.api.problems.Problems
import org.gradle.api.problems.Severity
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.TaskProvider
Expand All @@ -73,9 +71,6 @@ abstract class PaperweightUser : Plugin<Project> {
@get:Inject
abstract val javaToolchainService: JavaToolchainService

@get:Inject
abstract val problems: Problems

override fun apply(target: Project) {
target.plugins.apply("java")

Expand Down Expand Up @@ -282,8 +277,12 @@ abstract class PaperweightUser : Plugin<Project> {
!configurations.getByName(DEV_BUNDLE_CONFIG).isEmpty
}
if (hasDevBundle.isFailure || !hasDevBundle.getOrThrow()) {
val message = "Unable to resolve a dev bundle, which is required for paperweight to function."
val message = "Unable to resolve a dev bundle, which is required for paperweight to function.\n" +
"Add a dev bundle to the 'paperweightDevelopmentBundle' configuration (the dependencies.paperweight extension can" +
" help with this), and ensure there is a repository to resolve it from (the Paper repository is used by default)."
val ex = PaperweightException(message, hasDevBundle.exceptionOrNull())
throw ex
/* TODO migrate this to the Problems API when it comes out of incubating
throw problems.reporter.throwing {
severity(Severity.ERROR)
id("paperweight-userdev-cannot-resolve-dev-bundle", message)
Expand All @@ -293,6 +292,7 @@ abstract class PaperweightUser : Plugin<Project> {
)
withException(ex)
}
*/
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
* paperweight is a Gradle plugin for the PaperMC project.
*
* Copyright (c) 2023 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.core.tasks.patchroulette

import kotlin.io.path.*
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource

class PatchRouletteApplyTest {

@Test
fun `test patch strategy parsing non enforced`() {
val strategy = PatchRouletteApply.PatchSelectionStrategy.parse("10")
when (strategy) {
is PatchRouletteApply.PatchSelectionStrategy.NumericInPackage -> {
assertEquals(10, strategy.count)
assertFalse(strategy.enforceCount)
}
}
}

@Test
fun `test patch strategy parsing enforced`() {
val strategy = PatchRouletteApply.PatchSelectionStrategy.parse("20!")
when (strategy) {
is PatchRouletteApply.PatchSelectionStrategy.NumericInPackage -> {
assertEquals(20, strategy.count)
assertTrue(strategy.enforceCount)
}
}
}

@ParameterizedTest
@MethodSource("testPatchSelectionSource")
fun `test patch selection`(
strategy: PatchRouletteApply.PatchSelectionStrategy,
allPatches: List<String>,
expectedPatchBatches: List<List<String>>
) {
var config = PatchRouletteApply.Config(listOf(), null, listOf())
var availablePatches = allPatches.map { Path(it) }
for (batch in expectedPatchBatches) {
val selectionResult = strategy.select(config, availablePatches)
assertEquals(batch.map { Path(it) }, selectionResult.second)

config = selectionResult.first
availablePatches = availablePatches - selectionResult.second
}

assertTrue(availablePatches.isEmpty(), "Patches remained after exhausting expected batches")
}

companion object {
@JvmStatic
fun testPatchSelectionSource(): Collection<Arguments> = listOf(
Arguments.of(
PatchRouletteApply.PatchSelectionStrategy.NumericInPackage(2),
mockAvailablePatches(),
listOf(
listOf("io/papermc/paper/block/Block.java", "io/papermc/paper/block/BlockData.java"),
listOf("io/papermc/paper/block/BlockState.java"),
listOf("io/papermc/paper/entity/Entity.java")
)
),
Arguments.of(
PatchRouletteApply.PatchSelectionStrategy.NumericInPackage(5),
mockAvailablePatches(),
listOf(
listOf("io/papermc/paper/block/Block.java", "io/papermc/paper/block/BlockData.java", "io/papermc/paper/block/BlockState.java"),
listOf("io/papermc/paper/entity/Entity.java")
)
),
Arguments.of(
PatchRouletteApply.PatchSelectionStrategy.NumericInPackage(2, true),
mockAvailablePatches(),
listOf(
listOf("io/papermc/paper/block/Block.java", "io/papermc/paper/block/BlockData.java"),
listOf("io/papermc/paper/block/BlockState.java", "io/papermc/paper/entity/Entity.java"),
)
),
Arguments.of(
PatchRouletteApply.PatchSelectionStrategy.NumericInPackage(5, true),
mockAvailablePatches(),
listOf(
listOf(
"io/papermc/paper/block/Block.java",
"io/papermc/paper/block/BlockData.java",
"io/papermc/paper/block/BlockState.java",
"io/papermc/paper/entity/Entity.java"
),
)
),
Arguments.of(
PatchRouletteApply.PatchSelectionStrategy.NumericInPackage(4, true),
listOf(
"io/papermc/paper/block/Block.java",
"io/papermc/paper/block/BlockData.java",
"io/papermc/paper/block/BlockState.java",
"io/papermc/paper/entity/Entity.java",
"io/papermc/paper/entity/Entity2.java",
"io/papermc/paper/entity/Entity3.java"
),
listOf(
listOf(
"io/papermc/paper/block/Block.java",
"io/papermc/paper/block/BlockData.java",
"io/papermc/paper/block/BlockState.java",
"io/papermc/paper/entity/Entity.java",
),
listOf(
"io/papermc/paper/entity/Entity2.java",
"io/papermc/paper/entity/Entity3.java"
)
)
)
)

fun mockAvailablePatches() = listOf(
"io/papermc/paper/block/Block.java",
"io/papermc/paper/block/BlockData.java",
"io/papermc/paper/block/BlockState.java",
"io/papermc/paper/entity/Entity.java"
)
}
}
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}

rootProject.name = "leavesweight"
Expand Down
Loading