PaperMC / paperweight

Gradle build system plugin for Paper and Paper forks
239 stars 47 forks source link

Kotlin 2.0.20 breaks patcher in fork #254

Open scrayos opened 3 months ago

scrayos commented 3 months ago

I've added the kotlin(jvm) gradle plugin through api and server patches in my fork of Paper. This worked fine for every version I included so far, but did break now that I've bumped Kotlin to version 2.0.20 (from 2.0.0). This is the error message when I execute ./gradlew generateDevelopmentBundle:

> Configure project :
paperweight-patcher v1.7.2 (running on 'Linux')

> Configure project :paper
paperweight-core v1.7.1 (running on 'Linux')

> Task :generateDevelopmentBundle
Using 'diff (GNU diffutils) 3.10'.

> Task :generateDevelopmentBundle FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateDevelopmentBundle'.
> Collection contains no element matching the predicate.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1m 28s
24 actionable tasks: 16 executed, 5 from cache, 3 up-to-date

When I executed this with --stacktrace it was printing this stacktrace:

Caused by: java.util.NoSuchElementException: Collection contains no element matching the predicate.
        at io.papermc.paperweight.tasks.GenerateDevBundle.determineLibraries(GenerateDevBundle.kt:403)
        at io.papermc.paperweight.tasks.GenerateDevBundle.createBuildDataConfig(GenerateDevBundle.kt:279)
        at io.papermc.paperweight.tasks.GenerateDevBundle.createBundleConfig(GenerateDevBundle.kt:265)
        at io.papermc.paperweight.tasks.GenerateDevBundle.run(GenerateDevBundle.kt:145)

These seem to be the lines in question:

            val version = listOfNotNull(
                dependency.versionConstraint.strictVersion,
                dependency.versionConstraint.requiredVersion,
                dependency.versionConstraint.preferredVersion,
                dependency.version
            ).first { it.isNotBlank() }

So it's probably something about the injected dependencies of Kotlin. I'm using paperweight.patcher version 1.7.2 and use upstream commit https://github.com/PaperMC/Paper/commit/2fdb2e9dcdfb127cb99134f9bec60dcc2a6954d2 (latest).

scrayos commented 2 days ago

Sadly, this still does not work with paperweight v1.7.5 and Kotlin 2.0.21 (Gradle 8.10.2) and upstream commit https://github.com/PaperMC/Paper/commit/c28d89d625c60243c52857e0c7e6398b73602156.