From 87fd4ed496e07ad8579f6daeeaa608b7b531f44b Mon Sep 17 00:00:00 2001 From: Dean Wette Date: Fri, 20 Oct 2023 09:26:24 -0500 Subject: [PATCH] Fix java 21 (#233) * Update common files * fix build for Java 21 --------- Co-authored-by: micronaut-build --- .editorconfig | 3 +++ .github/workflows/central-sync.yml | 2 +- .github/workflows/graalvm-dev.yml | 4 ++-- .github/workflows/graalvm-latest.yml | 14 ++++++++------ .github/workflows/gradle.yml | 8 ++++---- .github/workflows/publish-snapshot.yml | 2 +- .github/workflows/release.yml | 4 ++-- gradle.properties | 13 +++++++++++-- gradle/libs.versions.toml | 1 - settings.gradle | 2 +- test-suite-kotlin/build.gradle | 9 +++------ 11 files changed, 36 insertions(+), 26 deletions(-) diff --git a/.editorconfig b/.editorconfig index a9a165ba..6ef5d690 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/central-sync.yml b/.github/workflows/central-sync.yml index ea5a5aa5..713f8789 100644 --- a/.github/workflows/central-sync.yml +++ b/.github/workflows/central-sync.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: v${{ github.event.inputs.release_version }} - uses: gradle/wrapper-validation-action@v1 diff --git a/.github/workflows/graalvm-dev.yml b/.github/workflows/graalvm-dev.yml index 9c7a33e1..ecd870d6 100644 --- a/.github/workflows/graalvm-dev.yml +++ b/.github/workflows/graalvm-dev.yml @@ -18,7 +18,7 @@ jobs: outputs: matrix: ${{ steps.build-matrix.outputs.matrix }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build Matrix uses: micronaut-projects/github-actions/graalvm/build-matrix@master id: build-matrix @@ -34,7 +34,7 @@ jobs: GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }} GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Pre-Build Steps uses: micronaut-projects/github-actions/graalvm/pre-build@master id: pre-build diff --git a/.github/workflows/graalvm-latest.yml b/.github/workflows/graalvm-latest.yml index b795fe40..d150aa60 100644 --- a/.github/workflows/graalvm-latest.yml +++ b/.github/workflows/graalvm-latest.yml @@ -24,7 +24,7 @@ jobs: outputs: matrix: ${{ steps.build-matrix.outputs.matrix }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build Matrix uses: micronaut-projects/github-actions/graalvm/build-matrix@master id: build-matrix @@ -34,19 +34,21 @@ 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 }} GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Pre-Build Steps uses: micronaut-projects/github-actions/graalvm/pre-build@master id: pre-build with: - distribution: 'graalvm-community' - java: '17' + distribution: 'graalvm' + java: ${{ matrix.java }} - name: Build Steps uses: micronaut-projects/github-actions/graalvm/build@master id: build @@ -60,4 +62,4 @@ jobs: uses: micronaut-projects/github-actions/graalvm/post-build@master id: post-build with: - java: '17' + java: ${{ matrix.java }} diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e440bc8e..7c0d4941 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 }} @@ -40,14 +40,14 @@ jobs: df -h - name: "📥 Checkout repository" - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: "🔧 Setup GraalVM CE" uses: graalvm/setup-graalvm@v1.1.4 with: - distribution: 'graalvm-community' + distribution: 'graalvm' java-version: ${{ matrix.java }} github-token: ${{ secrets.GITHUB_TOKEN }} @@ -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 diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 5dec33e1..cbf48711 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -10,7 +10,7 @@ jobs: if: github.repository != 'micronaut-projects/micronaut-project-template' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v3 with: path: ~/.gradle/caches diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4158245e..959258a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - uses: gradle/wrapper-validation-action@v1 @@ -146,7 +146,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - name: Checkout repository - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: Download artifacts uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 with: diff --git a/gradle.properties b/gradle.properties index 874a2da2..6df7e114 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,21 @@ projectUrl=https://micronaut.io githubSlug=micronaut-projects/micronaut-validation developers=Graeme Rocher - # If needed, set additional properties - org.gradle.caching=true org.gradle.jvmargs=-Xmx1g predictiveTestSelection=false coreDocsUrl=https://docs.micronaut.io/latest/api/io/micronaut/ guideUrl=https://docs.micronaut.io/latest/guide/ + +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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ee1cddf4..86db3b48 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,7 +29,6 @@ jakarta-validation-tck = "3.0.1" micronaut-core = { module = 'io.micronaut:micronaut-core-bom', version.ref = 'micronaut' } # BOMS -micronaut-logging = { module = "io.micronaut.logging:micronaut-logging-bom", version.ref = "micronaut-logging" } micronaut-reactor = { module = 'io.micronaut.reactor:micronaut-reactor-bom', version.ref = "micronaut-reactor" } micronaut-rxjava2 = { module = 'io.micronaut.rxjava2:micronaut-rxjava2-bom', version.ref = "micronaut-rxjava2" } micronaut-kotlin = { module = 'io.micronaut.kotlin:micronaut-kotlin-bom', version.ref = "micronaut-kotlin" } diff --git a/settings.gradle b/settings.gradle index 8cd9d583..dd09ba3b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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") diff --git a/test-suite-kotlin/build.gradle b/test-suite-kotlin/build.gradle index e36f6528..6ab83a67 100644 --- a/test-suite-kotlin/build.gradle +++ b/test-suite-kotlin/build.gradle @@ -1,15 +1,12 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { id 'io.micronaut.build.internal.validation-test-suite' id 'org.jetbrains.kotlin.jvm' id 'com.google.devtools.ksp' } -tasks.withType(KotlinCompile).configureEach { - compilerOptions { - jvmTarget = JvmTarget.JVM_17 +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(17)) } }