Skip to content

Commit 2eca4f0

Browse files
authored
Enable lint and errorprone checks in Jdk11 (#289)
* Enable lint and errorprone checks in Jdk11 * Create separate profile/step for lint checks
1 parent 7d167ad commit 2eca4f0

File tree

3 files changed

+72
-11
lines changed

3 files changed

+72
-11
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,29 @@ jobs:
1717
quick-build:
1818
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'CI build')
1919
runs-on: ubuntu-latest
20+
container: centos:7
2021
steps:
2122
- name: Checkout repository
2223
uses: actions/checkout@v1
23-
- name: Setup Java
24-
uses: actions/setup-java@v1
25-
with:
26-
java-version: 8
24+
- name: Install environment
25+
run: |
26+
yum -y update
27+
yum -y install centos-release-scl-rh epel-release
28+
yum -y install java-11-openjdk-devel devtoolset-7
29+
echo Downloading Maven
30+
curl -L https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -o $HOME/apache-maven-3.6.3-bin.tar.gz
31+
tar xzf $HOME/apache-maven-3.6.3-bin.tar.gz -C /opt/
32+
ln -sf /opt/apache-maven-3.6.3/bin/mvn /usr/bin/mvn
2733
- name: Build project
2834
run: |
29-
git --version
35+
source scl_source enable devtoolset-7 || true
36+
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
37+
echo $JAVA_HOME
3038
mvn -version
31-
mvn clean install -Pdev -B -U -e
39+
mvn clean install -Pdev,jdk11 -B -U -e -Dlint.skip=true
40+
- name: Run lint checks
41+
run: |
42+
mvn compiler:compile -Pdev,jdk11 -B -U -e
3243
prepare:
3344
runs-on: ubuntu-latest
3445
outputs:

pom.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<junit.version>5.6.2</junit.version>
4242
<jmh.version>1.21</jmh.version>
4343
<versions-plugin.version>2.7</versions-plugin.version>
44+
<errorprone.version>2.6.0</errorprone.version>
4445
<maven.javadoc.skip>true</maven.javadoc.skip>
4546
<maven.source.skip>true</maven.source.skip>
4647
<gpg.skip>true</gpg.skip>
@@ -174,6 +175,60 @@
174175
<maven.compiler.release>11</maven.compiler.release>
175176
</properties>
176177
</profile>
178+
179+
<!--
180+
Profile that enables lint checks on compilation
181+
Uses Google Error Prone for more coverage
182+
-->
183+
<profile>
184+
<id>lint</id>
185+
<activation>
186+
<!-- activate lint checks only on JDK1.9+ (required by Error Prone) -->
187+
<jdk>(1.9,)</jdk>
188+
<!-- custom property to disable link checks on command line (enabled by default) -->
189+
<property>
190+
<name>!lint.skip</name>
191+
<value>!true</value>
192+
</property>
193+
</activation>
194+
<build>
195+
<plugins>
196+
<plugin>
197+
<groupId>org.apache.maven.plugins</groupId>
198+
<artifactId>maven-compiler-plugin</artifactId>
199+
<version>3.8.0</version>
200+
<configuration>
201+
<showWarnings>true</showWarnings>
202+
<fork>true</fork> <!-- Required for JDK16+ -->
203+
<compilerArgs combine.children="append">
204+
<!--arg>-Werror</arg--> <!-- Disabled (temporarily?) -->
205+
<arg>-Xlint:all</arg>
206+
<arg>-XDcompilePolicy=simple</arg>
207+
<arg>-Xplugin:ErrorProne</arg>
208+
<!-- Following are required on JDK16+ -->
209+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
210+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
211+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
212+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
213+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
214+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
215+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
216+
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
217+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
218+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
219+
</compilerArgs>
220+
<annotationProcessorPaths combine.children="append">
221+
<path>
222+
<groupId>com.google.errorprone</groupId>
223+
<artifactId>error_prone_core</artifactId>
224+
<version>${errorprone.version}</version>
225+
</path>
226+
</annotationProcessorPaths>
227+
</configuration>
228+
</plugin>
229+
</plugins>
230+
</build>
231+
</profile>
177232
</profiles>
178233

179234
<!-- http://central.sonatype.org/pages/requirements.html#developer-information -->

tensorflow-core/tensorflow-core-generator/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@
5959
</archive>
6060
</configuration>
6161
</plugin>
62-
<plugin>
63-
<groupId>org.apache.maven.plugins</groupId>
64-
<artifactId>maven-compiler-plugin</artifactId>
65-
<version>3.8.0</version>
66-
</plugin>
6762
</plugins>
6863
</build>
6964
</project>

0 commit comments

Comments
 (0)