Skip to content

Quick fix for spotless #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .mvn/jvm.config

This file was deleted.

14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ the `dev` profile in your Maven command to use those artifacts instead of buildi
Modifying the native op generation code (not the annotation processor) or the JavaCPP configuration (not the abstract Pointers) will require a
complete build could be required to reflect the changes, otherwise `-Pdev` should be fine.

## JDK 16+

If you're using JDK 16+, you need to add some exports for the formatter plugin:

```
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
```

This can be done in `.mvn/jvm.config` or `MAVEN_OPTS`.

### Native Builds

In some cases, like when adding GPU support or re-generating op classes, you will need to re-build the native library. 99% of this is building
Expand Down
41 changes: 29 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.source.skip>true</maven.source.skip>
<gpg.skip>true</gpg.skip>
<spotless.version>2.10.3</spotless.version>
<spotless.version>2.11.1</spotless.version>
</properties>

<repositories>
Expand Down Expand Up @@ -229,6 +229,33 @@
</plugins>
</build>
</profile>

<profile>
<id>format</id>
<activation>
<jdk>(,16)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>

<executions>
<execution>
<!-- Runs in initialize phase to fail fast in case of formatting issues (should be before codegen).-->
<id>spotless-check</id>
<phase>initialize</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<!-- http://central.sonatype.org/pages/requirements.html#developer-information -->
Expand Down Expand Up @@ -305,6 +332,7 @@
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless.version}</version>
<configuration>

<ratchetFrom>origin/master</ratchetFrom>

<lineEndings/>
Expand All @@ -318,17 +346,6 @@
</licenseHeader>
</java>
</configuration>

<executions>
<execution>
<!-- Runs in initialize phase to fail fast in case of formatting issues (should be before codegen).-->
<id>spotless-check</id>
<phase>initialize</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
Expand Down