Skip to content

Commit ceae489

Browse files
authored
Use spotless plugin for formating (#308)
1 parent 3648a96 commit ceae489

File tree

4 files changed

+75
-13
lines changed

4 files changed

+75
-13
lines changed

.mvn/jvm.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
2+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
4+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
5+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

license-header

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
=======================================================================
14+
*/

pom.xml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
2-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
33

44
<modelVersion>4.0.0</modelVersion>
55

@@ -44,6 +44,7 @@
4444
<maven.javadoc.skip>true</maven.javadoc.skip>
4545
<maven.source.skip>true</maven.source.skip>
4646
<gpg.skip>true</gpg.skip>
47+
<spotless.version>2.10.3</spotless.version>
4748
</properties>
4849

4950
<repositories>
@@ -102,19 +103,19 @@
102103
<artifactId>junit-jupiter-engine</artifactId>
103104
<version>${junit.version}</version>
104105
<scope>test</scope>
105-
</dependency>
106-
<dependency>
107-
<groupId>org.openjdk.jmh</groupId>
108-
<artifactId>jmh-core</artifactId>
109-
<version>${jmh.version}</version>
110-
<scope>test</scope>
111-
</dependency>
112-
<dependency>
113-
<groupId>org.openjdk.jmh</groupId>
114-
<artifactId>jmh-generator-annprocess</artifactId>
115-
<version>${jmh.version}</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>org.openjdk.jmh</groupId>
109+
<artifactId>jmh-core</artifactId>
110+
<version>${jmh.version}</version>
111+
<scope>test</scope>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.openjdk.jmh</groupId>
115+
<artifactId>jmh-generator-annprocess</artifactId>
116+
<version>${jmh.version}</version>
116117
<scope>test</scope>
117-
</dependency>
118+
</dependency>
118119
</dependencies>
119120
</dependencyManagement>
120121

@@ -299,6 +300,36 @@
299300
<updateMatchingVersions>true</updateMatchingVersions>
300301
</configuration>
301302
</plugin>
303+
<plugin>
304+
<groupId>com.diffplug.spotless</groupId>
305+
<artifactId>spotless-maven-plugin</artifactId>
306+
<version>${spotless.version}</version>
307+
<configuration>
308+
<ratchetFrom>origin/master</ratchetFrom>
309+
310+
<lineEndings/>
311+
<java>
312+
<googleJavaFormat/>
313+
314+
<removeUnusedImports/>
315+
316+
<licenseHeader>
317+
<file>./license-header</file>
318+
</licenseHeader>
319+
</java>
320+
</configuration>
321+
322+
<executions>
323+
<execution>
324+
<!-- Runs in initialize phase to fail fast in case of formatting issues (should be before codegen).-->
325+
<id>spotless-check</id>
326+
<phase>initialize</phase>
327+
<goals>
328+
<goal>check</goal>
329+
</goals>
330+
</execution>
331+
</executions>
332+
</plugin>
302333
</plugins>
303334
<pluginManagement>
304335
<plugins>

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@
5959
</archive>
6060
</configuration>
6161
</plugin>
62+
<plugin>
63+
<groupId>com.diffplug.spotless</groupId>
64+
<artifactId>spotless-maven-plugin</artifactId>
65+
<version>${spotless.version}</version>
66+
<configuration>
67+
<java>
68+
<excludes>
69+
<exclude>src/main/java/org/tensorflow/proto/framework/**</exclude>
70+
</excludes>
71+
</java>
72+
</configuration>
73+
</plugin>
6274
</plugins>
6375
</build>
6476
</project>

0 commit comments

Comments
 (0)