Skip to content

Commit

Permalink
bump version of java to 21 (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ToppleTheNun authored Jul 5, 2024
1 parent 4d40e30 commit 8422d77
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 63 deletions.
7 changes: 7 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"language": "en",
"version": "0.1",
"words": [
"CDPATH",
"CLASSPATH",
"CYGWIN",
"Cygwin",
Expand Down Expand Up @@ -40,6 +41,7 @@
"atlassian",
"autotools",
"buildpath",
"choe",
"classpath",
"cmake",
"codecov",
Expand All @@ -49,6 +51,7 @@
"cygwin",
"deps",
"detekt",
"develocity",
"diffplug",
"dokka",
"donotpresent",
Expand All @@ -73,6 +76,7 @@
"ktlint",
"loadpath",
"metacharacter",
"mojang",
"mpeltonen",
"msix",
"msys",
Expand All @@ -88,9 +92,12 @@
"qodana",
"readarray",
"relases",
"remapper",
"replstate",
"sarif",
"sbteclipse",
"shellcheck",
"shellness",
"shipkit",
"sonarlint",
"sonatype",
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ group = "dev.mythicdrops"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion.set(JavaLanguageVersion.of(21))
}
withJavadocJar()
withSourcesJar()
Expand Down Expand Up @@ -100,7 +100,7 @@ gradlePlugin {
}

ktlint {
version.set("1.1.1")
version.set("1.3.1")
}

tasks {
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.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ 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
case $MAX_FD in #(
'' | 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
Expand Down Expand Up @@ -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" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<KtlintExtension> {
version.set("1.2.1")
version.set("1.3.1")
filter {
exclude { entry ->
entry.file.toString().contains("generated")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PublishingExtension>().publications.matching { it is MavenPublication })
sign(
target.extensions
.getByType<PublishingExtension>()
.publications
.matching { it is MavenPublication },
)
}
}

Expand All @@ -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 ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=8.0.*
version=9.0.*
6 changes: 3 additions & 3 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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

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

Expand All @@ -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

0 comments on commit 8422d77

Please sign in to comment.