diff options
author | Kristóf Marussy <kristof@marussy.com> | 2023-04-15 19:33:07 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2023-04-15 19:33:07 +0200 |
commit | 2731c799e31d19a801142cd99460da45ae2e368f (patch) | |
tree | 5e494210972630bd37f4d61b1c9f1dcadb0cd80f | |
parent | refactor: remove virtual thread support (diff) | |
download | refinery-2731c799e31d19a801142cd99460da45ae2e368f.tar.gz refinery-2731c799e31d19a801142cd99460da45ae2e368f.tar.zst refinery-2731c799e31d19a801142cd99460da45ae2e368f.zip |
chore(deps): downgrade to Java 17
Java 19 is out of support, but Gradle current does not run on Java 20:
https://github.com/gradle/gradle/issues/23488
To avoid the complexity of running the build tool on a different JDK than the
application, we temporarily remove code that depends on experimental Java 19 or
Java 20 features.
Revert once the build can run on Java 20.
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts | 6 | ||||
-rw-r--r-- | subprojects/language-web/build.gradle.kts | 18 |
4 files changed, 7 insertions, 30 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eecb62c1..6138fad1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml | |||
@@ -27,10 +27,10 @@ jobs: | |||
27 | uses: actions/checkout@v3 | 27 | uses: actions/checkout@v3 |
28 | with: | 28 | with: |
29 | fetch-depth: ${{ !steps.check-secret.outputs.is_SONAR_TOKEN_set && 1 || 0 }} # Shallow clones should be disabled for a better relevancy of SonarCloud analysis | 29 | fetch-depth: ${{ !steps.check-secret.outputs.is_SONAR_TOKEN_set && 1 || 0 }} # Shallow clones should be disabled for a better relevancy of SonarCloud analysis |
30 | - name: Set up JDK 19 | 30 | - name: Set up JDK 17 |
31 | uses: actions/setup-java@v3 | 31 | uses: actions/setup-java@v3 |
32 | with: | 32 | with: |
33 | java-version: 19 | 33 | java-version: 17 |
34 | distribution: temurin | 34 | distribution: temurin |
35 | - name: Cache Gradle packages | 35 | - name: Cache Gradle packages |
36 | uses: actions/cache@v3 | 36 | uses: actions/cache@v3 |
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | ### With Eclipse IDE | 13 | ### With Eclipse IDE |
14 | 14 | ||
15 | 1. Download and install a _Java 19_ compatible JDK. For Windows, prefer OpenJDK builds from [Adoptium](https://adoptium.net/). | 15 | 1. Download and install a _Java 17_ compatible JDK. For Windows, prefer OpenJDK builds from [Adoptium](https://adoptium.net/). |
16 | 16 | ||
17 | 2. Download and extract the [Eclipse IDE for Java and DSL Developers 2022-09](https://www.eclipse.org/downloads/packages/release/2022-09/r/eclipse-ide-java-and-dsl-developers) package. | 17 | 2. Download and extract the [Eclipse IDE for Java and DSL Developers 2022-09](https://www.eclipse.org/downloads/packages/release/2022-09/r/eclipse-ide-java-and-dsl-developers) package. |
18 | 18 | ||
@@ -23,16 +23,15 @@ | |||
23 | 23 | ||
24 | 5. Open _Help > Eclipse Marketplace_ and install the following software: | 24 | 5. Open _Help > Eclipse Marketplace_ and install the following software: |
25 | * _EclEmma Java Code Coverage_ | 25 | * _EclEmma Java Code Coverage_ |
26 | * _Java 19 Support for Eclipse 2022-09 (4.25)_ | ||
27 | * _SonarLint_ | 26 | * _SonarLint_ |
28 | 27 | ||
29 | 6. Open _Window > Preferences_ and set the following preferences: | 28 | 6. Open _Window > Preferences_ and set the following preferences: |
30 | * _General > Workspace > Text file encoding_ should be _UTF-8_. | 29 | * _General > Workspace > Text file encoding_ should be _UTF-8_. |
31 | * _General > Workspace > New text file line delimiter_ should be _Unix_. | 30 | * _General > Workspace > New text file line delimiter_ should be _Unix_. |
32 | * Add the JDK 19 to _Java > Installed JREs_. | 31 | * Add the JDK 17 to _Java > Installed JREs_. |
33 | * Make sure JDK 19 is selected for _JavaSE-19_ at _Java > Installed JREs > Execution Environments_. | 32 | * Make sure JDK 17 is selected for _JavaSE-17_ at _Java > Installed JREs > Execution Environments_. |
34 | * Set _Gradle > Java home_ to the `JAVA_HOME` directory (the directory which contains the `bin` directory) of JDK 17. Here, Buildship will show a yellow warning sign, which can be safely ignored. | 33 | * Set _Gradle > Java home_ to the `JAVA_HOME` directory (the directory which contains the `bin` directory) of JDK 17. Here, Buildship will show a yellow warning sign, which can be safely ignored. |
35 | * Set _Java > Compiler > JDK Compliance > Compiler compliance level_ to _19_. The warning about using Java 16 system libraries during compilation should disappear. | 34 | * Set _Java > Compiler > JDK Compliance > Compiler compliance level_ to _17_. |
36 | 35 | ||
37 | 7. Clone the project Git repository but do not import it into Eclipse yet. | 36 | 7. Clone the project Git repository but do not import it into Eclipse yet. |
38 | 37 | ||
diff --git a/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts index d8deffae..7c7cbabd 100644 --- a/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/tools/refinery/gradle/internal/java-conventions.gradle.kts | |||
@@ -43,14 +43,10 @@ dependencies { | |||
43 | } | 43 | } |
44 | 44 | ||
45 | java.toolchain { | 45 | java.toolchain { |
46 | languageVersion.set(JavaLanguageVersion.of(19)) | 46 | languageVersion.set(JavaLanguageVersion.of(17)) |
47 | } | 47 | } |
48 | 48 | ||
49 | tasks { | 49 | tasks { |
50 | withType(JavaCompile::class) { | ||
51 | options.release.set(17) | ||
52 | } | ||
53 | |||
54 | test { | 50 | test { |
55 | useJUnitPlatform { | 51 | useJUnitPlatform { |
56 | excludeTags("slow") | 52 | excludeTags("slow") |
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts index e1d250ec..d398e002 100644 --- a/subprojects/language-web/build.gradle.kts +++ b/subprojects/language-web/build.gradle.kts | |||
@@ -29,13 +29,6 @@ dependencies { | |||
29 | 29 | ||
30 | application { | 30 | application { |
31 | mainClass.set("tools.refinery.language.web.ServerLauncher") | 31 | mainClass.set("tools.refinery.language.web.ServerLauncher") |
32 | // Enable JDK 19 preview features for virtual thread support. | ||
33 | applicationDefaultJvmArgs += "--enable-preview" | ||
34 | } | ||
35 | |||
36 | // Enable JDK 19 preview features for virtual thread support. | ||
37 | fun enablePreview(task: JavaForkOptions) { | ||
38 | task.jvmArgs("--enable-preview") | ||
39 | } | 32 | } |
40 | 33 | ||
41 | tasks { | 34 | tasks { |
@@ -47,16 +40,6 @@ tasks { | |||
47 | } | 40 | } |
48 | } | 41 | } |
49 | 42 | ||
50 | withType(JavaCompile::class) { | ||
51 | options.release.set(19) | ||
52 | // Enable JDK 19 preview features for virtual thread support. | ||
53 | options.compilerArgs.plusAssign("--enable-preview") | ||
54 | } | ||
55 | |||
56 | withType(Test::class) { | ||
57 | enablePreview(this) | ||
58 | } | ||
59 | |||
60 | jar { | 43 | jar { |
61 | dependsOn(webapp) | 44 | dependsOn(webapp) |
62 | from(webapp) { | 45 | from(webapp) { |
@@ -82,7 +65,6 @@ tasks { | |||
82 | dependsOn(mainRuntimeClasspath) | 65 | dependsOn(mainRuntimeClasspath) |
83 | classpath(mainRuntimeClasspath) | 66 | classpath(mainRuntimeClasspath) |
84 | mainClass.set(application.mainClass) | 67 | mainClass.set(application.mainClass) |
85 | enablePreview(this) | ||
86 | standardInput = System.`in` | 68 | standardInput = System.`in` |
87 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() | 69 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() |
88 | environment("BASE_RESOURCE", baseResource) | 70 | environment("BASE_RESOURCE", baseResource) |