Skip to content

Commit

Permalink
Bump required Java version, removed add-opens flag - closes #219
Browse files Browse the repository at this point in the history
  • Loading branch information
retrodaredevil committed Dec 5, 2024
1 parent 0abd828 commit 6ea85ac
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 27 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ buildscript {
// Note: Since Jackson 2.14, Android SDK 26 is required
// https://github.com/FasterXML/jackson/wiki/Jackson-Releases
jacksonVersion = '2.16.1' // https://github.com/FasterXML/jackson-databind/tags
// retrofit is why we need allow-opens. context: https://stackoverflow.com/questions/60915381/retrofit2-maven-project-illegal-reflective-access-warning // https://github.com/square/retrofit/issues/3341
// Note that after Java 14, this isn't a problem, so I'm not inclined to keep having add-opens because of retrofit
retrofitVersion = "2.9.0" // https://github.com/square/retrofit/tags
shadowVersion = '8.1.1' // https://github.com/johnrengelman/shadow/releases
ioLibVersion = '2.3.0' // https://github.com/retrodaredevil/io-lib/releases
Expand Down
4 changes: 2 additions & 2 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
id 'java'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

version '0.0.1-SNAPSHOT'

Expand Down
4 changes: 2 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
id 'java'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

version = '0.0.1-SNAPSHOT'

Expand Down
4 changes: 2 additions & 2 deletions docker/solarthing-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM eclipse-temurin:19-jre-jammy as builder
FROM ghcr.io/retrodaredevil/lavender-jre:21-ubuntu-jammy as builder
ARG JAR_LOCATION
COPY ${JAR_LOCATION} application.jar
RUN java -Djarmode=layertools -jar application.jar extract


FROM eclipse-temurin:19-jre-jammy
FROM ghcr.io/retrodaredevil/lavender-jre:21-ubuntu-jammy

RUN ["mkdir", "/solarthing"]
WORKDIR "/solarthing"
Expand Down
6 changes: 1 addition & 5 deletions docker/solarthing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:19-jre-jammy
FROM ghcr.io/retrodaredevil/lavender-jre:21-ubuntu-jammy
ARG JAR_LOCATION
ARG COMMIT_HASH=""
ARG REF=""
Expand All @@ -11,8 +11,4 @@ ENV REF="$REF"

RUN ["mkdir", "/app"]
WORKDIR "/app"
# Currently this entry point does not need any allow opens.
# The default raw_solarthing will run solarthing.jar with `--add-opens=java.base/java.lang.invoke=ALL-UNNAMED`
# Because Retrofit (https://stackoverflow.com/a/61259233/5434860)
# However, that bug/workaround only affects Java versions [9, 13], but we are running a higher Java version so we are unaffected.
ENTRYPOINT ["java", "-XX:ErrorFile=/app/jvmlog/hs_err_pid%p.log", "-jar", "/solarthing/solarthing.jar"]
4 changes: 2 additions & 2 deletions process-annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ plugins {
id 'java'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

version '0.0.1-SNAPSHOT'

Expand Down
6 changes: 1 addition & 5 deletions program/.bin/raw_solarthing
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

BASEDIR=$(dirname "$0")

if java --add-opens 2>&1 | grep 'requires modules' >/dev/null; then
java --add-opens=java.base/java.lang.invoke=ALL-UNNAMED -jar "$BASEDIR/../solarthing.jar" "$@"
else
java -jar "$BASEDIR/../solarthing.jar" "$@"
fi
java -jar "$BASEDIR/../solarthing.jar" "$@"
# It is important that we do not have any more commands after this because we want the exit code
# to be the same as the exit code of the java command
6 changes: 1 addition & 5 deletions program/graphql/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@ cd "$BASEDIR" || exit 1
export SOLARTHING_ROOT="../.."
source ../.scripts/use_sdkman_if_available.sh # requires bash

if java --add-opens 2>&1 | grep 'requires modules' >/dev/null; then
java --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED -jar ../solarthing-graphql.jar --spring.config.location=config/application.properties
else
java -jar ../solarthing-graphql.jar --spring.config.location=config/application.properties
fi
java -jar ../solarthing-graphql.jar --spring.config.location=config/application.properties
4 changes: 2 additions & 2 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

version = '0.0.1-SNAPSHOT'

Expand Down

0 comments on commit 6ea85ac

Please sign in to comment.