From cbb396762b67b873e93a65a30d3f43ff0d57c4b0 Mon Sep 17 00:00:00 2001 From: Devin Smith Date: Tue, 19 Oct 2021 11:10:20 -0700 Subject: [PATCH] Upgrade compiler to JDK17, fixes #1367. (#1397) * Upgrade compiler to JDK17, fixes #1367. Notes: * Gradle was upgraded to 6.9.1 to fix issue with needing to manually open jdk.compiler/com.sun.tools.javac.code. See https://github.com/gradle/gradle/issues/15538, https://docs.gradle.org/6.9/release-notes.html, https://docs.gradle.org/6.9.1/release-notes.html * Gradle 6.9.1 can't be run from JDK17. As part of the CI setup, we need to make sure a non-JDK17 is set as the default. See https://docs.gradle.org/6.9.1/userguide/compatibility.html * zulu seems to provide more consistent release versions. It may be that we "adopt" is no longer terminilogy that should be used. See https://blog.adoptopenjdk.net/2021/03/transition-to-eclipse-an-update/ * Groovy does not like to compile the test code for open-api-lang-tools with JDK17. Various things were tried. Ended up setting Groovy compiler to 8 for now. May need to bump groovy version? * Some additional hinting was needing in the lambdas in TableHandleManagerSerial. I didn't dig in further why. * The gradle property org.gradle.java.installations.auto-download=false was removed from gradle.properties. Users wishing to guard against auto-download should set it as appropriate in ~/.gradle/gradle.properties. Note: auto-download is still disabled for CI. * Upgrade groovy to 3.0.9 Notes: * Groovy compiler _can_ be bumped up to Java 17, but the construction in gradle is a bit hacky, so it's not enabled. * The only module that needs groovy for compilation is open-api-lang-tools for testing. * Spock version in open-api-lang-tools for testing needed to be upgraded. * Newer spock needed useJUnitPlatform() for tests to run. * Various cleanup of open-api-lang-tools dependencies. --- .github/workflows/build-ci.yml | 98 +++++++++++++------ .github/workflows/check-ci.yml | 17 +++- .github/workflows/docs-ci.yml | 39 ++++++-- .github/workflows/long-check-ci.yml | 17 +++- .github/workflows/nightly-benchmarks.yml | 17 +++- .github/workflows/nightly-check-ci.yml | 68 ++++++++++--- .github/workflows/publish-ci.yml | 17 +++- Internals/gradle.properties | 2 + application-mode/build.gradle | 2 +- buildSrc/src/main/groovy/Classpaths.groovy | 8 ++ .../io.deephaven.java-conventions.gradle | 69 +++++++++++-- classpaths.gradle | 13 +-- gradle.properties | 5 - gradle/wrapper/gradle-wrapper.properties | 4 +- java-client/flight-dagger/gradle.properties | 1 + java-client/flight/gradle.properties | 1 + java-client/session-dagger/gradle.properties | 1 + java-client/session/gradle.properties | 1 + .../client/impl/TableHandleManagerSerial.java | 6 +- open-api/lang-tools/lang-tools.gradle | 46 ++------- .../gradle.properties | 1 + proto/proto-backplane-grpc/gradle.properties | 1 + py/jpy-config/build.gradle | 2 +- qst/gradle.properties | 1 + table-api/gradle.properties | 1 + 25 files changed, 305 insertions(+), 133 deletions(-) create mode 100644 Internals/gradle.properties create mode 100644 java-client/flight-dagger/gradle.properties create mode 100644 java-client/flight/gradle.properties create mode 100644 java-client/session-dagger/gradle.properties create mode 100644 java-client/session/gradle.properties create mode 100644 proto/proto-backplane-grpc-flight/gradle.properties create mode 100644 proto/proto-backplane-grpc/gradle.properties create mode 100644 qst/gradle.properties create mode 100644 table-api/gradle.properties diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 37d894974be..18f1ffb3351 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -11,14 +11,28 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + + - name: Setup gradle properties + run: | + cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties + - name: Get Semver id: semver if: ${{ startsWith(github.ref, 'refs/heads/release/v') }} @@ -58,11 +72,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Setup gradle properties - run: | - cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties - - name: Create Dockerfile and context uses: burrunan/gradle-cache-action@v1 with: @@ -88,13 +97,28 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + + - name: Setup gradle properties + run: | + cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties + - name: Get Semver id: semver if: ${{ startsWith(github.ref, 'refs/heads/release/v') }} @@ -133,11 +157,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Setup gradle properties - run: | - cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties - - name: Create Dockerfile and context uses: burrunan/gradle-cache-action@v1 with: @@ -160,13 +179,28 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + + - name: Setup gradle properties + run: | + cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties + - name: Get Semver id: semver if: ${{ startsWith(github.ref, 'refs/heads/release/v') }} @@ -205,11 +239,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Setup gradle properties - run: | - cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties - - name: Create Dockerfile and context uses: burrunan/gradle-cache-action@v1 with: @@ -256,14 +285,28 @@ jobs: org.opencontainers.image.description=Deephaven web org.opencontainers.image.licenses=Deephaven Community License Agreement 1.0 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + + - name: Setup gradle properties + run: | + cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties + - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1.3.0 @@ -279,11 +322,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Setup gradle properties - run: | - cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties - - name: Create Dockerfile and context uses: burrunan/gradle-cache-action@v1 with: diff --git a/.github/workflows/check-ci.yml b/.github/workflows/check-ci.yml index 02ec6f1b5d1..efc1dbd0e71 100644 --- a/.github/workflows/check-ci.yml +++ b/.github/workflows/check-ci.yml @@ -16,18 +16,27 @@ jobs: - name: Check gitignore rules run: .github/scripts/check-gitignore-rules.sh - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Check uses: burrunan/gradle-cache-action@v1 diff --git a/.github/workflows/docs-ci.yml b/.github/workflows/docs-ci.yml index 46ad630943d..e369349ef4d 100644 --- a/.github/workflows/docs-ci.yml +++ b/.github/workflows/docs-ci.yml @@ -13,6 +13,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Setup JDK 8 + id: setup-java-8 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '8.0.302' + - name: Setup JDK 15 id: setup-java-15 uses: actions/setup-java@v2.2.0 @@ -20,17 +27,20 @@ jobs: distribution: 'zulu' java-version: '15.0.4' - - name: Setup JDK 8 - id: setup-java-8 + - name: Setup JDK 17 + id: setup-java-17 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' - java-version: '8.0.302' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-15.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-15.outputs.path }},${{ steps.setup-java-17.outputs.path }}" >> gradle.properties - name: All Javadoc uses: burrunan/gradle-cache-action@v1 @@ -64,6 +74,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Setup JDK 8 + id: setup-java-8 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '8.0.302' + - name: Setup JDK 15 id: setup-java-15 uses: actions/setup-java@v2.2.0 @@ -71,17 +88,20 @@ jobs: distribution: 'zulu' java-version: '15.0.4' - - name: Setup JDK 8 - id: setup-java-8 + - name: Setup JDK 17 + id: setup-java-17 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' - java-version: '8.0.302' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-15.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-15.outputs.path }},${{ steps.setup-java-17.outputs.path }}" >> gradle.properties - name: Generate Python Docs uses: burrunan/gradle-cache-action@v1 @@ -127,6 +147,9 @@ jobs: distribution: 'zulu' java-version: '8.0.302' + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties diff --git a/.github/workflows/long-check-ci.yml b/.github/workflows/long-check-ci.yml index 109b96e2fc7..ef208e0584f 100644 --- a/.github/workflows/long-check-ci.yml +++ b/.github/workflows/long-check-ci.yml @@ -13,18 +13,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Check uses: burrunan/gradle-cache-action@v1 diff --git a/.github/workflows/nightly-benchmarks.yml b/.github/workflows/nightly-benchmarks.yml index cf90678fe78..db141c7a140 100644 --- a/.github/workflows/nightly-benchmarks.yml +++ b/.github/workflows/nightly-benchmarks.yml @@ -14,18 +14,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Build uses: burrunan/gradle-cache-action@v1 diff --git a/.github/workflows/nightly-check-ci.yml b/.github/workflows/nightly-check-ci.yml index bbdc48264fa..ac64264b35b 100644 --- a/.github/workflows/nightly-check-ci.yml +++ b/.github/workflows/nightly-check-ci.yml @@ -17,18 +17,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Run gradle uses: burrunan/gradle-cache-action@v1 @@ -76,18 +85,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Run gradle uses: burrunan/gradle-cache-action@v1 @@ -135,18 +153,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Run gradle uses: burrunan/gradle-cache-action@v1 @@ -194,18 +221,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Run gradle uses: burrunan/gradle-cache-action@v1 diff --git a/.github/workflows/publish-ci.yml b/.github/workflows/publish-ci.yml index 5b8c23b3499..5852e6060d9 100644 --- a/.github/workflows/publish-ci.yml +++ b/.github/workflows/publish-ci.yml @@ -11,18 +11,27 @@ jobs: - name: Checkout uses: actions/checkout@v2 - # note: this uses Zulu and not AdoptOpenJDK or other. should make sure we build and test on the same one... - - name: Setup JDK - id: setup-java + - name: Setup JDK 8 + id: setup-java-8 uses: actions/setup-java@v2.2.0 with: distribution: 'zulu' java-version: '8.0.302' + - name: Setup JDK 17 + id: setup-java-17 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'zulu' + java-version: '17.0.0' + + - name: Set JAVA_HOME + run: echo "JAVA_HOME=${{ steps.setup-java-8.outputs.path }}" >> $GITHUB_ENV + - name: Setup gradle properties run: | cat .github/env/${{ runner.os }}/gradle.properties >> gradle.properties - echo "org.gradle.java.installations.paths=${{ steps.setup-java.outputs.path }}" >> gradle.properties + echo "org.gradle.java.installations.paths=${{ steps.setup-java-8.outputs.path }},${{ steps.setup-java-17.outputs.path }}," >> gradle.properties - name: Publish uses: burrunan/gradle-cache-action@v1 diff --git a/Internals/gradle.properties b/Internals/gradle.properties new file mode 100644 index 00000000000..b8a1ccfc231 --- /dev/null +++ b/Internals/gradle.properties @@ -0,0 +1,2 @@ +compilerVersion=8 +languageLevel=8 diff --git a/application-mode/build.gradle b/application-mode/build.gradle index 47e029ed386..1ce2a6037aa 100644 --- a/application-mode/build.gradle +++ b/application-mode/build.gradle @@ -6,7 +6,7 @@ dependencies { Classpaths.inheritImmutables(project) // we'll rely on the DB to provide the necessary groovy dependencies - compileOnly "org.codehaus.groovy:groovy:$GROOVY_VERSION" + Classpaths.inheritGroovy(project, 'groovy', 'compileOnly') api project(':proto:proto-backplane-grpc') diff --git a/buildSrc/src/main/groovy/Classpaths.groovy b/buildSrc/src/main/groovy/Classpaths.groovy index caf8478567a..eee089ddc79 100644 --- a/buildSrc/src/main/groovy/Classpaths.groovy +++ b/buildSrc/src/main/groovy/Classpaths.groovy @@ -78,6 +78,9 @@ class Classpaths { static final String LOGBACK_NAME = 'logback-classic' static final String LOGBACK_VERSION = '1.2.3' + static final String GROOVY_GROUP = 'org.codehaus.groovy' + static final String GROOVY_VERSION = '3.0.9' + static boolean addDependency(Configuration conf, String group, String name, String version, Action configure = Actions.doNothing()) { if (!conf.dependencies.find { it.name == name && it.group == group}) { DefaultExternalModuleDependency dep = dependency group, name, version @@ -187,4 +190,9 @@ class Classpaths { Configuration config = p.configurations.getByName(configName) addDependency(config, SLF4J_GROUP, name, SLF4J_VERSION) } + + static void inheritGroovy(Project p, String name, String configName) { + Configuration config = p.configurations.getByName(configName) + addDependency(config, GROOVY_GROUP, name, GROOVY_VERSION) + } } diff --git a/buildSrc/src/main/groovy/io.deephaven.java-conventions.gradle b/buildSrc/src/main/groovy/io.deephaven.java-conventions.gradle index 9274992456e..ed849165d3f 100644 --- a/buildSrc/src/main/groovy/io.deephaven.java-conventions.gradle +++ b/buildSrc/src/main/groovy/io.deephaven.java-conventions.gradle @@ -4,20 +4,77 @@ plugins { def archivesBaseNamePrefix = 'deephaven-' +def compilerVersion = Integer.parseInt((String)project.findProperty('compilerVersion') ?: '17') +def languageLevel = Integer.parseInt((String)project.findProperty('languageLevel') ?: '8') +def runtimeVersion = Integer.parseInt((String)project.findProperty('runtimeVersion') ?: '8') + +if (languageLevel > compilerVersion) { + throw new IllegalArgumentException("languageLevel must be less than or equal to compileVersion") +} +if (languageLevel < 8) { + throw new IllegalArgumentException("languageLevel must be greater than or equal to 8") +} +if (runtimeVersion < languageLevel) { + throw new IllegalArgumentException("runtimeVersion must be greater than or equal to languageLevel") +} + archivesBaseName = "${archivesBaseNamePrefix}${project.name}" java { toolchain { - languageVersion = JavaLanguageVersion.of(8) + // Note: even though we are being explicit with our compilers / launchers via task type, we want to set up the + // plugin with our compiler version. + languageVersion = JavaLanguageVersion.of(compilerVersion) } } +def compiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(compilerVersion) +} as Provider + +def runtimeLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(runtimeVersion) +} as Provider + +def groovyCompilerLauncher = javaToolchains.launcherFor { + // See notes in GroovyCompile section below. + // languageVersion = JavaLanguageVersion.of(compilerVersion) + languageVersion = JavaLanguageVersion.of(8) +} as Provider + tasks.withType(JavaCompile).configureEach { - JavaCompile javac -> - javac.options.fork = true - javac.options.encoding = 'UTF-8' - javac.options.incremental = true - javac.options.compilerArgs << '-parameters' + javaCompiler.set compiler + + options.fork = true + options.encoding = 'UTF-8' + options.incremental = true + options.compilerArgs << '-parameters' + + if (compilerVersion != languageLevel) { + options.release.set languageLevel + } +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set runtimeLauncher +} + +tasks.withType(Test).configureEach { + javaLauncher.set runtimeLauncher +} + +tasks.withType(GroovyCompile).configureEach { + javaLauncher.set groovyCompilerLauncher + + // Instead of using the below code, which is rather hacky, we'll set the groovy compiler to 8. + // In general, it seems like groovy toolchain support is a bit lacking in fit and finish. + +// // The release option doesn't seem to get picked up. +// // WARNING: The below breaks when not using strings with the following error: +// // The new Java toolchain feature cannot be used at the project level in combination with source and/or target +// // compatibility. +// setSourceCompatibility(String.valueOf(languageLevel)) +// setTargetCompatibility(String.valueOf(languageLevel)) } tasks.withType(Jar).configureEach { diff --git a/classpaths.gradle b/classpaths.gradle index f0eaed32243..b8b2221c48d 100644 --- a/classpaths.gradle +++ b/classpaths.gradle @@ -1,13 +1,5 @@ apply plugin: 'base' -JavaVersion currentJavaVersion = JavaVersion.current() -boolean is8 = currentJavaVersion.isJava8() - -ext { - // changing groovy version is dangerous for customer PQ stability; only upgrade is user is also upgrading java version >8 - GROOVY_VERSION = is8 ? '2.3.6' : '2.5.10' -} - configurations { commonsIo @@ -108,8 +100,6 @@ dependencies { dhUtil 'ant:ant:1.6.5' dhDb 'joda-time:joda-time:2.10', - "org.codehaus.groovy:groovy:$GROOVY_VERSION", - "org.codehaus.groovy:groovy-json:$GROOVY_VERSION", 'com.jcraft:jsch:0.1.51', "org.eclipse.jgit:org.eclipse.jgit:$Classpaths.JGIT_VERSION", "org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:$Classpaths.JGIT_VERSION", @@ -120,6 +110,9 @@ dependencies { 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8', 'com.tdunning:t-digest:3.2' + Classpaths.inheritGroovy(project, 'groovy', 'dhDb') + Classpaths.inheritGroovy(project, 'groovy-json', 'dhDb') + // https://mvnrepository.com/artifact/com.univocity/univocity-parsers dhBenchmarkSupport 'com.univocity:univocity-parsers:2.6.0', // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core diff --git a/gradle.properties b/gradle.properties index 3ec39b4c591..13049b5c6c4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,3 @@ -# We do not want gradle to auto-download a JDK - we are assuming that developers should be setting -# up their JDK environments as a prerequisite. -# See https://docs.gradle.org/6.8.3/userguide/toolchains.html#sec:provisioning -org.gradle.java.installations.auto-download=false - #org.gradle.debug ## Enable to attach debugger to port 5005 when running gradle ## Note, you can use -Dorg.gradle.debug=true as well. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8597a4d85c5..af18bba73bf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip -distributionSha256Sum=9af5c8e7e2cd1a3b0f694a4ac262b9f38c75262e74a9e8b5101af302a6beadd7 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip +distributionSha256Sum=b13f5d97f08000996bf12d9dd70af3f2c6b694c2c663ab1b545e9695562ad1ee zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java-client/flight-dagger/gradle.properties b/java-client/flight-dagger/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/java-client/flight-dagger/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/java-client/flight/gradle.properties b/java-client/flight/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/java-client/flight/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/java-client/session-dagger/gradle.properties b/java-client/session-dagger/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/java-client/session-dagger/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/java-client/session/gradle.properties b/java-client/session/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/java-client/session/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/java-client/session/src/main/java/io/deephaven/client/impl/TableHandleManagerSerial.java b/java-client/session/src/main/java/io/deephaven/client/impl/TableHandleManagerSerial.java index 91595c5b57b..dab904b8eea 100644 --- a/java-client/session/src/main/java/io/deephaven/client/impl/TableHandleManagerSerial.java +++ b/java-client/session/src/main/java/io/deephaven/client/impl/TableHandleManagerSerial.java @@ -49,7 +49,8 @@ public TableHandle execute(TableSpec table) throws TableHandleException, Interru final TableHandleManager manager = new TableHandleManagerSerial(session, tracker); final TableAdapterResults results; try { - results = checked(() -> TableCreator.create(manager, i -> i, i -> i, table)); + // noinspection RedundantTypeArguments + results = checked(() -> TableCreator.create(manager, i -> i, i -> i, table)); } catch (Throwable t) { tracker.closeAllExceptAndRemoveAll(Collections.emptySet()); throw t; @@ -65,7 +66,8 @@ public List execute(Iterable tables) throws TableHandleE final TableHandleManager manager = new TableHandleManagerSerial(session, tracker); final TableAdapterResults results; try { - results = checked(() -> TableCreator.create(manager, i -> i, i -> i, tables)); + // noinspection RedundantTypeArguments + results = checked(() -> TableCreator.create(manager, i -> i, i -> i, tables)); } catch (Throwable t) { tracker.closeAllExceptAndRemoveAll(Collections.emptySet()); throw t; diff --git a/open-api/lang-tools/lang-tools.gradle b/open-api/lang-tools/lang-tools.gradle index 7037c006140..de9432b4c72 100644 --- a/open-api/lang-tools/lang-tools.gradle +++ b/open-api/lang-tools/lang-tools.gradle @@ -4,44 +4,27 @@ plugins { apply from: "$rootDir/gradle/web-common.gradle" -String GROOVY_VERSION = '2.5.11' -// in case you need to test "old groovy vs. new groovy", you can swap above line w/ below line -//String GROOVY_VERSION = '2.3.6' - Classpaths.inheritCommonsText(project) dependencies { - // We want to use a newer version of groovy for spock tests, - // so we'll exclude groovy from our dependencies, and explicitly use the same version as spock. - // Note this is compileOnly, which is *non-transitive*. - compileOnly "org.codehaus.groovy:groovy-all:$GROOVY_VERSION" + compile project(':open-api-shared-ide'), project(':open-api-lang-parser') - compile(project(':DB')) { - exclude module: "groovy-all" - } + compile(project(':DB')) compile project(':IO') - testCompileOnly ('org.spockframework:spock-core:1.3-groovy-2.5') - testRuntimeOnly ('org.spockframework:spock-core:1.3-groovy-2.5') - // in case you need to test "old groovy vs. new groovy", you can swap above two lines w/ below two lines -// testCompileOnly ('org.spockframework:spock-core:1.1-groovy-2.3') -// testRuntimeOnly ('org.spockframework:spock-core:1.1-groovy-2.3') - // WARNING: if you switch to groovy 2.3, you'll need to comment out a bunch of method bodies in TestConstants.groovy. + testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0' - testCompileOnly 'org.junit.jupiter:junit-jupiter-api:5.4.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-api:5.4.2' + Classpaths.inheritJUnitPlatform(project) + testImplementation 'org.junit.jupiter:junit-jupiter' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2' + Classpaths.inheritGroovy(project, 'groovy', 'testCompile') + Classpaths.inheritGroovy(project, 'groovy-templates', 'testCompile') - testCompile(project(path: ':DB', configuration: 'testOutput')) { - exclude module: "groovy-all" - } + testCompile(project(path: ':DB', configuration: 'testOutput')) testRuntime project(':configs') testRuntime project(':test-configs') - testRuntime(project(':Numerics')) { - exclude module: "groovy-all" - } + testRuntime(project(':Numerics')) // intellij can be dumb and leave out our resources directory (sometimes)... // Do not cargo-cult this unless you have similar issues testRuntime files('build/resources/main') @@ -50,15 +33,6 @@ dependencies { Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') } -configurations.all { - Configuration c -> - c.resolutionStrategy.forcedModules = [ - "org.codehaus.groovy:groovy:$GROOVY_VERSION", - "org.codehaus.groovy:groovy-templates:$GROOVY_VERSION", - "org.codehaus.groovy:groovy-json:$GROOVY_VERSION", - ] -} - test { systemProperty('Configuration.rootFile', 'dh-tests.prop') @@ -69,5 +43,5 @@ test { def pyProps = project.properties.subMap(["jpy.pythonLib", "jpy.jpyLib", "jpy.jdlLib"]) systemProperties.putAll(pyProps) - + useJUnitPlatform() } diff --git a/proto/proto-backplane-grpc-flight/gradle.properties b/proto/proto-backplane-grpc-flight/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/proto/proto-backplane-grpc-flight/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/proto/proto-backplane-grpc/gradle.properties b/proto/proto-backplane-grpc/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/proto/proto-backplane-grpc/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/py/jpy-config/build.gradle b/py/jpy-config/build.gradle index 8aef21a48f3..979a78cd1ec 100644 --- a/py/jpy-config/build.gradle +++ b/py/jpy-config/build.gradle @@ -1 +1 @@ -// empty on purpose - shouldn't have any dependencies \ No newline at end of file +// empty on purpose - shouldn't have any dependencies diff --git a/qst/gradle.properties b/qst/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/qst/gradle.properties @@ -0,0 +1 @@ +languageLevel=8 diff --git a/table-api/gradle.properties b/table-api/gradle.properties new file mode 100644 index 00000000000..9a835bc801b --- /dev/null +++ b/table-api/gradle.properties @@ -0,0 +1 @@ +languageLevel=8