Skip to content

Commit 315a7ed

Browse files
loserwang1024polyzos
authored andcommitted
[build] Upgrade default JDK compile version to 11 (apache#1197)
1 parent a497f3d commit 315a7ed

File tree

5 files changed

+196
-40
lines changed

5 files changed

+196
-40
lines changed

.github/workflows/ci-template.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
################################################################################
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
19+
# .github/workflows/ci-template.yaml
20+
name: CI Template
21+
22+
on:
23+
workflow_call:
24+
inputs:
25+
java-version:
26+
required: true
27+
type: string
28+
maven-parameters:
29+
description: "Any parameters of the Maven command."
30+
required: false
31+
type: string
32+
default: ""
33+
jobs:
34+
build:
35+
runs-on: self-hosted
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
module: [ core, flink ]
40+
name: "${{ matrix.module }}"
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v2
44+
- name: Set up JDK
45+
uses: actions/setup-java@v4
46+
with:
47+
java-version: ${{ inputs.java-version }}
48+
distribution: 'temurin'
49+
- name: Build
50+
run: |
51+
mvn -T 1C -B clean install -DskipTests
52+
- name: Test
53+
timeout-minutes: 60
54+
run: |
55+
TEST_MODULES=$(./.github/workflows/stage.sh ${{ matrix.module }})
56+
echo "github ref: ${{ github.ref }}"
57+
echo "Start testing modules: $TEST_MODULES"
58+
mvn -B verify $TEST_MODULES -Ptest-coverage -Ptest-${{ matrix.module }} -Dlog.dir=${{ runner.temp }}/fluss-logs -Dlog4j.configurationFile=${{ github.workspace }}/tools/ci/log4j.properties ${{ inputs.maven-parameters }}
59+
env:
60+
MAVEN_OPTS: -Xmx4096m
61+
ARTIFACTS_OSS_ENDPOINT: ${{ secrets.ARTIFACTS_OSS_ENDPOINT }}
62+
ARTIFACTS_OSS_REGION: ${{ secrets.ARTIFACTS_OSS_REGION }}
63+
ARTIFACTS_OSS_BUCKET: ${{ secrets.ARTIFACTS_OSS_BUCKET }}
64+
ARTIFACTS_OSS_ACCESS_KEY: ${{ secrets.ARTIFACTS_OSS_ACCESS_KEY }}
65+
ARTIFACTS_OSS_SECRET_KEY: ${{ secrets.ARTIFACTS_OSS_SECRET_KEY }}
66+
ARTIFACTS_OSS_STS_ENDPOINT: ${{ secrets.ARTIFACTS_OSS_STS_ENDPOINT }}
67+
ARTIFACTS_OSS_ROLE_ARN: ${{ secrets.ARTIFACTS_OSS_ROLE_ARN }}
68+
- name: Upload build logs
69+
uses: actions/upload-artifact@v4
70+
if: ${{ failure() }}
71+
with:
72+
name: logs-test-${{ matrix.module }}-${{ github.run_number}}#${{ github.run_attempt }}
73+
path: ${{ runner.temp }}/fluss-logs/*
74+
- name: Upload JaCoCo coverage report
75+
uses: actions/upload-artifact@v4
76+
if: ${{ success() && github.ref == 'refs/heads/main' }}
77+
with:
78+
name: jacoco-report-${{ matrix.module }}-${{ github.run_number}}#${{ github.run_attempt }}
79+
path: ${{ github.workspace }}/fluss-test-coverage/target/site/jacoco-aggregate/*

.github/workflows/ci.yaml

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,52 +22,36 @@ on:
2222
- main
2323
- release-**
2424
- ci-**
25+
paths-ignore:
26+
- 'website/**'
27+
- '**/*.md'
2528
pull_request:
2629
paths-ignore:
2730
- 'website/**'
2831
- '**/*.md'
32+
2933
concurrency:
3034
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
3135
cancel-in-progress: true
3236

3337
jobs:
34-
build:
35-
runs-on: self-hosted
36-
strategy:
37-
fail-fast: false
38-
matrix:
39-
module: [ core, flink ]
38+
compile-on-jdk8:
39+
name: "Compile Java 8"
40+
runs-on: ubuntu-latest
4041
steps:
4142
- name: Checkout code
4243
uses: actions/checkout@v2
44+
- name: Set up JDK 8
45+
uses: actions/setup-java@v4
46+
with:
47+
java-version: '8'
48+
distribution: 'temurin'
4349
- name: Build
4450
run: |
45-
mvn -T 1C -B clean install -DskipTests
46-
- name: Test
47-
timeout-minutes: 60
48-
run: |
49-
TEST_MODULES=$(./.github/workflows/stage.sh ${{ matrix.module }})
50-
echo "github ref: ${{ github.ref }}"
51-
echo "Start testing modules: $TEST_MODULES"
52-
mvn -B verify $TEST_MODULES -Ptest-coverage -Ptest-${{ matrix.module }} -Dlog.dir=${{ runner.temp }}/fluss-logs -Dlog4j.configurationFile=${{ github.workspace }}/tools/ci/log4j.properties
53-
env:
54-
MAVEN_OPTS: -Xmx4096m
55-
ARTIFACTS_OSS_ENDPOINT: ${{ secrets.ARTIFACTS_OSS_ENDPOINT }}
56-
ARTIFACTS_OSS_REGION: ${{ secrets.ARTIFACTS_OSS_REGION }}
57-
ARTIFACTS_OSS_BUCKET: ${{ secrets.ARTIFACTS_OSS_BUCKET }}
58-
ARTIFACTS_OSS_ACCESS_KEY: ${{ secrets.ARTIFACTS_OSS_ACCESS_KEY }}
59-
ARTIFACTS_OSS_SECRET_KEY: ${{ secrets.ARTIFACTS_OSS_SECRET_KEY }}
60-
ARTIFACTS_OSS_STS_ENDPOINT: ${{ secrets.ARTIFACTS_OSS_STS_ENDPOINT }}
61-
ARTIFACTS_OSS_ROLE_ARN: ${{ secrets.ARTIFACTS_OSS_ROLE_ARN }}
62-
- name: Upload build logs
63-
uses: actions/upload-artifact@v4
64-
if: ${{ failure() }}
65-
with:
66-
name: logs-test-${{ matrix.module }}-${{ github.run_number}}#${{ github.run_attempt }}
67-
path: ${{ runner.temp }}/fluss-logs/*
68-
- name: Upload JaCoCo coverage report
69-
uses: actions/upload-artifact@v4
70-
if: ${{ success() && github.ref == 'refs/heads/main' }}
71-
with:
72-
name: jacoco-report-${{ matrix.module }}-${{ github.run_number}}#${{ github.run_attempt }}
73-
path: ${{ github.workspace }}/fluss-test-coverage/target/site/jacoco-aggregate/*
51+
mvn -T 1C -B clean install -DskipTests -Pjava8
52+
53+
build-on-jdk11:
54+
name: "Java 11"
55+
uses: ./.github/workflows/ci-template.yaml
56+
with:
57+
java-version: "11"

.github/workflows/license-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Set JDK
3838
uses: actions/setup-java@v4
3939
with:
40-
java-version: 8
40+
java-version: 11
4141
distribution: 'temurin'
4242

4343
- name: Build

.github/workflows/nightly.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
################################################################################
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
name: Nightly
19+
on:
20+
schedule:
21+
# Run at 20:00 UTC daily which is the lowest traffic time for Fluss project.
22+
- cron: "0 20 * * *"
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.number || github.run_id }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
build-on-jdk8:
30+
name: "Java 8"
31+
uses: ./.github/workflows/ci-template.yaml
32+
with:
33+
java-version: "8"
34+
maven-parameters: "-Pjava8"

pom.xml

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<properties>
8383
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8484
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
85-
<target.java.version>1.8</target.java.version>
85+
<target.java.version>11</target.java.version>
8686
<maven.compiler.source>${target.java.version}</maven.compiler.source>
8787
<maven.compiler.target>${target.java.version}</maven.compiler.target>
8888
<test.unit.pattern>**/*Test.*</test.unit.pattern>
@@ -143,6 +143,25 @@
143143
plugin executes before, the property is undefined and makes the tests fail. Thus we define an empty property
144144
here to make sure it doesn't fail. See also https://issues.apache.org/jira/browse/SUREFIRE-1431 -->
145145
<argLine/>
146+
<extraJavaTestArgs>
147+
-XX:+IgnoreUnrecognizedVMOptions
148+
--add-opens=java.base/java.lang=ALL-UNNAMED
149+
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED
150+
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
151+
--add-opens=java.base/java.io=ALL-UNNAMED
152+
--add-opens=java.base/java.net=ALL-UNNAMED
153+
--add-opens=java.base/java.nio=ALL-UNNAMED
154+
--add-opens=java.base/java.util=ALL-UNNAMED
155+
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
156+
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
157+
--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
158+
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
159+
--add-opens=java.base/sun.nio.cs=ALL-UNNAMED
160+
--add-opens=java.base/sun.security.action=ALL-UNNAMED
161+
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED
162+
-Djdk.reflect.useDirectMethodHandle=false
163+
-Dio.netty.tryReflectionSetAccessible=true
164+
</extraJavaTestArgs>
146165
</properties>
147166

148167
<dependencies>
@@ -425,6 +444,29 @@
425444
</dependencyManagement>
426445

427446
<profiles>
447+
<profile>
448+
<id>java8</id>
449+
<properties>
450+
<target.java.version>1.8</target.java.version>
451+
</properties>
452+
<build>
453+
<plugins>
454+
<plugin>
455+
<groupId>org.apache.maven.plugins</groupId>
456+
<artifactId>maven-compiler-plugin</artifactId>
457+
<configuration>
458+
<source>${target.java.version}</source>
459+
<target>${target.java.version}</target>
460+
<useIncrementalCompilation>false</useIncrementalCompilation>
461+
<compilerArgs >
462+
<!-- Prevents recompilation due to missing package-info.class, see MCOMPILER-205 -->
463+
<arg>-Xpkginfo:always</arg>
464+
</compilerArgs>
465+
</configuration>
466+
</plugin>
467+
</plugins>
468+
</build>
469+
</profile>
428470
<profile>
429471
<id>test-coverage</id>
430472
<properties>
@@ -510,6 +552,22 @@
510552
<plugin>
511553
<groupId>org.apache.maven.plugins</groupId>
512554
<artifactId>maven-compiler-plugin</artifactId>
555+
<version>3.8.0</version>
556+
<configuration>
557+
<source>${target.java.version}</source>
558+
<target>${target.java.version}</target>
559+
<!-- The semantics of this option are reversed, see MCOMPILER-209. -->
560+
<useIncrementalCompilation>false</useIncrementalCompilation>
561+
<compilerArgs >
562+
<arg>--add-exports=java.base/sun.net.util=ALL-UNNAMED</arg>
563+
<arg>--add-exports=java.management/sun.management=ALL-UNNAMED</arg>
564+
<arg>--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED</arg>
565+
<arg>--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED</arg>
566+
<arg>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</arg>
567+
<!-- Prevents recompilation due to missing package-info.class, see MCOMPILER-205 -->
568+
<arg>-Xpkginfo:always</arg>
569+
</compilerArgs>
570+
</configuration>
513571
</plugin>
514572

515573
<plugin>
@@ -639,7 +697,7 @@
639697
<junit.jupiter.execution.parallel.config.strategy>dynamic
640698
</junit.jupiter.execution.parallel.config.strategy>
641699
</systemPropertyVariables>
642-
<argLine>@{argLine} -Xms256m -Xmx2048m -XX:+UseG1GC</argLine>
700+
<argLine>@{argLine} -Xms256m -Xmx2048m -XX:+UseG1GC ${extraJavaTestArgs}</argLine>
643701
</configuration>
644702
<executions>
645703
<!--execute all the unit tests-->
@@ -692,8 +750,8 @@
692750
<configuration>
693751
<rules>
694752
<requireMavenVersion>
695-
<!-- enforce at least mvn version 3.1.1 (see FLINK-12447) -->
696-
<version>[3.1.1,)</version>
753+
<!-- enforce at least mvn version 3.8.6 -->
754+
<version>[3.8.6,)</version>
697755
</requireMavenVersion>
698756
<requireJavaVersion>
699757
<version>${target.java.version}</version>
@@ -879,6 +937,7 @@
879937
<artifactId>maven-compiler-plugin</artifactId>
880938
<version>3.8.0</version>
881939
<configuration>
940+
<!-- Make sure that we only use Java 8 compatible APIs -->
882941
<source>${target.java.version}</source>
883942
<target>${target.java.version}</target>
884943
<!-- The semantics of this option are reversed, see MCOMPILER-209. -->

0 commit comments

Comments
 (0)