Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(gradle): update Gradle and dependencies #715

Merged
merged 11 commits into from
Jun 21, 2024
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/asset-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK 14
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 14
java-version: 17
java-package: jdk
- name: Bundle distribution for ${{ matrix.platform }}
run: ./gradlew -Prelease.useLastTag=true ${{ matrix.platform }}DistZip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 15
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'liberica'
java-version: '15'
java-version: '17'
cache: 'gradle'
- name: Build
run: ./gradlew jar
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
config-name: release-drafter-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .idea/misc.xml

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

1 change: 1 addition & 0 deletions .idea/runConfigurations/Test_All.xml

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

33 changes: 18 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
plugins {
id 'application'
id 'checkstyle'
id "com.github.spotbugs" version "5.0.13"
id "com.github.spotbugs" version "5.2.3"
id 'de.undercouch.download' version '5.3.0'
id 'java'
// to help clarify conflicting logging providers
Expand Down Expand Up @@ -75,8 +75,7 @@ repositories {
maven {
// MovingBlocks Artifactory instance(s) for libs not readily available elsewhere plus our own libs
name "Terasology Artifactory"
url "http://artifactory.terasology.org/artifactory/virtual-repo-live"
allowInsecureProtocol true
url "https://artifactory.terasology.io/artifactory/virtual-repo-live"
}
maven {
name "JitPack" // used by org.everit.json.schema
Expand Down Expand Up @@ -110,16 +109,16 @@ dependencies {
because "de-/serialization of launcher properties to JSON"
}

implementation('com.squareup.okhttp3:okhttp:4.10.0') {
implementation('com.squareup.okhttp3:okhttp:4.12.0') {
because "built-in caching of HTTP requests"
}

// These dependencies are only needed for running tests

testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'

testImplementation('org.mockito:mockito-inline:5.2.0') {
because "-inline build enables mocking final classes"
Expand All @@ -128,25 +127,23 @@ dependencies {
}
testImplementation 'org.mockito:mockito-junit-jupiter:5.2.0'

testImplementation('org.spf4j:spf4j-slf4j-test:8.9.5') {
testImplementation('org.spf4j:spf4j-slf4j-test:8.10.0') {
because "testable logging"
}
testImplementation("org.slf4j:slf4j-api:1.7.+!!") {
because "spf4j-slf4j-test:8.8 needs slf4j-api:1.x"
}
testImplementation('org.slf4j:slf4j-api:2.0.13')

testImplementation("org.testfx:testfx-core:4.0.16-alpha") {
testImplementation("org.testfx:testfx-core:4.0.18") {
because "to test JavaFX Application"
// -alpha because that's the only kind of release they have?
}
testImplementation "org.testfx:testfx-junit5:4.0.16-alpha"
testImplementation "org.testfx:testfx-junit5:4.0.18"

testImplementation("org.testfx:openjfx-monocle:jdk-12.0.1+2") {
testImplementation("org.testfx:openjfx-monocle:17.0.10") {
// nobody's uploaded a jdk-14 build yet. does the jdk-12 one work?
because "CI builders are headless environments"
}

testImplementation('com.github.gmazzo:okhttp-mock:1.5.0') {
testImplementation('com.github.gmazzo.okhttp.mock:mock-client:2.0.0') {
because "to easily write OkHttpClient interceptors for testing"
}
testImplementation('com.squareup.okhttp3:mockwebserver:4.10.0') {
Expand All @@ -163,6 +160,8 @@ configurations.matching({ it =~ ~/test(Runtime|Compile|Implementation|PmdAux)Cla
resolutionStrategy(gradlegoo.prefers("logging", "slf4j-impl-capability",
"spf4j-slf4j-test", "tests use slf4j-test"))

// SPF4J has a dependency on "avro-logical-types-gen:1.3", which does not exist. However, version "1.3p" does.
resolutionStrategy.force('org.spf4j:avro-logical-types-gen:1.3p')
// old hamcrest versions exist only to spite us
// http://hamcrest.org/JavaHamcrest/distributables#upgrading-from-hamcrest-1x
exclude group: "org.hamcrest", module: "hamcrest-core"
Expand All @@ -187,6 +186,10 @@ javafx {

test {
useJUnitPlatform()

// The SPF4J test dependency relies on some forbidden reflection to improve logging performance.
// Java 17 will not tolerate this without a bit of encouragement.
jvmArgs("--add-opens=java.logging/java.util.logging=ALL-UNNAMED")
}

checkstyle {
Expand Down
4 changes: 2 additions & 2 deletions buildscript-gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.fasterxml.jackson:jackson-bom:2.11.0=classpath
com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.13=classpath
com.github.spotbugs:com.github.spotbugs.gradle.plugin:5.0.13=classpath
com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.3=classpath
com.github.spotbugs:com.github.spotbugs.gradle.plugin:5.2.3=classpath
com.github.zafarkhaja:java-semver:0.9.0=classpath
com.google.code.findbugs:jsr305:3.0.2=classpath
com.google.code.gson:gson:2.8.6=classpath
Expand Down
2 changes: 1 addition & 1 deletion config/gradle/jre.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// Uses Bellsoft Liberica JRE
// https://bell-sw.com/pages/liberica_install_guide-11.0.16.1/
def jdkVersion = '11.0.16.1+1'
def jdkVersion = '17.0.11+12'
def jreUrlFilenames = [
Linux64 : 'linux-amd64-full.tar.gz',
Windows64 : 'windows-amd64-full.zip',
Expand Down
14 changes: 7 additions & 7 deletions gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ com.openhtmltopdf:openhtmltopdf-core:1.0.10=compileClasspath
com.openhtmltopdf:openhtmltopdf-jsoup-dom-converter:1.0.0=compileClasspath
com.openhtmltopdf:openhtmltopdf-pdfbox:1.0.10=compileClasspath
com.openhtmltopdf:openhtmltopdf-rtl-support:1.0.10=compileClasspath
com.squareup.okhttp3:okhttp:4.10.0=compileClasspath
com.squareup.okio:okio-jvm:3.0.0=compileClasspath
com.squareup.okio:okio:3.0.0=compileClasspath
com.squareup.okhttp3:okhttp:4.12.0=compileClasspath
com.squareup.okio:okio-jvm:3.6.0=compileClasspath
com.squareup.okio:okio:3.6.0=compileClasspath
com.vladsch.flexmark:flexmark-all:0.64.0=compileClasspath
com.vladsch.flexmark:flexmark-ext-abbreviation:0.64.0=compileClasspath
com.vladsch.flexmark:flexmark-ext-admonition:0.64.0=compileClasspath
Expand Down Expand Up @@ -87,10 +87,10 @@ org.apache.pdfbox:pdfbox:2.0.24=compileClasspath
org.apache.pdfbox:xmpbox:2.0.24=compileClasspath
org.checkerframework:checker-qual:3.12.0=compileClasspath
org.hildan.fxgson:fx-gson:5.0.0=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.20=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib:1.6.20=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib-common:1.9.10=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.10=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10=compileClasspath
org.jetbrains.kotlin:kotlin-stdlib:1.9.10=compileClasspath
org.jetbrains:annotations:23.0.0=compileClasspath
org.json:json:20220320=compileClasspath
org.jsoup:jsoup:1.14.3=compileClasspath
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 22 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# 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"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
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=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=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# 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.

# 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, 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
21 changes: 11 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -42,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 @@ -56,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
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@
.build();
logger.debug("Github rate limit: {}", github.getRateLimit());
} catch (HttpException e) {
if (e.getResponseCode() == -1) { // NOPMD
// no internet connection, do nothing
} else {
if (e.getResponseCode() != -1) {
// if -1, no internet connection, do nothing, otherwise print stacktrace
e.printStackTrace();
BenjaminAmos marked this conversation as resolved.
Show resolved Hide resolved
}
} catch (IOException e) {

e.printStackTrace();
}
}
Expand Down Expand Up @@ -100,7 +98,7 @@
logger.debug("Github rate limit: {}", github.getRateLimit());
return releases;
} catch (HttpException e) {
if (e.getResponseCode() == -1) { // NOPMD

Check warning on line 101 in src/main/java/org/terasology/launcher/repositories/GithubRepository.java

View check run for this annotation

Check Run Reporter / code-analysis

com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck

com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck: Must have at least one statement.
// no internet connection, do nothing
} else {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public class TestGameStarter {
static final String GAME_ARG_1 = "--no-splash";
static final String GAME_DIR = "game";
static final String GAME_DATA_DIR = "game_data";
static final JavaHeapSize HEAP_MIN = JavaHeapSize.NOT_USED;
static final JavaHeapSize HEAP_MAX = JavaHeapSize.GB_4;
static final Level LOG_LEVEL = Level.INFO;

private final FileSystem fs = FileSystems.getDefault();
Expand All @@ -56,8 +54,9 @@ private GameStarter newStarter() throws IOException {
}

private GameStarter newStarter(Path relativeGameJarPath) throws IOException {
return new GameStarter(new StubGameInstallation(gamePath, relativeGameJarPath),
gameDataPath, HEAP_MIN, HEAP_MAX, javaParams, gameParams, LOG_LEVEL);
StubGameInstallation stubgameinstall = new StubGameInstallation(gamePath, relativeGameJarPath);
return new GameStarter(stubgameinstall,
gameDataPath, JavaHeapSize.NOT_USED, JavaHeapSize.GB_4, javaParams, gameParams, LOG_LEVEL);
}

@Test
Expand Down
Loading