Skip to content

Commit

Permalink
Work-in-progress Java 11 compatible build for Emissary
Browse files Browse the repository at this point in the history
 - Updated formatter plugin version and maven workflow
 - Workflow now executes with various check profiles enabled
 - Updated .gitignore to ignore formatter cache
  • Loading branch information
drewfarris committed Aug 26, 2020
1 parent a08418e commit 96a4899
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Cache Maven Dependencies
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B package --file pom.xml
run: mvn -B package -Pcoverage,checkstyle,pmd,errorProne,dist --file pom.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ nbactions*.xml
.settings/
*.swp
*.checkstyle

# Formatter cache
.cache
80 changes: 48 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@
<dep.xmlbeans.version>2.6.0</dep.xmlbeans.version>
<eclipseFormatterStyle>${project.basedir}/contrib/formatter.xml</eclipseFormatterStyle>
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.javacErrorproneVersion>2.8.1</maven.javacErrorproneVersion>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.min-version>3.3.9</maven.min-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down Expand Up @@ -749,7 +748,7 @@
<version>[${maven.min-version},)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[1.8,)</version>
<version>[11,)</version>
</requireJavaVersion>
<dependencyConvergence />
</rules>
Expand Down Expand Up @@ -907,7 +906,7 @@
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.11.0</version>
<version>2.12.1</version>
<configuration>
<compilerCompliance>${maven.compiler.source}</compilerCompliance>
<compilerSource>${maven.compiler.source}</compilerSource>
Expand Down Expand Up @@ -1349,13 +1348,7 @@
</profile>
<profile>
<!-- Turn on the error-prone static analyzer during compilation.
NOTE this requires the use of a Java 8 compiler. For
example:
$ JAVA_HOME=/path/to/jdk1.8.0 mvn -PerrorProne clean test-compile
will analyze the main and test code, with the analyzer's
report given as compiler error/warning/note messages. -->
NOTE this requires the use of a Java 9+ compiler. -->
<id>errorProne</id>
<activation>
<property>
Expand All @@ -1367,44 +1360,60 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<!--<forceJavaCCompilerUse>true</forceJavaCCompilerUse>-->
<fork>true</fork>
<showWarnings>true</showWarnings>
<compilerArgs>
<!-- The compiler normally stops at 100 warnings, and
error-prone's static analysis warnings count
against that total. -->
<arg>-Xmaxwarns</arg>
<arg>5000</arg>
<arg>-XepDisableWarningsInGeneratedCode</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne
-Xep:Var:OFF
-Xep:ConstantField:WARN
-Xep:RemoveUnusedImports:WARN
-Xep:WildcardImport:WARN
-Xep:ArrayToString:WARN
-Xep:ComparisonOutOfRange:WARN
-Xep:DeadException:WARN
-Xep:DefaultCharset:OFF
-Xep:DepAnn:WARN
-Xep:FormatString:WARN
-Xep:LongLiteralLowerCaseSuffix:WARN
-Xep:MethodCanBeStatic:WARN
-Xep:MixedArrayDimensions:WARN
-Xep:MultiVariableDeclaration:WARN
-Xep:MultipleTopLevelClasses:WARN
-Xep:NumericEquality:WARN
-Xep:ParameterPackage:WARN
-Xep:PrivateConstructorForUtilityClass:WARN
-Xep:ThrowsUncheckedException:WARN
-Xep:TryFailThrowable:WARN</arg>
<!--<arg>-XepDisableWarningsInGeneratedCode</arg>-->
<!-- Enable experimental checks. -->
<arg>-XepAllDisabledChecksAsWarnings</arg>
<!--<arg>-XepAllDisabledChecksAsWarnings</arg>-->
<!-- Removed because it was not adding useful help -->
<arg>-Xep:ArgumentParameterMismatch:OFF</arg>
<!--<arg>-Xep:ArgumentParameterMismatch:OFF</arg>-->
<!-- This one is buggy and crashes the compiler. -->
<arg>-Xep:ArgumentParameterSwap:OFF</arg>
<!--<arg>-Xep:ArgumentParameterSwap:OFF</arg>-->
<!-- This one is super noisy, because it wants all
modifiable variables marked with @Var and
complains about the use of final everywhere else.
I'd be okay with adding the annotations, but
removing the finals is only safe if you can
guarantee you never use the compiler *without*
this add-on. -->
<arg>-Xep:Var:OFF</arg>
<!--<arg>-Xep:Var:OFF</arg>-->
<!-- By default this is considered a "suggestion" that
doesn't get counted as a warning. Change it to a
counted warning to make it easier to see how many
there are. -->
<arg>-Xep:ConstantField:WARN</arg>
<arg>-Xep:RemoveUnusedImports:WARN</arg>
<arg>-Xep:WildcardImport:WARN</arg>
<!--<arg>-Xep:ConstantField:WARN</arg>-->
<!--<arg>-Xep:RemoveUnusedImports:WARN</arg>-->
<!--<arg>-Xep:WildcardImport:WARN</arg>-->
<!-- By default these are set to errors. Change them
to warnings so that it doesn't stop the build
from continuing its analysis. -->
<arg>-Xep:ArrayToString:WARN</arg>
<arg>-Xep:ComparisonOutOfRange:WARN</arg>
<arg>-Xep:DeadException:WARN</arg>
<!--<arg>-Xep:ArrayToString:WARN</arg>-->
<!--<arg>-Xep:ComparisonOutOfRange:WARN</arg>-->
<!--<arg>-Xep:DeadException:WARN</arg>
<arg>-Xep:DefaultCharset:OFF</arg>
<arg>-Xep:DepAnn:WARN</arg>
<arg>-Xep:FormatString:WARN</arg>
Expand All @@ -1417,8 +1426,15 @@
<arg>-Xep:ParameterPackage:WARN</arg>
<arg>-Xep:PrivateConstructorForUtilityClass:WARN</arg>
<arg>-Xep:ThrowsUncheckedException:WARN</arg>
<arg>-Xep:TryFailThrowable:WARN</arg>
<arg>-Xep:TryFailThrowable:WARN</arg>-->
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.4.0</version>
</path>
</annotationProcessorPaths>
</configuration>
<dependencies>
<!-- override plexus-compiler-javac-errorprone's dependency on
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/emissary/scripting/RubyConsoleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import emissary.util.io.ResourceReader;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void testConsole() {
}
}

// @Test
@Ignore
// Reset is not working with JRuby 1.6.7,
public void testConsoleReset() throws Exception {
console.evalAndWait("$i=7*7", 50L);
Expand All @@ -91,7 +92,7 @@ public void testConsoleNoWait() {
}
}

// @Test
@Ignore
// Timeout is not working at least with sleep
public void testConsoleTimeout() {
try {
Expand Down

0 comments on commit 96a4899

Please sign in to comment.