Skip to content

Commit

Permalink
Fix java 21 build (micronaut-projects#1925)
Browse files Browse the repository at this point in the history
* Update common files

* fix build for Java 21

---------

Co-authored-by: micronaut-build <[email protected]>
  • Loading branch information
wetted and micronaut-build authored Oct 20, 2023
1 parent 0f6deb7 commit d93ed9a
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ end_of_line = lf
[{*.bat,*.cmd}]
end_of_line = crlf

[{*.mustache,*.ftl}]
insert_final_newline = false

[*.java]
indent_size = 4
tab_width = 4
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/graalvm-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
max-parallel: 6
matrix: ${{ fromJson(needs.build_matrix.outputs.matrix) }}
matrix:
java: ['17', '21']
native_test_task: ${{ fromJson(needs.build_matrix.outputs.matrix).native_test_task }}
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
Expand All @@ -46,7 +48,7 @@ jobs:
id: pre-build
with:
distribution: 'graalvm'
java: '17'
java: ${{ matrix.java }}
- name: Build Steps
uses: micronaut-projects/github-actions/graalvm/build@master
id: build
Expand All @@ -60,4 +62,4 @@ jobs:
uses: micronaut-projects/github-actions/graalvm/post-build@master
id: post-build
with:
java: '17'
java: ${{ matrix.java }}
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['17']
java: ['17', '21']
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
./gradlew check --no-daemon --continue
- name: "🔎 Run static analysis"
if: env.SONAR_TOKEN != ''
if: env.SONAR_TOKEN != '' && matrix.java == '17'
run: |
./gradlew sonar
Expand Down
13 changes: 13 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,16 @@ developers=Graeme Rocher
org.gradle.caching=true
# For sonarqube
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1g

# No matter which Java toolchain we use, the Kotlin Daemon is always invoked by the current JDK.
# Therefor to fix Kapt errors when running tests under Java 21, we need to open up some modules for the Kotlin Daemon.
kotlin.daemon.jvmargs=--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED\
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ micronaut = "4.1.9"
micronaut-docs = "2.0.0"
micronaut-test = "4.0.2"
micronaut-testresources = "2.0.0"
groovy = "4.0.13"
groovy = "4.0.15"
spock = "2.3-groovy-4.0"

bouncycastle = '1.70'
Expand Down Expand Up @@ -53,7 +53,6 @@ micronaut-gradle-plugin = "4.1.1"
javapoet = { module = "com.squareup:javapoet", version.ref = "javapoet" }

micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' }
micronaut-logging = { module = "io.micronaut.discovery:micronaut-logging-bom", version.ref = "micronaut-logging" }
micronaut-discovery-client = { module = "io.micronaut.discovery:micronaut-discovery-client-bom", version.ref = "micronaut-discovery" }
micronaut-groovy = { module = "io.micronaut.groovy:micronaut-groovy-bom", version.ref = "micronaut-groovy" }
micronaut-mongodb = { module = "io.micronaut.mongodb:micronaut-mongo-bom", version.ref = "micronaut-mongodb" }
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pluginManagement {
}

plugins {
id("io.micronaut.build.shared.settings") version "6.5.7"
id("io.micronaut.build.shared.settings") version "6.6.0"
}

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
Expand Down
11 changes: 11 additions & 0 deletions test-suite-aws-lambda-events/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
plugins {
id("java-library")
id("io.micronaut.build.internal.common")
}
dependencies {
api(libs.aws.lambda.java.runtimeinterfaceclient)
api(libs.managed.aws.lambda.events)
implementation(mnTest.micronaut.test.junit5)
implementation(projects.micronautFunctionAws)
}

spotless {
java {
targetExclude("**/lambda/events/**")
}
}

tasks.withType<Checkstyle> {
enabled = false
}
13 changes: 4 additions & 9 deletions test-suite-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,11 @@ tasks {
named("test", Test::class) {
useJUnitPlatform()
}
}

named("compileTestKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
kotlinOptions {
jvmTarget = "17"
javaParameters = true
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

java {
sourceCompatibility = JavaVersion.toVersion("17")
targetCompatibility = JavaVersion.toVersion("17")
}
11 changes: 11 additions & 0 deletions test-suite/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("java-library")
id("io.micronaut.build.internal.aws-tests-java")
id("io.micronaut.build.internal.common")
}
dependencies {
testImplementation(projects.micronautFunctionAws)
Expand All @@ -16,3 +17,13 @@ tasks {
systemProperty("aws.region", "us-east-1")
}
}

spotless {
java {
targetExclude("**/docs/**")
}
}

tasks.withType<Checkstyle> {
enabled = false
}

0 comments on commit d93ed9a

Please sign in to comment.