From 65ce1448dd9d7af2238543c422aa259832418f09 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 15 Jun 2021 11:56:48 +0200 Subject: [PATCH 1/4] Check jdk16 --- .github/workflows/test-jdk16.yaml | 168 ++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 .github/workflows/test-jdk16.yaml diff --git a/.github/workflows/test-jdk16.yaml b/.github/workflows/test-jdk16.yaml new file mode 100644 index 000000000..841af8c16 --- /dev/null +++ b/.github/workflows/test-jdk16.yaml @@ -0,0 +1,168 @@ +# +# Copyright (c) 2017 Angelo Zerr and other contributors as +# indicated by the @author tags. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: GitHub Actions +on: [push, pull_request] + +env: + GRAALVM_VERSION: '21.1.0.java16' + +jobs: + + linux-jdk16: + runs-on: ubuntu-18.04 + steps: + + - uses: actions/checkout@v1 + + - name: Set VERSION env var + run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: setup-graalvm-ce + uses: DeLaGuardo/setup-graalvm@8bbfe44ef9c6f5c07e5af036a1bffd561c037d18 + with: + graalvm-version: ${{ env.GRAALVM_VERSION }} + + - name: gu install native-image + run: gu install native-image + + - name: Skip tests when releasing from a tag + if: startsWith(github.ref, 'refs/tags') + shell: bash + run: echo "SKIP_TESTS_OPT=-DskipTests" >> $GITHUB_ENV + + - name: mvn clean verify + run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e $SKIP_TESTS_OPT + + - name: Upload daemon test logs + if: ${{ success() || failure() }} + uses: actions/upload-artifact@v2 + with: + name: daemon-test-logs-linux + path: integration-tests/target/mvnd-tests/**/daemon*.log + + - name: Upload mvnd.zip + uses: actions/upload-artifact@v2 + with: + name: mvnd-linux-amd64.zip + path: dist/target/mvnd-*.zip + + windows-jdk16: + runs-on: windows-2019 + steps: + + - name: setup-graalvm-ce + uses: DeLaGuardo/setup-graalvm@8bbfe44ef9c6f5c07e5af036a1bffd561c037d18 + with: + graalvm-version: ${{ env.GRAALVM_VERSION }} + + - name: gu install native-image + shell: cmd + run: gu install native-image + + - uses: actions/cache@v2 + with: + path: ${{ env.JAVA_HOME }}\bin\native-image.exe + key: ${{ runner.os }}-native-image-${{ env.GRAALVM_VERSION }} + + - name: Check if native-image.exe exists + id: native_image_exe_exists + uses: andstor/file-existence-action@v1 + with: + files: ${{ env.JAVA_HOME }}\bin\native-image.exe + + - name: Compile native-image.cmd to native-image.exe + if: ${{ steps.native_image_exe_exists.outputs.files_exists == 'false' }} + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + "%JAVA_HOME%\bin\native-image.cmd" -jar "%JAVA_HOME%\lib\graalvm\svm-driver.jar" native-image + + - name: move native-image.exe %JAVA_HOME%\bin\ + if: ${{ steps.native_image_exe_exists.outputs.files_exists == 'false' }} + shell: cmd + run: | + move native-image.exe "%JAVA_HOME%\bin\" + + - uses: actions/checkout@v1 + + - name: Set VERSION env var + shell: bash + run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Skip tests when releasing from a tag + if: startsWith(github.ref, 'refs/tags') + shell: bash + run: echo "SKIP_TESTS_OPT=-DskipTests" >> $GITHUB_ENV + + - name: mvn clean verify + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e %SKIP_TESTS_OPT% + + - name: Upload daemon test logs + if: ${{ success() || failure() }} + uses: actions/upload-artifact@v2 + with: + name: daemon-test-logs-windows + path: integration-tests/target/mvnd-tests/**/daemon*.log + + - name: Upload mvnd.zip + uses: actions/upload-artifact@v2 + with: + name: mvnd-windows-amd64.zip + path: dist/target/mvnd-*.zip + + darwin-jdk16: + runs-on: macos-10.15 + steps: + + - uses: actions/checkout@v1 + + - name: Set VERSION env var + run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: setup-graalvm-ce + uses: DeLaGuardo/setup-graalvm@8bbfe44ef9c6f5c07e5af036a1bffd561c037d18 + with: + graalvm-version: ${{ env.GRAALVM_VERSION }} + + - name: gu install native-image + run: gu install native-image + + - name: Skip tests when releasing from a tag + if: startsWith(github.ref, 'refs/tags') + shell: bash + run: echo "SKIP_TESTS_OPT=-DskipTests" >> $GITHUB_ENV + + - name: mvn clean verify + run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e $SKIP_TESTS_OPT + + - name: Upload daemon test logs + if: ${{ success() || failure() }} + uses: actions/upload-artifact@v2 + with: + name: daemon-test-logs-darwin + path: integration-tests/target/mvnd-tests/**/daemon*.log + + - name: Upload mvnd.zip + uses: actions/upload-artifact@v2 + with: + name: mvnd-darwin-amd64.zip + path: dist/target/mvnd-*.zip + From 20e4d48ebcafaf065e232c2a79ff0d2c0557aee0 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 15 Jun 2021 15:37:12 +0200 Subject: [PATCH 2/4] Fix tests on JDK 16 --- daemon/pom.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/daemon/pom.xml b/daemon/pom.xml index 49659b4db..292ee1f57 100644 --- a/daemon/pom.xml +++ b/daemon/pom.xml @@ -111,6 +111,20 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + true + 1 + true + + --add-opens java.base/java.io=ALL-UNNAMED + --add-opens java.base/sun.nio.fs=ALL-UNNAMED + + + From 6524569d9478a2efb9a5e9ed4d3683186ebb8772 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 15 Jun 2021 16:40:38 +0200 Subject: [PATCH 3/4] Modify the environment test to check for mismatches --- .../src/test/java/org/mvndaemon/mvnd/it/EnvironmentTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/EnvironmentTest.java b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/EnvironmentTest.java index 9363a74b0..e5b0fdd76 100644 --- a/integration-tests/src/test/java/org/mvndaemon/mvnd/it/EnvironmentTest.java +++ b/integration-tests/src/test/java/org/mvndaemon/mvnd/it/EnvironmentTest.java @@ -59,6 +59,8 @@ void cleanInstall() throws IOException, InterruptedException { String pathStr = dir.toAbsolutePath().toString(); assertTrue(output.getMessages().stream() .anyMatch(m -> m.toString().contains(pathStr)), "Output should contain " + pathStr); + assertTrue(output.getMessages().stream() + .noneMatch(m -> m.toString().contains("Environment mismatch"))); } assertDaemonRegistrySize(1); } From 4fe532addf00cbb2cf64c84b08d2441cb460394f Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 15 Jun 2021 17:10:03 +0200 Subject: [PATCH 4/4] Open java.io and sun.nio.fs --- .../main/java/org/mvndaemon/mvnd/client/DaemonConnector.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java index ffe51c84f..fc5ffb1e6 100644 --- a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java +++ b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java @@ -380,7 +380,10 @@ private Process startDaemonProcess(String daemonId) { ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.environment() .put("JDK_JAVA_OPTIONS", - "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED"); + "--add-opens java.base/java.io=ALL-UNNAMED " + + "--add-opens java.base/java.lang=ALL-UNNAMED " + + "--add-opens java.base/java.util=ALL-UNNAMED " + + "--add-opens java.base/sun.nio.fs=ALL-UNNAMED"); Process process = processBuilder .directory(workingDir.toFile()) .command(args)