diff --git a/.cspell.json b/.cspell.json index 04daa40..50421ab 100644 --- a/.cspell.json +++ b/.cspell.json @@ -11,6 +11,7 @@ "language": "en", "version": "0.1", "words": [ + "CDPATH", "CLASSPATH", "CYGWIN", "Cygwin", @@ -40,6 +41,7 @@ "atlassian", "autotools", "buildpath", + "choe", "classpath", "cmake", "codecov", @@ -49,6 +51,7 @@ "cygwin", "deps", "detekt", + "develocity", "diffplug", "dokka", "donotpresent", @@ -73,6 +76,7 @@ "ktlint", "loadpath", "metacharacter", + "mojang", "mpeltonen", "msix", "msys", @@ -88,9 +92,12 @@ "qodana", "readarray", "relases", + "remapper", "replstate", "sarif", "sbteclipse", + "shellcheck", + "shellness", "shipkit", "sonarlint", "sonatype", diff --git a/build.gradle.kts b/build.gradle.kts index bf5f023..539dd31 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ group = "dev.mythicdrops" java { toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } withJavadocJar() withSourcesJar() @@ -100,7 +100,7 @@ gradlePlugin { } ktlint { - version.set("1.1.1") + version.set("1.3.1") } tasks { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e7646de..6f7a6eb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85..7101f8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle.kts b/settings.gradle.kts index b265405..d242d3e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,7 +7,7 @@ pluginManagement { plugins { // See https://jmfayard.github.io/refreshVersions id("de.fayard.refreshVersions") version "0.60.5" - id("com.gradle.develocity") version "3.17.4" + id("com.gradle.develocity") version "3.17.5" } develocity { diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt index b55872d..a85fa58 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsJavaPlugin.kt @@ -10,7 +10,7 @@ import org.gradle.testing.jacoco.plugins.JacocoPlugin import org.gradle.testing.jacoco.plugins.JacocoPluginExtension import org.gradle.testing.jacoco.tasks.JacocoReport -const val DEFAULT_JAVA_VERSION = 17 +const val DEFAULT_JAVA_VERSION = 21 /** * Plugin that configures Java for JDK 17 and enables JaCoCo. diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt index a0a841b..5b46650 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsKotlinJvmPlugin.kt @@ -24,7 +24,7 @@ open class MythicDropsKotlinJvmPlugin : DependentPlugin("Kotlin JVM", "org.jetbr // exclude files from the build directory from being linted or formatted target.configure { - version.set("1.2.1") + version.set("1.3.1") filter { exclude { entry -> entry.file.toString().contains("generated") diff --git a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsMavenPublishPlugin.kt b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsMavenPublishPlugin.kt index a380933..1dd39aa 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsMavenPublishPlugin.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/conventions/MythicDropsMavenPublishPlugin.kt @@ -41,7 +41,12 @@ open class MythicDropsMavenPublishPlugin : DependentPlugin("Maven Publish", "mav // Uses ASCII-armored keys (typically provided on GitHub Actions) useInMemoryPgpKeys(signingParams.pgpKey, signingParams.pgpPwd) // Always sign Maven publications in case they go to Maven Central - sign(target.extensions.getByType().publications.matching { it is MavenPublication }) + sign( + target.extensions + .getByType() + .publications + .matching { it is MavenPublication }, + ) } } @@ -57,7 +62,9 @@ open class MythicDropsMavenPublishPlugin : DependentPlugin("Maven Publish", "mav val deps = root.children().find { it is groovy.util.Node && - it.name().toString() + it + .name() + .toString() .endsWith("dependencies") } as groovy.util.Node? ?: root.appendNode("dependencies") dependencies.forEach { dependency -> diff --git a/src/main/kotlin/dev/mythicdrops/gradle/spigot/RunSpigotBuildToolsTask.kt b/src/main/kotlin/dev/mythicdrops/gradle/spigot/RunSpigotBuildToolsTask.kt index 25b3dd7..cc2127a 100644 --- a/src/main/kotlin/dev/mythicdrops/gradle/spigot/RunSpigotBuildToolsTask.kt +++ b/src/main/kotlin/dev/mythicdrops/gradle/spigot/RunSpigotBuildToolsTask.kt @@ -66,59 +66,41 @@ abstract class RunSpigotBuildToolsTask : DefaultTask() { mavenLocalDirectory.mkdirs() } - normalVersion(mavenLocalDirectory, version) + javaexecSpigotBuildTools(mavenLocalDirectory, version, false) if (includeRemapped.getOrElse(false)) { - remappedVersion(mavenLocalDirectory, version) + javaexecSpigotBuildTools(mavenLocalDirectory, version, true) } } - private fun normalVersion( + private fun javaexecSpigotBuildTools( mavenLocalDirectory: File, version: String, + isRemapped: Boolean, ) { val versionJar = - mavenLocalDirectory.resolve( - "org/spigotmc/spigot/$version-R0.1-SNAPSHOT/spigot-$version-R0.1-SNAPSHOT.jar", - ) - if (versionJar.exists()) { - logger.lifecycle("Skipping $version as Spigot JAR is found at ${versionJar.absolutePath}") - return - } - val jar = buildToolsLocation.get().asFile - val versionDir = jar.parentFile.resolve(version) - fileSystemOperations.copy { - from(jar) - into(versionDir) - } - execOperations.javaexec { - args(listOf("--rev", version)) - workingDir = versionDir.absoluteFile - jvmArgs = listOf("-Xmx1024M") - classpath(buildToolsLocation) - executable(launcher.get().executablePath) - } - } + if (isRemapped) { + mavenLocalDirectory.resolve( + "org/spigotmc/spigot/$version-R0.1-SNAPSHOT/spigot-$version-R0.1-SNAPSHOT-remapped-mojang.jar", + ) + } else { + mavenLocalDirectory.resolve( + "org/spigotmc/spigot/$version-R0.1-SNAPSHOT/spigot-$version-R0.1-SNAPSHOT.jar", + ) + } - private fun remappedVersion( - mavenLocalDirectory: File, - version: String, - ) { - val versionJar = - mavenLocalDirectory.resolve( - "org/spigotmc/spigot/$version-R0.1-SNAPSHOT/spigot-$version-R0.1-SNAPSHOT-remapped-mojang.jar", - ) if (versionJar.exists()) { - logger.lifecycle("Skipping $version as Spigot remapped JAR is found at ${versionJar.absolutePath}") + logger.lifecycle("Skipping $version as Spigot JAR is found at ${versionJar.absolutePath}") return } val jar = buildToolsLocation.get().asFile val versionDir = jar.parentFile.resolve(version) + val args = listOfNotNull("--rev", version, if (isRemapped) "--remapped" else null) fileSystemOperations.copy { from(jar) into(versionDir) } execOperations.javaexec { - args(listOf("--rev", version, "--remapped")) + args(args) workingDir = versionDir.absoluteFile jvmArgs = listOf("-Xmx1024M") classpath(buildToolsLocation) diff --git a/version.properties b/version.properties index 80f95e5..368eae2 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=8.0.* +version=9.0.* diff --git a/versions.properties b/versions.properties index 302c49d..1c6a29f 100644 --- a/versions.properties +++ b/versions.properties @@ -15,7 +15,7 @@ plugin.org.jetbrains.dokka=1.9.20 plugin.org.jlleitschuh.gradle.ktlint=12.1.1 -plugin.org.shipkit.shipkit-auto-version=2.0.7 +plugin.org.shipkit.shipkit-auto-version=2.0.9 plugin.org.shipkit.shipkit-changelog=2.0.1 @@ -23,7 +23,7 @@ plugin.org.shipkit.shipkit-github-release=2.0.1 plugin.com.adarshr.test-logger=4.0.0 -version.org.shipkit..shipkit-auto-version=2.0.7 +version.org.shipkit..shipkit-auto-version=2.0.9 version.org.shipkit..shipkit-changelog=2.0.1 @@ -41,6 +41,6 @@ version.org.jlleitschuh.gradle..ktlint-gradle=12.1.1 version.io.github.gradle-nexus..publish-plugin=2.0.0 -version.org.kohsuke..github-api=1.321 +version.org.kohsuke..github-api=1.323 version.io.github.patrick-choe..mojang-spigot-remapper=1.4.2