From e44511349ef390cb43adca9d177ae364af0a2b2a Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 15:31:07 -0400 Subject: [PATCH 01/35] Run CI tests directly in GitHub Workflows --- .github/workflows/ci.yml | 89 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..3ca9c1cc161 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,89 @@ +name: CI tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + sanity: + name: Sanity test ${{ matrix.script }} on JDK ${{ matrix.java_version }} + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + matrix: + script: ['cftests-junit', 'cftests-nonjunit', 'typecheck', 'jspecify-conformance'] + java_version: [21] + experimental: [false] + env: + JAVA_VERSION: ${{ matrix.java_version }} + continue-on-error: ${{ matrix.experimental }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java_version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java_version }} + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + + - name: Run test script checker/bin-devel/test-${{ matrix.script }} + run: ./checker/bin-devel/test-${ matrix.script }}.sh + + all: + name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} + runs-on: ubuntu-latest + needs: sanity + permissions: + contents: read + strategy: + matrix: + script: ['cftests-junit', 'cftests-nonjunit', 'typecheck', 'jspecify-conformance'] + # JDK 21 used by sanity before + java_version: [8, 11, 17, 22] + experimental: [false] + include: + - java_version: 24-ea + experimental: true + env: + JAVA_VERSION: ${{ matrix.java_version }} + continue-on-error: ${{ matrix.experimental }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java_version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java_version }} + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + + - name: Run test script checker/bin-devel/test-${{ matrix.script }} + run: ./checker/bin-devel/test-${ matrix.script }}.sh + + dependency-submission: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + From 050b9e104333a8204be6cdc5ab1e0f8248fb4eb3 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 15:33:57 -0400 Subject: [PATCH 02/35] Fix substitution --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ca9c1cc161..0e30828f6e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 - name: Run test script checker/bin-devel/test-${{ matrix.script }} - run: ./checker/bin-devel/test-${ matrix.script }}.sh + run: ./checker/bin-devel/test-${{ matrix.script }}.sh all: name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} @@ -68,7 +68,7 @@ jobs: uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 - name: Run test script checker/bin-devel/test-${{ matrix.script }} - run: ./checker/bin-devel/test-${ matrix.script }}.sh + run: ./checker/bin-devel/test-${{ matrix.script }}.sh dependency-submission: runs-on: ubuntu-latest From 9e5c2cf8e44bc8c032e0ab34f838a80f508e265b Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 16:33:25 -0400 Subject: [PATCH 03/35] Tweak scripts --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e30828f6e9..50233e809d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,12 +44,13 @@ jobs: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck', 'jspecify-conformance'] + script: ['cftests-junit', 'cftests-nonjunit', 'typecheck'] # JDK 21 used by sanity before java_version: [8, 11, 17, 22] experimental: [false] include: - - java_version: 24-ea + - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck'] + java_version: ['23-ea', '24-ea'] experimental: true env: JAVA_VERSION: ${{ matrix.java_version }} From fafd65d3c2d35888b2dee0ea3954633737dc73db Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 17:02:05 -0400 Subject: [PATCH 04/35] Split typecheck and try different matrix --- .github/workflows/ci.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50233e809d5..46e5ff12a7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,10 @@ jobs: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck', 'jspecify-conformance'] + script: ['cftests-junit', 'cftests-nonjunit', 'typecheck-part1', 'typecheck-part2', 'jspecify-conformance'] java_version: [21] - experimental: [false] env: JAVA_VERSION: ${{ matrix.java_version }} - continue-on-error: ${{ matrix.experimental }} steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java_version }} @@ -44,23 +42,23 @@ jobs: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck'] + script: ['cftests-junit', 'cftests-nonjunit', 'typecheck-part1', 'typecheck-part2'] # JDK 21 used by sanity before - java_version: [8, 11, 17, 22] - experimental: [false] - include: - - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck'] - java_version: ['23-ea', '24-ea'] - experimental: true + java: [{version: '8', experimental: false}, + {version: '11', experimental: false}, + {version: '17', experimental: false}, + {version: '22', experimental: true}, + {version: '23-ea', experimental: true}, + {version: '24-ea', experimental: true}] env: - JAVA_VERSION: ${{ matrix.java_version }} - continue-on-error: ${{ matrix.experimental }} + JAVA_VERSION: ${{ matrix.java.version }} + continue-on-error: ${{ matrix.java.experimental }} steps: - uses: actions/checkout@v4 - - name: Set up JDK ${{ matrix.java_version }} + - name: Set up JDK ${{ matrix.java.version }} uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java_version }} + java-version: ${{ matrix.java.version }} distribution: 'temurin' # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. From 64bced59f0957feaeb4323d461999bc29deec232 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 17:29:52 -0400 Subject: [PATCH 05/35] Correctly output the version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46e5ff12a7b..20fe5ea6067 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: run: ./checker/bin-devel/test-${{ matrix.script }}.sh all: - name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} + name: Test ${{ matrix.script }} on JDK ${{ matrix.java.version }} runs-on: ubuntu-latest needs: sanity permissions: From 220c7cf30c45c7b3fbbdb2b872aee91efb76dd2e Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 17:32:51 -0400 Subject: [PATCH 06/35] Disable jobs that are not on GitHub (not sure this is enough) --- azure-pipelines.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d996a8d8ac5..f48f2348d5a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,8 +31,8 @@ jobs: - nonjunit_jdk21 # - inference_part1_jdk21 # - inference_part2_jdk21 - - typecheck_part1_jdk21 - - typecheck_part2_jdk21 + # - typecheck_part1_jdk21 + # - typecheck_part2_jdk21 - misc_jdk21 # - misc_jdk_latest pool: @@ -43,14 +43,14 @@ jobs: - job: framework_jobs dependsOn: - canary_jobs - - junit_jdk8 - - junit_jdk11 - - junit_jdk17 + # - junit_jdk8 + # - junit_jdk11 + # - junit_jdk17 # - junit_jdk_latest # - junit_jdk_next - - nonjunit_jdk8 - - nonjunit_jdk11 - - nonjunit_jdk17 + # - nonjunit_jdk8 + # - nonjunit_jdk11 + # - nonjunit_jdk17 # - nonjunit_jdk_latest # - nonjunit_jdk_next # - inference_jdk8 @@ -58,9 +58,9 @@ jobs: # - inference_jdk17 # - inference_jdk_latest # - inference_jdk_next - - typecheck_jdk8 - - typecheck_jdk11 - - typecheck_jdk17 + # - typecheck_jdk8 + # - typecheck_jdk11 + # - typecheck_jdk17 # - typecheck_jdk_latest # - typecheck_jdk_next pool: From f736f220547774a4427ac577ae2aa7e324fafd2f Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 18:04:04 -0400 Subject: [PATCH 07/35] Actually disable jobs that are now on GitHub --- azure-pipelines.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f48f2348d5a..9b96e88accd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -97,6 +97,7 @@ jobs: - checkout: none - job: junit_jdk8 + condition: false dependsOn: - canary_jobs - junit_jdk21 @@ -115,6 +116,7 @@ jobs: artifactName: cf_jdk8 artifactType: pipeline - job: junit_jdk11 + condition: false dependsOn: - canary_jobs - junit_jdk21 @@ -132,6 +134,7 @@ jobs: artifactName: cf_jdk11 artifactType: pipeline - job: junit_jdk17 + condition: false dependsOn: - canary_jobs - junit_jdk21 @@ -184,6 +187,7 @@ jobs: # artifactName: cf_jdk_latest # artifactType: pipeline - job: junit_jdk_next + condition: false dependsOn: - canary_jobs - junit_jdk21 @@ -206,6 +210,7 @@ jobs: artifactType: pipeline - job: nonjunit_jdk8 + condition: false dependsOn: - canary_jobs - nonjunit_jdk21 @@ -218,6 +223,7 @@ jobs: - bash: ./checker/bin-devel/test-cftests-nonjunit.sh displayName: test-cftests-nonjunit.sh - job: nonjunit_jdk11 + condition: false dependsOn: - canary_jobs - nonjunit_jdk21 @@ -230,6 +236,7 @@ jobs: - bash: ./checker/bin-devel/test-cftests-nonjunit.sh displayName: test-cftests-nonjunit.sh - job: nonjunit_jdk17 + condition: false dependsOn: - canary_jobs - nonjunit_jdk21 @@ -264,6 +271,7 @@ jobs: # - bash: ./checker/bin-devel/test-cftests-nonjunit.sh # displayName: test-cftests-nonjunit.sh - job: nonjunit_jdk_next + condition: false dependsOn: - canary_jobs - nonjunit_jdk21 @@ -443,6 +451,7 @@ jobs: displayName: test-misc.sh - job: typecheck_jdk8 + condition: false dependsOn: - canary_jobs - typecheck_jdk21 @@ -455,6 +464,7 @@ jobs: - bash: ./checker/bin-devel/test-typecheck.sh displayName: test-typecheck.sh - job: typecheck_jdk11 + condition: false dependsOn: - canary_jobs - typecheck_jdk21 @@ -467,6 +477,7 @@ jobs: - bash: ./checker/bin-devel/test-typecheck.sh displayName: test-typecheck.sh - job: typecheck_jdk17 + condition: false dependsOn: - canary_jobs - typecheck_jdk21 @@ -480,6 +491,7 @@ jobs: displayName: test-typecheck.sh # Split into part1 and part2 only for the type-checking job that "canary_jobs" depends on. - job: typecheck_part1_jdk21 + condition: false pool: vmImage: 'ubuntu-latest' container: wmdietl/cf-ubuntu-jdk21-plus:latest @@ -489,6 +501,7 @@ jobs: - bash: ./checker/bin-devel/test-typecheck-part1.sh displayName: test-typecheck-part1.sh - job: typecheck_part2_jdk21 + condition: false pool: vmImage: 'ubuntu-latest' container: wmdietl/cf-ubuntu-jdk21-plus:latest @@ -498,6 +511,7 @@ jobs: - bash: ./checker/bin-devel/test-typecheck-part2.sh displayName: test-typecheck-part2.sh - job: typecheck_jdk21 + condition: false dependsOn: - typecheck_part1_jdk21 - typecheck_part2_jdk21 @@ -519,6 +533,7 @@ jobs: # - bash: ./checker/bin-devel/test-typecheck.sh # displayName: test-typecheck.sh - job: typecheck_jdk_next + condition: false dependsOn: - canary_jobs - typecheck_jdk21 @@ -806,6 +821,7 @@ jobs: displayName: test-plume-lib.sh - job: jspecify_conformance_jdk21 + condition: false dependsOn: - junit_jdk21 pool: From aaf2cd75ef4b1e49296dfd4b2796a35f0d5cc2e9 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 18:04:39 -0400 Subject: [PATCH 08/35] Update version --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20fe5ea6067..0638a789cb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: sanity: - name: Sanity test ${{ matrix.script }} on JDK ${{ matrix.java_version }} + name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} runs-on: ubuntu-latest permissions: contents: read @@ -29,7 +29,7 @@ jobs: # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - name: Setup Gradle - uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + uses: gradle/actions/setup-gradle@v3.5.0 - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh @@ -64,7 +64,7 @@ jobs: # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - name: Setup Gradle - uses: gradle/actions/setup-gradle@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + uses: gradle/actions/setup-gradle@v3.5.0 - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh @@ -84,5 +84,5 @@ jobs: # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@dbbdc275be76ac10734476cc723d82dfe7ec6eda # v3.4.2 + uses: gradle/actions/dependency-submission@v3.5.0 From b3283788a45e522b4e62fd6a6cd12301e5d0cd1f Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 18:29:17 -0400 Subject: [PATCH 09/35] Try using Java 21 for gradle itself --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0638a789cb0..1f16d6b2738 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3.5.0 + - name: Use Java 21 for Gradle itself + run: ./gradlew updateDaemonJvm --jvm-version=21 + - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh From 96c6959c62a80ccda40224b5fef7544d41a0275c Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Thu, 1 Aug 2024 19:03:47 -0400 Subject: [PATCH 10/35] Running updateDaemonJvm doesn't work --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f16d6b2738..0638a789cb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,9 +66,6 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3.5.0 - - name: Use Java 21 for Gradle itself - run: ./gradlew updateDaemonJvm --jvm-version=21 - - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh From 996f5c0516786de8290ea15c173297483fd4a851 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Fri, 2 Aug 2024 11:21:01 -0400 Subject: [PATCH 11/35] Also move guava and plume-lib tests to GitHub --- .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++++++++++++--- azure-pipelines.yml | 19 +++++++---- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0638a789cb0..f75cd5dfeaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: branches: [ "master" ] jobs: + # Basic sanity tests on JDK 21. sanity: name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} runs-on: ubuntu-latest @@ -14,7 +15,7 @@ jobs: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck-part1', 'typecheck-part2', 'jspecify-conformance'] + script: ['cftests-junit', 'cftests-nonjunit'] java_version: [21] env: JAVA_VERSION: ${{ matrix.java_version }} @@ -34,15 +35,45 @@ jobs: - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh - all: - name: Test ${{ matrix.script }} on JDK ${{ matrix.java.version }} + # The remaining tests for JDK 21. Separate from `sanity` to allow parallelism with `otheros`. + remainder: + name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} runs-on: ubuntu-latest needs: sanity permissions: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck-part1', 'typecheck-part2'] + script: ['typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib', 'jspecify-conformance'] + java_version: [21] + env: + JAVA_VERSION: ${{ matrix.java_version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java_version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java_version }} + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3.5.0 + + - name: Run test script checker/bin-devel/test-${{ matrix.script }} + run: ./checker/bin-devel/test-${{ matrix.script }}.sh + + otherjdks: + name: Test ${{ matrix.script }} on JDK ${{ matrix.java.version }} + runs-on: ubuntu-latest + needs: remainder + permissions: + contents: read + strategy: + matrix: + # jspecify-conformance only tested on JDK 21 + script: ['cftests-junit', 'cftests-nonjunit', 'typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib'] # JDK 21 used by sanity before java: [{version: '8', experimental: false}, {version: '11', experimental: false}, @@ -69,6 +100,36 @@ jobs: - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh + # Sanity tests on Windows and MacOS. + otheros: + name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} on ${{ matrix.os }} + runs-on: "${{ matrix.os }}" + needs: sanity + permissions: + contents: read + strategy: + matrix: + os: ['windows-latest', 'macos-latest'] + script: ['cftests-junit'] + java_version: [21] + env: + JAVA_VERSION: ${{ matrix.java_version }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java_version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java_version }} + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3.5.0 + + - name: Run test script checker/bin-devel/test-${{ matrix.script }} + run: ./checker/bin-devel/test-${{ matrix.script }}.sh + dependency-submission: runs-on: ubuntu-latest permissions: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9b96e88accd..decaa0c3f9e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -79,18 +79,18 @@ jobs: # Not daikon_jdk_next # - guava_jdk8 # - guava_jdk11 - - guava_jdk17 - - guava_jdk21 + # - guava_jdk17 + # - guava_jdk21 # - guava_jdk_latest # Not guava_jdk_next # - plume_lib_jdk8 # - plume_lib_jdk11 - - plume_lib_jdk17 - - plume_lib_jdk21 + # - plume_lib_jdk17 + # - plume_lib_jdk21 # - plume_lib_jdk_latest # Not plume_lib_jdk_next - - windows_junit_jdk17 - - jspecify_conformance_jdk21 + # - windows_junit_jdk17 + # - jspecify_conformance_jdk21 pool: vmImage: 'ubuntu-latest' steps: @@ -683,6 +683,7 @@ jobs: - bash: ./checker/bin-devel/test-guava.sh displayName: test-guava.sh - job: guava_jdk17 + condition: false dependsOn: - framework_jobs - guava_jdk21 @@ -696,6 +697,7 @@ jobs: - bash: ./checker/bin-devel/test-guava.sh displayName: test-guava.sh - job: guava_jdk21 + condition: false dependsOn: - canary_jobs pool: @@ -727,6 +729,7 @@ jobs: # - bash: ./checker/bin-devel/test-guava.sh # displayName: test-guava.sh - job: guava_jdk_next + condition: false dependsOn: - framework_jobs - guava_jdk21 @@ -770,6 +773,7 @@ jobs: - bash: ./checker/bin-devel/test-plume-lib.sh displayName: test-plume-lib.sh - job: plume_lib_jdk17 + condition: false dependsOn: - canary_jobs - plume_lib_jdk21 @@ -782,6 +786,7 @@ jobs: - bash: ./checker/bin-devel/test-plume-lib.sh displayName: test-plume-lib.sh - job: plume_lib_jdk21 + condition: false dependsOn: - canary_jobs pool: @@ -806,6 +811,7 @@ jobs: # - bash: ./checker/bin-devel/test-plume-lib.sh # displayName: test-plume-lib.sh - job: plume_lib_jdk_next + condition: false dependsOn: - canary_jobs - plume_lib_jdk17 @@ -895,6 +901,7 @@ jobs: # displayName: test-downstream.sh - job: windows_junit_jdk17 + condition: false dependsOn: - junit_jdk21 pool: From 5fa745e05d36922371d8a5e085baf1039786267c Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Fri, 2 Aug 2024 11:21:52 -0400 Subject: [PATCH 12/35] Test whether misc works on GitHub --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f75cd5dfeaa..b9d2630252a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit'] + script: ['cftests-junit', 'cftests-nonjunit', 'misc'] java_version: [21] env: JAVA_VERSION: ${{ matrix.java_version }} From 86abaef6fd31772dd1c5782d946d6b4d6f762b11 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Fri, 2 Aug 2024 11:33:18 -0400 Subject: [PATCH 13/35] Don't duplicate work on Azure --- azure-pipelines.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index decaa0c3f9e..1fd481f3956 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,8 +27,8 @@ jobs: # Include misc_jdk_latest because JDK 20+ adds more strict checking (e.g., Javadoc) - job: canary_jobs dependsOn: - - junit_jdk21 - - nonjunit_jdk21 + # - junit_jdk21 + # - nonjunit_jdk21 # - inference_part1_jdk21 # - inference_part2_jdk21 # - typecheck_part1_jdk21 @@ -153,6 +153,7 @@ jobs: artifactName: cf_jdk17 artifactType: pipeline - job: junit_jdk21 + condition: false pool: vmImage: 'ubuntu-latest' container: wmdietl/cf-ubuntu-jdk21:latest @@ -249,6 +250,7 @@ jobs: - bash: ./checker/bin-devel/test-cftests-nonjunit.sh displayName: test-cftests-nonjunit.sh - job: nonjunit_jdk21 + condition: false pool: vmImage: 'ubuntu-latest' container: wmdietl/cf-ubuntu-jdk21:latest From d88cb01d9c1035a40e57dd62d3f59b8b48ef2943 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Fri, 2 Aug 2024 11:33:52 -0400 Subject: [PATCH 14/35] Don't run `misc` on GitHub, it needs extra dependencies --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9d2630252a..f75cd5dfeaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: contents: read strategy: matrix: - script: ['cftests-junit', 'cftests-nonjunit', 'misc'] + script: ['cftests-junit', 'cftests-nonjunit'] java_version: [21] env: JAVA_VERSION: ${{ matrix.java_version }} From d0d76c46a65b7ae50738d3699d77920b723c003c Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Fri, 2 Aug 2024 11:48:34 -0400 Subject: [PATCH 15/35] Don't block `remainder` on `sanity` --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f75cd5dfeaa..a0a5ffdec56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,6 @@ jobs: remainder: name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} runs-on: ubuntu-latest - needs: sanity permissions: contents: read strategy: From befa15bf09fc934ca1dcbc24a762dc7c44bd91ba Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 17:20:19 -0400 Subject: [PATCH 16/35] Try fixes for MacOS and Windows --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0a5ffdec56..ac395d4021c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,7 +126,17 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v3.5.0 - - name: Run test script checker/bin-devel/test-${{ matrix.script }} + - name: Install coreutils on MacOS + if: matrix.os == 'macos-latest' + run: brew install coreutils + + - name: Run test script checker/bin-devel/test-${{ matrix.script }} on MaxOS + if: matrix.os == 'macos-latest' + run: ./checker/bin-devel/test-${{ matrix.script }}.sh + + - name: Run test script checker/bin-devel/test-${{ matrix.script }} on Windows + if: matrix.os == 'windows-latest' + shell: bash run: ./checker/bin-devel/test-${{ matrix.script }}.sh dependency-submission: From 65fb54a2aecf99e7bfc4566a4e068a91a1ae0f1d Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 17:25:10 -0400 Subject: [PATCH 17/35] Separate test that compiles on JDK 21 and runs on different JDKs --- .github/workflows/ci.yml | 5 +++-- build.gradle | 12 +++++++----- checker/bin-devel/test-cftests-all.sh | 2 -- checker/bin-devel/test-cftests-inference-part1.sh | 2 -- checker/bin-devel/test-cftests-inference-part2.sh | 2 -- checker/bin-devel/test-cftests-inference.sh | 2 -- checker/bin-devel/test-cftests-junit-jdk21.sh | 15 +++++++++++++++ checker/bin-devel/test-cftests-junit.sh | 1 - checker/bin-devel/test-cftests-nonjunit.sh | 1 - checker/bin-devel/test-daikon-part1.sh | 1 - checker/bin-devel/test-daikon-part2.sh | 1 - checker/bin-devel/test-daikon.sh | 1 - checker/bin-devel/test-downstream.sh | 1 - checker/bin-devel/test-guava-formatter.sh | 1 - checker/bin-devel/test-guava-index.sh | 1 - checker/bin-devel/test-guava-interning.sh | 1 - checker/bin-devel/test-guava-lock.sh | 1 - checker/bin-devel/test-guava-nullness.sh | 1 - checker/bin-devel/test-guava-regex.sh | 1 - checker/bin-devel/test-guava-signature.sh | 1 - checker/bin-devel/test-guava.sh | 1 - checker/bin-devel/test-jspecify-conformance.sh | 2 +- checker/bin-devel/test-misc.sh | 1 - checker/bin-devel/test-plume-lib.sh | 1 - checker/bin-devel/test-typecheck-part1.sh | 1 - checker/bin-devel/test-typecheck-part2.sh | 1 - checker/bin-devel/test-typecheck.sh | 1 - 27 files changed, 26 insertions(+), 35 deletions(-) create mode 100755 checker/bin-devel/test-cftests-junit-jdk21.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac395d4021c..cf03f7e69dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,7 @@ jobs: contents: read strategy: matrix: + # No need to run 'cftests-junit-jdk21' on JDK 21. script: ['typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib', 'jspecify-conformance'] java_version: [21] env: @@ -71,8 +72,8 @@ jobs: contents: read strategy: matrix: - # jspecify-conformance only tested on JDK 21 - script: ['cftests-junit', 'cftests-nonjunit', 'typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib'] + # jspecify-conformance only tested on JDK 21. + script: ['cftests-junit', 'cftests-nonjunit', 'cftests-junit-jdk21', 'typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib'] # JDK 21 used by sanity before java: [{version: '8', experimental: false}, {version: '11', experimental: false}, diff --git a/build.gradle b/build.gradle index cbc3dd64937..38d3c57144d 100644 --- a/build.gradle +++ b/build.gradle @@ -387,13 +387,15 @@ allprojects { // Add standard javac options tasks.withType(JavaCompile) { compilationTask -> dependsOn(':installGitHooks') - boolean jdk17Compiler = project.getProperties().getOrDefault('useJdk17Compiler', false) - if (!isJava8 && jdk17Compiler) { - // This uses the Java 17 compiler to compile all code. - // https://docs.gradle.org/current/userguide/toolchains.html + boolean jdk21Compiler = project.getProperties().getOrDefault('useJdk21Compiler', false) + if (!isJava8 && jdk21Compiler) { + // This uses the Java 21 compiler to compile all code, like we do for a release. + // CI test test-cftests-junit-jdk21 then runs the JUnit tests on the different JDK versions, + // to ensure there is no version mismatch between compiled-against javac API and runtime API. + // https://docs.gradle.org/current/userguide/toolchains.html // This property is final on Java 8, so don't set it then. javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(17) + languageVersion = JavaLanguageVersion.of(21) } } diff --git a/checker/bin-devel/test-cftests-all.sh b/checker/bin-devel/test-cftests-all.sh index ff590af2764..96830e1e2a5 100755 --- a/checker/bin-devel/test-cftests-all.sh +++ b/checker/bin-devel/test-cftests-all.sh @@ -9,13 +9,11 @@ set -o xtrace export SHELLOPTS echo "SHELLOPTS=${SHELLOPTS}" -export ORG_GRADLE_PROJECT_useJdk17Compiler=true SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) source "$SCRIPTDIR"/clone-related.sh - ./gradlew allTests --console=plain --warning-mode=all # Moved example-tests out of all tests because it fails in # the release script because the newest maven artifacts are not published yet. diff --git a/checker/bin-devel/test-cftests-inference-part1.sh b/checker/bin-devel/test-cftests-inference-part1.sh index 5e945cdf6f0..2064f33047e 100755 --- a/checker/bin-devel/test-cftests-inference-part1.sh +++ b/checker/bin-devel/test-cftests-inference-part1.sh @@ -8,9 +8,7 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh - ./gradlew inferenceTests-part1 --console=plain --warning-mode=all diff --git a/checker/bin-devel/test-cftests-inference-part2.sh b/checker/bin-devel/test-cftests-inference-part2.sh index 34fcc84bb76..1f35a502ded 100755 --- a/checker/bin-devel/test-cftests-inference-part2.sh +++ b/checker/bin-devel/test-cftests-inference-part2.sh @@ -8,9 +8,7 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh - ./gradlew inferenceTests-part2 --console=plain --warning-mode=all diff --git a/checker/bin-devel/test-cftests-inference.sh b/checker/bin-devel/test-cftests-inference.sh index 24584a52183..e9c27a3f8ea 100755 --- a/checker/bin-devel/test-cftests-inference.sh +++ b/checker/bin-devel/test-cftests-inference.sh @@ -8,9 +8,7 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh - ./gradlew inferenceTests --console=plain --warning-mode=all diff --git a/checker/bin-devel/test-cftests-junit-jdk21.sh b/checker/bin-devel/test-cftests-junit-jdk21.sh new file mode 100755 index 00000000000..449e7a00b48 --- /dev/null +++ b/checker/bin-devel/test-cftests-junit-jdk21.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e +set -o verbose +set -o xtrace +export SHELLOPTS +echo "SHELLOPTS=${SHELLOPTS}" + +SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +# shellcheck disable=SC1090# In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) +export ORG_GRADLE_PROJECT_useJdk21Compiler=true +source "$SCRIPTDIR"/clone-related.sh + + +./gradlew test -x javadoc -x allJavadoc --console=plain --warning-mode=all diff --git a/checker/bin-devel/test-cftests-junit.sh b/checker/bin-devel/test-cftests-junit.sh index 058d6a7ae9c..92d31565b88 100755 --- a/checker/bin-devel/test-cftests-junit.sh +++ b/checker/bin-devel/test-cftests-junit.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090# In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-cftests-nonjunit.sh b/checker/bin-devel/test-cftests-nonjunit.sh index c96bdf0bf50..1165c83c415 100755 --- a/checker/bin-devel/test-cftests-nonjunit.sh +++ b/checker/bin-devel/test-cftests-nonjunit.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090# In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-daikon-part1.sh b/checker/bin-devel/test-daikon-part1.sh index 1a2c7e898a9..627e663eb69 100755 --- a/checker/bin-devel/test-daikon-part1.sh +++ b/checker/bin-devel/test-daikon-part1.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090# In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh # Run assembleForJavac because it does not build the javadoc, so it is faster than assemble. diff --git a/checker/bin-devel/test-daikon-part2.sh b/checker/bin-devel/test-daikon-part2.sh index 860e5285192..1cb5e9d3117 100755 --- a/checker/bin-devel/test-daikon-part2.sh +++ b/checker/bin-devel/test-daikon-part2.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh # Run assembleForJavac because it does not build the javadoc, so it is faster than assemble. diff --git a/checker/bin-devel/test-daikon.sh b/checker/bin-devel/test-daikon.sh index 97c8e8f98c0..7b3b153abfd 100755 --- a/checker/bin-devel/test-daikon.sh +++ b/checker/bin-devel/test-daikon.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh # Run assembleForJavac because it does not build the javadoc, so it is faster than assemble. diff --git a/checker/bin-devel/test-downstream.sh b/checker/bin-devel/test-downstream.sh index 53be63895f0..95cf1419347 100755 --- a/checker/bin-devel/test-downstream.sh +++ b/checker/bin-devel/test-downstream.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-formatter.sh b/checker/bin-devel/test-guava-formatter.sh index 57eb547766f..63f50e1be7f 100755 --- a/checker/bin-devel/test-guava-formatter.sh +++ b/checker/bin-devel/test-guava-formatter.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-index.sh b/checker/bin-devel/test-guava-index.sh index 32a787cd091..fc1cca0679f 100755 --- a/checker/bin-devel/test-guava-index.sh +++ b/checker/bin-devel/test-guava-index.sh @@ -9,7 +9,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-interning.sh b/checker/bin-devel/test-guava-interning.sh index 9dfaa51169b..c44d6320aa6 100755 --- a/checker/bin-devel/test-guava-interning.sh +++ b/checker/bin-devel/test-guava-interning.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-lock.sh b/checker/bin-devel/test-guava-lock.sh index d146d5d1ba7..04200961692 100755 --- a/checker/bin-devel/test-guava-lock.sh +++ b/checker/bin-devel/test-guava-lock.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-nullness.sh b/checker/bin-devel/test-guava-nullness.sh index 4ee36fb5b4a..71b484d655a 100755 --- a/checker/bin-devel/test-guava-nullness.sh +++ b/checker/bin-devel/test-guava-nullness.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-regex.sh b/checker/bin-devel/test-guava-regex.sh index a4f04217206..42dfcaf947e 100755 --- a/checker/bin-devel/test-guava-regex.sh +++ b/checker/bin-devel/test-guava-regex.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava-signature.sh b/checker/bin-devel/test-guava-signature.sh index a7ff4ceee08..e7cd12dded8 100755 --- a/checker/bin-devel/test-guava-signature.sh +++ b/checker/bin-devel/test-guava-signature.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-guava.sh b/checker/bin-devel/test-guava.sh index a56e559f03c..93589d4dd66 100755 --- a/checker/bin-devel/test-guava.sh +++ b/checker/bin-devel/test-guava.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh ./gradlew assembleForJavac --console=plain -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000 diff --git a/checker/bin-devel/test-jspecify-conformance.sh b/checker/bin-devel/test-jspecify-conformance.sh index 6b47021e1cc..a7247d7f108 100755 --- a/checker/bin-devel/test-jspecify-conformance.sh +++ b/checker/bin-devel/test-jspecify-conformance.sh @@ -8,10 +8,10 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh ./gradlew assembleForJavac --console=plain -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000 + GIT_SCRIPTS="$SCRIPTDIR/.git-scripts" "$GIT_SCRIPTS/git-clone-related" eisop jspecify-conformance cd ../jspecify-conformance diff --git a/checker/bin-devel/test-misc.sh b/checker/bin-devel/test-misc.sh index 7d7ea89cf16..3e21746d48e 100755 --- a/checker/bin-devel/test-misc.sh +++ b/checker/bin-devel/test-misc.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh PLUME_SCRIPTS="$SCRIPTDIR/.plume-scripts" diff --git a/checker/bin-devel/test-plume-lib.sh b/checker/bin-devel/test-plume-lib.sh index e43f7f64024..3f0f2ddbecf 100755 --- a/checker/bin-devel/test-plume-lib.sh +++ b/checker/bin-devel/test-plume-lib.sh @@ -38,7 +38,6 @@ echo "PACKAGES=" "${PACKAGES[@]}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh ./gradlew assembleForJavac --console=plain -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.http.connectionTimeout=60000 diff --git a/checker/bin-devel/test-typecheck-part1.sh b/checker/bin-devel/test-typecheck-part1.sh index 2c27f7b1523..69dff413285 100755 --- a/checker/bin-devel/test-typecheck-part1.sh +++ b/checker/bin-devel/test-typecheck-part1.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-typecheck-part2.sh b/checker/bin-devel/test-typecheck-part2.sh index 0d512a6ea2b..87182e11038 100755 --- a/checker/bin-devel/test-typecheck-part2.sh +++ b/checker/bin-devel/test-typecheck-part2.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh diff --git a/checker/bin-devel/test-typecheck.sh b/checker/bin-devel/test-typecheck.sh index 5afee821003..ec4c0bcd1b1 100755 --- a/checker/bin-devel/test-typecheck.sh +++ b/checker/bin-devel/test-typecheck.sh @@ -8,7 +8,6 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk17Compiler=true source "$SCRIPTDIR"/clone-related.sh From e5ba6e525dd509e71ece947e7c0ebf356b49359f Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 17:28:16 -0400 Subject: [PATCH 18/35] Fix build --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 38d3c57144d..1cf5fe10614 100644 --- a/build.gradle +++ b/build.gradle @@ -459,7 +459,7 @@ allprojects { // warnings are suppressible with a "// fall through" comment. // -classfile: classgraph jar file and https://bugs.openjdk.org/browse/JDK-8190452 String lint = '-Xlint:-options,-fallthrough,-classfile' - if (isJava21plus && !jdk17Compiler) { + if (isJava21plus) { // TODO: Ignore this-escape for now, we may want to review and suppress each one later. lint +=',-this-escape' } From 997462fb161f1739fcfe41d1f9d91b7562e63a2b Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 17:57:53 -0400 Subject: [PATCH 19/35] Use shorter names --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf03f7e69dc..d802f300cae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: jobs: # Basic sanity tests on JDK 21. sanity: - name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} + name: ${{ matrix.script }} on JDK ${{ matrix.java_version }} runs-on: ubuntu-latest permissions: contents: read @@ -37,7 +37,7 @@ jobs: # The remaining tests for JDK 21. Separate from `sanity` to allow parallelism with `otheros`. remainder: - name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} + name: ${{ matrix.script }} on JDK ${{ matrix.java_version }} runs-on: ubuntu-latest permissions: contents: read @@ -65,7 +65,7 @@ jobs: run: ./checker/bin-devel/test-${{ matrix.script }}.sh otherjdks: - name: Test ${{ matrix.script }} on JDK ${{ matrix.java.version }} + name: ${{ matrix.script }} on JDK ${{ matrix.java.version }} runs-on: ubuntu-latest needs: remainder permissions: @@ -102,7 +102,7 @@ jobs: # Sanity tests on Windows and MacOS. otheros: - name: Test ${{ matrix.script }} on JDK ${{ matrix.java_version }} on ${{ matrix.os }} + name: ${{ matrix.script }} on JDK ${{ matrix.java_version }} on ${{ matrix.os }} runs-on: "${{ matrix.os }}" needs: sanity permissions: From 67fab312e2114e76de086b41468e41475f487799 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 18:01:30 -0400 Subject: [PATCH 20/35] Make failures from different JDKs independent --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d802f300cae..07acc884d07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,7 @@ jobs: permissions: contents: read strategy: + fail-fast: false matrix: # jspecify-conformance only tested on JDK 21. script: ['cftests-junit', 'cftests-nonjunit', 'cftests-junit-jdk21', 'typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib'] From dc2c95d3c625e59fde34ad46c9fdff6f1239bb6a Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 18:02:08 -0400 Subject: [PATCH 21/35] Suppress lint warning on JDK 21+ --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1cf5fe10614..f128f18132a 100644 --- a/build.gradle +++ b/build.gradle @@ -459,7 +459,7 @@ allprojects { // warnings are suppressible with a "// fall through" comment. // -classfile: classgraph jar file and https://bugs.openjdk.org/browse/JDK-8190452 String lint = '-Xlint:-options,-fallthrough,-classfile' - if (isJava21plus) { + if (isJava21plus || jdk21Compiler) { // TODO: Ignore this-escape for now, we may want to review and suppress each one later. lint +=',-this-escape' } From 62b7703d5f84ba6a3e752b3629026156dc0955c9 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 19:41:11 -0400 Subject: [PATCH 22/35] Try to get newer JDKs to work --- .github/workflows/ci.yml | 11 +++++++++++ build.gradle | 12 +++++++----- checker/bin-devel/test-cftests-junit-jdk21.sh | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07acc884d07..4c918efc6f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,14 @@ jobs: with: java-version: ${{ matrix.java.version }} distribution: 'temurin' + - name: Set up JDK 21 on an experimental platform + if: matrix.java.experimental + uses: actions/setup-java@v4 + with: + # Install JDK 21 second, to make it the default on which gradle runs. + # This unfortunately also means that all tests run on JDK 21 instead of the newer version. + java-version: 21 + distribution: 'temurin' # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md @@ -100,6 +108,9 @@ jobs: - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh + # Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work + # on Java 23 yet. This only tests the compiler, it does not use that version to run the tests. + env: ORG_GRADLE_PROJECT_useJdkCompiler=${{ matrix.java.version }} # Sanity tests on Windows and MacOS. otheros: diff --git a/build.gradle b/build.gradle index f128f18132a..0d77d5a956b 100644 --- a/build.gradle +++ b/build.gradle @@ -387,15 +387,17 @@ allprojects { // Add standard javac options tasks.withType(JavaCompile) { compilationTask -> dependsOn(':installGitHooks') - boolean jdk21Compiler = project.getProperties().getOrDefault('useJdk21Compiler', false) - if (!isJava8 && jdk21Compiler) { - // This uses the Java 21 compiler to compile all code, like we do for a release. + int useJdkCompiler = project.getProperties().getOrDefault('useJdkCompiler', 21) + boolean useToolchains = (JavaVersion.current() != useJdkCompiler) + if (!isJava8 && useToolchains) { + // This uses the requested Java compiler to compile all code. + // If no version is requested, we use Java 21, like we do for a release. // CI test test-cftests-junit-jdk21 then runs the JUnit tests on the different JDK versions, // to ensure there is no version mismatch between compiled-against javac API and runtime API. // https://docs.gradle.org/current/userguide/toolchains.html // This property is final on Java 8, so don't set it then. javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(useJdkCompiler) } } @@ -459,7 +461,7 @@ allprojects { // warnings are suppressible with a "// fall through" comment. // -classfile: classgraph jar file and https://bugs.openjdk.org/browse/JDK-8190452 String lint = '-Xlint:-options,-fallthrough,-classfile' - if (isJava21plus || jdk21Compiler) { + if (useJdkCompiler >= 21) { // TODO: Ignore this-escape for now, we may want to review and suppress each one later. lint +=',-this-escape' } diff --git a/checker/bin-devel/test-cftests-junit-jdk21.sh b/checker/bin-devel/test-cftests-junit-jdk21.sh index 449e7a00b48..fe20e2caf60 100755 --- a/checker/bin-devel/test-cftests-junit-jdk21.sh +++ b/checker/bin-devel/test-cftests-junit-jdk21.sh @@ -8,7 +8,7 @@ echo "SHELLOPTS=${SHELLOPTS}" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090# In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) -export ORG_GRADLE_PROJECT_useJdk21Compiler=true +export ORG_GRADLE_PROJECT_useJdkCompiler=21 source "$SCRIPTDIR"/clone-related.sh From 77373a7074ac9182246b8e9cf10a1ab84f7baa33 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 19:47:31 -0400 Subject: [PATCH 23/35] Setting shell to bash hopefully also works on macos --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c918efc6f1..3712ff9a3aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,12 +143,7 @@ jobs: if: matrix.os == 'macos-latest' run: brew install coreutils - - name: Run test script checker/bin-devel/test-${{ matrix.script }} on MaxOS - if: matrix.os == 'macos-latest' - run: ./checker/bin-devel/test-${{ matrix.script }}.sh - - - name: Run test script checker/bin-devel/test-${{ matrix.script }} on Windows - if: matrix.os == 'windows-latest' + - name: Run test script checker/bin-devel/test-${{ matrix.script }} shell: bash run: ./checker/bin-devel/test-${{ matrix.script }}.sh From db3efeeae49484b3fd0c2da6c90b8e05513af9ab Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 21:07:22 -0400 Subject: [PATCH 24/35] Fix syntax and handle no property given --- .github/workflows/ci.yml | 3 ++- build.gradle | 29 ++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3712ff9a3aa..7ae7082eb9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,8 @@ jobs: run: ./checker/bin-devel/test-${{ matrix.script }}.sh # Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work # on Java 23 yet. This only tests the compiler, it does not use that version to run the tests. - env: ORG_GRADLE_PROJECT_useJdkCompiler=${{ matrix.java.version }} + env: + ORG_GRADLE_PROJECT_useJdkCompiler: ${{ matrix.java.version }} # Sanity tests on Windows and MacOS. otheros: diff --git a/build.gradle b/build.gradle index 0d77d5a956b..43cf130ecde 100644 --- a/build.gradle +++ b/build.gradle @@ -387,17 +387,24 @@ allprojects { // Add standard javac options tasks.withType(JavaCompile) { compilationTask -> dependsOn(':installGitHooks') - int useJdkCompiler = project.getProperties().getOrDefault('useJdkCompiler', 21) - boolean useToolchains = (JavaVersion.current() != useJdkCompiler) - if (!isJava8 && useToolchains) { - // This uses the requested Java compiler to compile all code. - // If no version is requested, we use Java 21, like we do for a release. - // CI test test-cftests-junit-jdk21 then runs the JUnit tests on the different JDK versions, - // to ensure there is no version mismatch between compiled-against javac API and runtime API. - // https://docs.gradle.org/current/userguide/toolchains.html - // This property is final on Java 8, so don't set it then. - javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(useJdkCompiler) + String useJdkCompilerProp = project.getProperties().get('useJdkCompiler') + int useJdkCompiler + if (useJdkCompilerProp == null) { + // If the property is not given, use the same version as the runtime. + useJdkCompiler = Integer.valueOf(JavaVersion.current().getMajorVersion()) + } else { + useJdkCompiler = Integer.valueOf(useJdkCompilerProp) + boolean useToolchains = (JavaVersion.current() != useJdkCompiler) + if (!isJava8 && useToolchains) { + // This uses the requested Java compiler to compile all code. + // If no version is requested, we use Java 21, like we do for a release. + // CI test test-cftests-junit-jdk21 then runs the JUnit tests on the different JDK versions, + // to ensure there is no version mismatch between compiled-against javac API and runtime API. + // https://docs.gradle.org/current/userguide/toolchains.html + // This property is final on Java 8, so don't set it then. + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(useJdkCompiler) + } } } From 60c85ef92deb3d7a8be03a41ea801a6bec541845 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 21:19:27 -0400 Subject: [PATCH 25/35] Fix logic and improve comments --- build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 43cf130ecde..782a7e4d711 100644 --- a/build.gradle +++ b/build.gradle @@ -388,18 +388,18 @@ allprojects { tasks.withType(JavaCompile) { compilationTask -> dependsOn(':installGitHooks') String useJdkCompilerProp = project.getProperties().get('useJdkCompiler') + int runtimeCompiler = Integer.valueOf(JavaVersion.current().getMajorVersion()) int useJdkCompiler if (useJdkCompilerProp == null) { // If the property is not given, use the same version as the runtime. - useJdkCompiler = Integer.valueOf(JavaVersion.current().getMajorVersion()) + useJdkCompiler = runtimeCompiler } else { useJdkCompiler = Integer.valueOf(useJdkCompilerProp) - boolean useToolchains = (JavaVersion.current() != useJdkCompiler) + boolean useToolchains = (runtimeCompiler != useJdkCompiler) if (!isJava8 && useToolchains) { // This uses the requested Java compiler to compile all code. - // If no version is requested, we use Java 21, like we do for a release. - // CI test test-cftests-junit-jdk21 then runs the JUnit tests on the different JDK versions, - // to ensure there is no version mismatch between compiled-against javac API and runtime API. + // CI test test-cftests-junit-jdk21 runs the JUnit tests on the different JDK versions, + // to ensure there is no version mismatch between compiled-against javac APIs and runtime APIs. // https://docs.gradle.org/current/userguide/toolchains.html // This property is final on Java 8, so don't set it then. javaCompiler = javaToolchains.compilerFor { From 9e9de1ea3a8e5b6082e8fb0722c6e0f5abc5d4b6 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 22:00:32 -0400 Subject: [PATCH 26/35] Handle "-ea" in major version strings --- build.gradle | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 782a7e4d711..3c225104c04 100644 --- a/build.gradle +++ b/build.gradle @@ -153,6 +153,13 @@ if (isJava11plus) { } } +def majorVersionToInt(majorVersionString) { + if (majorVersionString.endsWith("-ea")) { + majorVersionString = majorVersionString.subString(0, majorVersionString.length() - 3) + } + return Integer.valueOf(majorVersionString) +} + allprojects { // Increment the minor version (second number) rather than just the patch // level (third number) if: @@ -388,13 +395,13 @@ allprojects { tasks.withType(JavaCompile) { compilationTask -> dependsOn(':installGitHooks') String useJdkCompilerProp = project.getProperties().get('useJdkCompiler') - int runtimeCompiler = Integer.valueOf(JavaVersion.current().getMajorVersion()) + int runtimeCompiler = majorVersionToInt(JavaVersion.current().getMajorVersion()) int useJdkCompiler if (useJdkCompilerProp == null) { // If the property is not given, use the same version as the runtime. useJdkCompiler = runtimeCompiler } else { - useJdkCompiler = Integer.valueOf(useJdkCompilerProp) + useJdkCompiler = majorVersionToInt(useJdkCompilerProp) boolean useToolchains = (runtimeCompiler != useJdkCompiler) if (!isJava8 && useToolchains) { // This uses the requested Java compiler to compile all code. From aa03317f1367fe9a87983ba907a33dc05dd49588 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Mon, 5 Aug 2024 22:36:50 -0400 Subject: [PATCH 27/35] Fix typo --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3c225104c04..62e05332e5f 100644 --- a/build.gradle +++ b/build.gradle @@ -155,7 +155,7 @@ if (isJava11plus) { def majorVersionToInt(majorVersionString) { if (majorVersionString.endsWith("-ea")) { - majorVersionString = majorVersionString.subString(0, majorVersionString.length() - 3) + majorVersionString = majorVersionString.substring(0, majorVersionString.length() - 3) } return Integer.valueOf(majorVersionString) } From 20a8d336eec830823c8db40b9db558c372a49ac7 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 15:38:34 -0400 Subject: [PATCH 28/35] Skip plume-lib on Java 8 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ae7082eb9e..8c5b4d74aa5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,6 +108,8 @@ jobs: - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh + # At least one plume-lib project no longer works on Java 8. + if: matrix.java.version != 8 || matrix.script != 'plume-lib' # Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work # on Java 23 yet. This only tests the compiler, it does not use that version to run the tests. env: From 353bd1a69f9f567fbb82c3b91759a8ae63b88a9e Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 15:39:41 -0400 Subject: [PATCH 29/35] Simplify runtime version checks --- build.gradle | 58 +++++++++++++++++++--------------------------------- 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/build.gradle b/build.gradle index 62e05332e5f..d037512e7d7 100644 --- a/build.gradle +++ b/build.gradle @@ -33,33 +33,26 @@ repositories { mavenCentral() } + +def majorVersionToInt(majorVersionString) { + if (majorVersionString.endsWith("-ea")) { + majorVersionString = majorVersionString.substring(0, majorVersionString.length() - 3) + } + return Integer.valueOf(majorVersionString) +} + ext { release = false // On a Java 8 JVM, use error-prone javac and source/target 8. // On a Java 9+ JVM, use the host javac, default source/target, and required module flags. isJava8 = JavaVersion.current() == JavaVersion.VERSION_1_8 - isJava14 = JavaVersion.current() == JavaVersion.VERSION_14 - isJava15 = JavaVersion.current() == JavaVersion.VERSION_15 - isJava16 = JavaVersion.current() == JavaVersion.VERSION_16 - isJava17 = JavaVersion.current() == JavaVersion.VERSION_17 - isJava18 = JavaVersion.current() == JavaVersion.VERSION_18 - isJava19 = JavaVersion.current() == JavaVersion.VERSION_19 - isJava20 = JavaVersion.current() == JavaVersion.VERSION_20 - isJava21 = JavaVersion.current() == JavaVersion.VERSION_21 - - isJava21plus = isJava21 - isJava20plus = isJava20 || isJava21plus - isJava19plus = isJava19 || isJava20plus - isJava18plus = isJava18 || isJava19plus - isJava17plus = isJava17 || isJava18plus - isJava16plus = isJava16 || isJava17plus - isJava15plus = isJava15 || isJava16plus - isJava14plus = isJava14 || isJava15plus - isJava11plus = JavaVersion.current() >= JavaVersion.VERSION_11 - - // As of 2023-09-23, delombok doesn't yet support JDK 22; see https://projectlombok.org/changelog . - skipDelombok = JavaVersion.current() > JavaVersion.VERSION_21 + + // The int corresponding to the major version of the current JVM. + currentRuntimeJavaVersion = majorVersionToInt(JavaVersion.current().getMajorVersion()) + + // As of 2024-08-06, delombok doesn't yet support JDK 23; see https://projectlombok.org/changelog . + skipDelombok = currentRuntimeJavaVersion >= 23 parentDir = file("${rootDir}/../").absolutePath @@ -122,7 +115,7 @@ task installGitHooks(type: Copy, dependsOn: 'setLocalRepo') { into localRepo + '/hooks' } -if (isJava11plus) { +if (currentRuntimeJavaVersion >= 11) { apply plugin: 'com.diffplug.spotless' spotless { // Resolve the Spotless plugin dependencies from the buildscript repositories rather than the @@ -153,13 +146,6 @@ if (isJava11plus) { } } -def majorVersionToInt(majorVersionString) { - if (majorVersionString.endsWith("-ea")) { - majorVersionString = majorVersionString.substring(0, majorVersionString.length() - 3) - } - return Integer.valueOf(majorVersionString) -} - allprojects { // Increment the minor version (second number) rather than just the patch // level (third number) if: @@ -250,7 +236,7 @@ allprojects { ] } - if (isJava11plus) { + if (currentRuntimeJavaVersion >= 11) { apply plugin: 'com.diffplug.spotless' spotless { // If you add any formatters to this block that require dependencies, then you must also @@ -266,20 +252,19 @@ allprojects { '**/build/**', '*/dist/**', ] - if (!isJava14plus) { + if (currentRuntimeJavaVersion < 14) { doNotFormat += ['**/*record*/'] } - if (!isJava16plus) { + if (currentRuntimeJavaVersion < 16) { // TODO: directories should be renamed `-switchexpr` or some such, // as they only contain examples for switch expressions, which were // added in Java 14, not Java 17. doNotFormat += ['**/java17/'] } - if (!isJava21plus) { + if (currentRuntimeJavaVersion < 21) { doNotFormat += ['**/java21/'] } - format 'misc', { // define the files to apply `misc` to target '*.md', '*.tex', '.gitignore', 'Makefile' @@ -395,14 +380,13 @@ allprojects { tasks.withType(JavaCompile) { compilationTask -> dependsOn(':installGitHooks') String useJdkCompilerProp = project.getProperties().get('useJdkCompiler') - int runtimeCompiler = majorVersionToInt(JavaVersion.current().getMajorVersion()) int useJdkCompiler if (useJdkCompilerProp == null) { // If the property is not given, use the same version as the runtime. - useJdkCompiler = runtimeCompiler + useJdkCompiler = currentRuntimeJavaVersion } else { useJdkCompiler = majorVersionToInt(useJdkCompilerProp) - boolean useToolchains = (runtimeCompiler != useJdkCompiler) + boolean useToolchains = (currentRuntimeJavaVersion != useJdkCompiler) if (!isJava8 && useToolchains) { // This uses the requested Java compiler to compile all code. // CI test test-cftests-junit-jdk21 runs the JUnit tests on the different JDK versions, From aa2175d650e941c08260fdd0b287e68b035f0a69 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 16:11:33 -0400 Subject: [PATCH 30/35] Disable whole job, not just last step --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c5b4d74aa5..ca885d9f4af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,8 @@ jobs: name: ${{ matrix.script }} on JDK ${{ matrix.java.version }} runs-on: ubuntu-latest needs: remainder + # At least one plume-lib project no longer works on Java 8. + if: matrix.java.version != 8 || matrix.script != 'plume-lib' permissions: contents: read strategy: @@ -108,8 +110,6 @@ jobs: - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh - # At least one plume-lib project no longer works on Java 8. - if: matrix.java.version != 8 || matrix.script != 'plume-lib' # Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work # on Java 23 yet. This only tests the compiler, it does not use that version to run the tests. env: From 838417fafad91b6ffc979f0ff54cf03612d258ab Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 16:53:11 -0400 Subject: [PATCH 31/35] Fix option on Java 8 --- build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d037512e7d7..4f8f2d56cbd 100644 --- a/build.gradle +++ b/build.gradle @@ -459,7 +459,8 @@ allprojects { // warnings are suppressible with a "// fall through" comment. // -classfile: classgraph jar file and https://bugs.openjdk.org/browse/JDK-8190452 String lint = '-Xlint:-options,-fallthrough,-classfile' - if (useJdkCompiler >= 21) { + // Java 8 uses the Error Prone javac, not what is requested with useJdkCompiler. + if (!isJava8 && useJdkCompiler >= 21) { // TODO: Ignore this-escape for now, we may want to review and suppress each one later. lint +=',-this-escape' } From 3f62f31ba828416c8417c82e3f616afbab821f60 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 16:55:49 -0400 Subject: [PATCH 32/35] Exclude useless test combo --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca885d9f4af..699e17056ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,8 @@ jobs: runs-on: ubuntu-latest needs: remainder # At least one plume-lib project no longer works on Java 8. - if: matrix.java.version != 8 || matrix.script != 'plume-lib' + # Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary. + if: matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21') permissions: contents: read strategy: From 50c0598a5043db4a7105856e6fd9c44c782bad6e Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 17:04:06 -0400 Subject: [PATCH 33/35] Attempt different syntax --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 699e17056ff..002719919b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: needs: remainder # At least one plume-lib project no longer works on Java 8. # Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary. - if: matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21') + if: "${{ matrix.java.version }} != 8 || (${{ matrix.script }} != 'plume-lib' && ${{ matrix.script }} != 'cftests-junit-jdk21')" permissions: contents: read strategy: From 69bff16cc0011a36d83b024fc5e856c1b06fee60 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 17:18:14 -0400 Subject: [PATCH 34/35] Job if clause can't access matrix --- .github/workflows/ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 002719919b0..5e6aeaebb05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,9 +68,6 @@ jobs: name: ${{ matrix.script }} on JDK ${{ matrix.java.version }} runs-on: ubuntu-latest needs: remainder - # At least one plume-lib project no longer works on Java 8. - # Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary. - if: "${{ matrix.java.version }} != 8 || (${{ matrix.script }} != 'plume-lib' && ${{ matrix.script }} != 'cftests-junit-jdk21')" permissions: contents: read strategy: @@ -111,6 +108,13 @@ jobs: - name: Run test script checker/bin-devel/test-${{ matrix.script }} run: ./checker/bin-devel/test-${{ matrix.script }}.sh + # TODO: it would be nicer to not run the job at all, but GH Actions does + # not allow accessing the matrix on the job-if clause. There is also no way + # for an earlier step to stop execution successfully. + # + # At least one plume-lib project no longer works on Java 8. + # Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary. + if: matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21')" # Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work # on Java 23 yet. This only tests the compiler, it does not use that version to run the tests. env: From b1ff23c0be5a150f206a4af7e25e5ce82e5ef121 Mon Sep 17 00:00:00 2001 From: Werner Dietl Date: Tue, 6 Aug 2024 17:26:25 -0400 Subject: [PATCH 35/35] Fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e6aeaebb05..f46712b2646 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,7 @@ jobs: # # At least one plume-lib project no longer works on Java 8. # Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary. - if: matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21')" + if: matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21') # Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work # on Java 23 yet. This only tests the compiler, it does not use that version to run the tests. env: