From abbe7f25d5720696c72c8e7cc63f09cb2310fce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Tue, 16 Oct 2018 11:43:39 +0200 Subject: [PATCH 01/13] Improve log message in aggregated-java-sources (#456) Replace the summary "Upgrade from JFLEX-1.7.1-SNPASHOT.jar" by the initial commit message. --- scripts/deploy-source-code.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/deploy-source-code.sh b/scripts/deploy-source-code.sh index 7cfee0a7f..57db2a357 100755 --- a/scripts/deploy-source-code.sh +++ b/scripts/deploy-source-code.sh @@ -49,8 +49,8 @@ update_source() { # git commit fails if the commit is empty, which makes Travis build fail. git diff-index --quiet HEAD || \ git commit -a \ - -m "Update from $version" \ - -m "Initial $gitlog" + -m "Pseudo-Merge $gitlog" \ + -m "Updated from $version" cd .. } From 65c0194e075b0b17c094277a1eb6a59cec49a916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Tue, 16 Oct 2018 12:49:52 +0200 Subject: [PATCH 02/13] Move classes of maven plugins in jflex.maven.plugin (#458) * Move classes of jflex-unicode-maven-plugin in package jflex.maven.plugin.unicode * Move classes of jflex-maven-plugin in jflex.maven.plugin.jflex --- .../maven => jflex/maven/plugin/jflex}/ClassInfo.java | 2 +- .../maven => jflex/maven/plugin/jflex}/JFlexMojo.java | 2 +- .../maven/plugin/jflex}/LexSimpleAnalyzer.java | 2 +- .../maven/plugin/jflex}/ClassInfoTest.java | 2 +- .../maven/plugin/jflex}/JFlexMojoTest.java | 2 +- .../maven/plugin/jflex}/LexSimpleAnalyzerTest.java | 2 +- .../jflex/{ => maven/plugin/unicode}/DataFileType.java | 2 +- .../{ => maven/plugin/unicode}/DerivedAgeScanner.java | 2 +- .../{ => maven/plugin/unicode}/JFlexUnicodeMojo.java | 2 +- .../jflex/{ => maven/plugin/unicode}/NamedRange.java | 2 +- .../{ => maven/plugin/unicode}/NamedRangeSet.java | 2 +- .../plugin/unicode}/UnicodePropertiesSkeleton.java | 2 +- .../{ => maven/plugin/unicode}/UnicodeVersion.java | 2 +- .../src/main/jflex/ArchaicBlocksScanner.flex | 8 ++++---- .../src/main/jflex/ArchaicLineBreakScanner.flex | 2 +- .../src/main/jflex/ArchaicPropListScanner.flex | 8 ++++---- .../src/main/jflex/BinaryPropertiesFileScanner.flex | 8 ++++---- .../src/main/jflex/EnumeratedPropertyFileScanner.flex | 10 +++++----- .../src/main/jflex/PropertyAliasesScanner.flex | 2 +- .../src/main/jflex/PropertyValueAliasesScanner.flex | 2 +- .../src/main/jflex/ScriptExtensionsScanner.flex | 8 ++++---- .../src/main/jflex/UnicodeDataScanner.flex | 2 +- 22 files changed, 38 insertions(+), 38 deletions(-) rename jflex-maven-plugin/src/main/java/{de/jflex/plugin/maven => jflex/maven/plugin/jflex}/ClassInfo.java (98%) rename jflex-maven-plugin/src/main/java/{de/jflex/plugin/maven => jflex/maven/plugin/jflex}/JFlexMojo.java (99%) rename jflex-maven-plugin/src/main/java/{de/jflex/plugin/maven => jflex/maven/plugin/jflex}/LexSimpleAnalyzer.java (98%) rename jflex-maven-plugin/src/test/java/{de/jflex/plugin/maven => jflex/maven/plugin/jflex}/ClassInfoTest.java (97%) rename jflex-maven-plugin/src/test/java/{de/jflex/plugin/maven => jflex/maven/plugin/jflex}/JFlexMojoTest.java (99%) rename jflex-maven-plugin/src/test/java/{de/jflex/plugin/maven => jflex/maven/plugin/jflex}/LexSimpleAnalyzerTest.java (98%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/DataFileType.java (99%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/DerivedAgeScanner.java (99%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/JFlexUnicodeMojo.java (99%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/NamedRange.java (96%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/NamedRangeSet.java (98%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/UnicodePropertiesSkeleton.java (98%) rename jflex-unicode-maven-plugin/src/main/java/jflex/{ => maven/plugin/unicode}/UnicodeVersion.java (99%) diff --git a/jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/ClassInfo.java b/jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/ClassInfo.java similarity index 98% rename from jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/ClassInfo.java rename to jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/ClassInfo.java index 9aa1668ee..aa2d10eba 100644 --- a/jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/ClassInfo.java +++ b/jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/ClassInfo.java @@ -6,7 +6,7 @@ * License: BSD * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package de.jflex.plugin.maven; +package jflex.maven.plugin.jflex; import com.google.common.base.Strings; import java.io.File; diff --git a/jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/JFlexMojo.java b/jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/JFlexMojo.java similarity index 99% rename from jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/JFlexMojo.java rename to jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/JFlexMojo.java index c81418b61..5ba4fc9e4 100644 --- a/jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/JFlexMojo.java +++ b/jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/JFlexMojo.java @@ -6,7 +6,7 @@ * License: BSD * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package de.jflex.plugin.maven; +package jflex.maven.plugin.jflex; import static com.google.common.base.Strings.isNullOrEmpty; diff --git a/jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/LexSimpleAnalyzer.java b/jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/LexSimpleAnalyzer.java similarity index 98% rename from jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/LexSimpleAnalyzer.java rename to jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/LexSimpleAnalyzer.java index 9e44bf2d4..a9abd188c 100644 --- a/jflex-maven-plugin/src/main/java/de/jflex/plugin/maven/LexSimpleAnalyzer.java +++ b/jflex-maven-plugin/src/main/java/jflex/maven/plugin/jflex/LexSimpleAnalyzer.java @@ -7,7 +7,7 @@ * License: BSD * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package de.jflex.plugin.maven; +package jflex.maven.plugin.jflex; import com.google.common.io.Files; import java.io.File; diff --git a/jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/ClassInfoTest.java b/jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/ClassInfoTest.java similarity index 97% rename from jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/ClassInfoTest.java rename to jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/ClassInfoTest.java index 770e6f465..d57706e18 100644 --- a/jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/ClassInfoTest.java +++ b/jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/ClassInfoTest.java @@ -6,7 +6,7 @@ * License: BSD * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package de.jflex.plugin.maven; +package jflex.maven.plugin.jflex; import static com.google.common.truth.Truth.assertThat; diff --git a/jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/JFlexMojoTest.java b/jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/JFlexMojoTest.java similarity index 99% rename from jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/JFlexMojoTest.java rename to jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/JFlexMojoTest.java index 65a0b5b3e..1fc1db82d 100644 --- a/jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/JFlexMojoTest.java +++ b/jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/JFlexMojoTest.java @@ -6,7 +6,7 @@ * License: BSD * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package de.jflex.plugin.maven; +package jflex.maven.plugin.jflex; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; diff --git a/jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/LexSimpleAnalyzerTest.java b/jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerTest.java similarity index 98% rename from jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/LexSimpleAnalyzerTest.java rename to jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerTest.java index 561f2a669..cd884e208 100644 --- a/jflex-maven-plugin/src/test/java/de/jflex/plugin/maven/LexSimpleAnalyzerTest.java +++ b/jflex-maven-plugin/src/test/java/jflex/maven/plugin/jflex/LexSimpleAnalyzerTest.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.maven; +package jflex.maven.plugin.jflex; import static com.google.common.truth.Truth.assertThat; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/DataFileType.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/DataFileType.java similarity index 99% rename from jflex-unicode-maven-plugin/src/main/java/jflex/DataFileType.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/DataFileType.java index c44d7f550..aed30bc62 100644 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/DataFileType.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/DataFileType.java @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.io.IOException; import java.io.InputStreamReader; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/DerivedAgeScanner.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/DerivedAgeScanner.java similarity index 99% rename from jflex-unicode-maven-plugin/src/main/java/jflex/DerivedAgeScanner.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/DerivedAgeScanner.java index 60a0431da..2b669378f 100644 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/DerivedAgeScanner.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/DerivedAgeScanner.java @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.io.Reader; import java.util.Map.Entry; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/JFlexUnicodeMojo.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/JFlexUnicodeMojo.java similarity index 99% rename from jflex-unicode-maven-plugin/src/main/java/jflex/JFlexUnicodeMojo.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/JFlexUnicodeMojo.java index dd4df9bee..514569ec7 100755 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/JFlexUnicodeMojo.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/JFlexUnicodeMojo.java @@ -7,7 +7,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package jflex; +package jflex.maven.plugin.unicode; import java.io.File; import java.io.IOException; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/NamedRange.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/NamedRange.java similarity index 96% rename from jflex-unicode-maven-plugin/src/main/java/jflex/NamedRange.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/NamedRange.java index dea4f86be..420753011 100644 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/NamedRange.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/NamedRange.java @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.Objects; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/NamedRangeSet.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/NamedRangeSet.java similarity index 98% rename from jflex-unicode-maven-plugin/src/main/java/jflex/NamedRangeSet.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/NamedRangeSet.java index 3ab6e2ab8..964e07003 100644 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/NamedRangeSet.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/NamedRangeSet.java @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.ArrayList; import java.util.List; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/UnicodePropertiesSkeleton.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/UnicodePropertiesSkeleton.java similarity index 98% rename from jflex-unicode-maven-plugin/src/main/java/jflex/UnicodePropertiesSkeleton.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/UnicodePropertiesSkeleton.java index 937e44501..7cb17c26a 100644 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/UnicodePropertiesSkeleton.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/UnicodePropertiesSkeleton.java @@ -7,7 +7,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package jflex; +package jflex.maven.plugin.unicode; import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/jflex-unicode-maven-plugin/src/main/java/jflex/UnicodeVersion.java b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/UnicodeVersion.java similarity index 99% rename from jflex-unicode-maven-plugin/src/main/java/jflex/UnicodeVersion.java rename to jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/UnicodeVersion.java index c56dcbbd3..fef1cbabb 100644 --- a/jflex-unicode-maven-plugin/src/main/java/jflex/UnicodeVersion.java +++ b/jflex-unicode-maven-plugin/src/main/java/jflex/maven/plugin/unicode/UnicodeVersion.java @@ -8,7 +8,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -package jflex; +package jflex.maven.plugin.unicode; import java.io.File; import java.io.IOException; diff --git a/jflex-unicode-maven-plugin/src/main/jflex/ArchaicBlocksScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/ArchaicBlocksScanner.flex index a82ceb0c2..b81f4931d 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/ArchaicBlocksScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/ArchaicBlocksScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.SortedSet; import java.util.TreeSet; @@ -33,7 +33,7 @@ import java.util.TreeSet; String propertyName = "Block"; int start; int end; - + public void addPropertyValueIntervals() { int prevEnd = -1; int prevStart = -1; @@ -57,10 +57,10 @@ import java.util.TreeSet; // Add final default property value interval, if necessary if (prevEnd < unicodeVersion.maximumCodePoint) { - unicodeVersion.addInterval(propertyName, defaultPropertyValue, + unicodeVersion.addInterval(propertyName, defaultPropertyValue, prevEnd + 1, unicodeVersion.maximumCodePoint); } - + // Add final named interval unicodeVersion.addInterval(propertyName, prevValue, prevStart, prevEnd); } diff --git a/jflex-unicode-maven-plugin/src/main/jflex/ArchaicLineBreakScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/ArchaicLineBreakScanner.flex index ff1e27707..ab937d451 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/ArchaicLineBreakScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/ArchaicLineBreakScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.SortedSet; import java.util.TreeSet; diff --git a/jflex-unicode-maven-plugin/src/main/jflex/ArchaicPropListScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/ArchaicPropListScanner.flex index 187af2483..b402dd278 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/ArchaicPropListScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/ArchaicPropListScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.SortedSet; import java.util.TreeSet; @@ -32,12 +32,12 @@ import java.util.Map; %{ UnicodeVersion unicodeVersion; - Map> properties + Map> properties = new HashMap>(); String propertyName; int start; int end; - + public void addPropertyIntervals() { for (Map.Entry> property : properties.entrySet()) { String currentPropertyName = property.getKey(); @@ -57,7 +57,7 @@ import java.util.Map; unicodeVersion.addInterval(currentPropertyName, prevStart, prevEnd); } } - + public void addCurrentInterval() { SortedSet intervals = properties.get(propertyName); if (null == intervals) { diff --git a/jflex-unicode-maven-plugin/src/main/jflex/BinaryPropertiesFileScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/BinaryPropertiesFileScanner.flex index a9a59c1dd..3abf06914 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/BinaryPropertiesFileScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/BinaryPropertiesFileScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.SortedSet; import java.util.TreeSet; @@ -26,12 +26,12 @@ import java.util.Map; %{ UnicodeVersion unicodeVersion; - Map> properties + Map> properties = new HashMap>(); String propertyName; int start; int end; - + public void addPropertyIntervals() { for (Map.Entry> property : properties.entrySet()) { String currentPropertyName = property.getKey(); @@ -51,7 +51,7 @@ import java.util.Map; unicodeVersion.addInterval(currentPropertyName, prevStart, prevEnd); } } - + public void addCurrentInterval() { SortedSet intervals = properties.get(propertyName); if (null == intervals) { diff --git a/jflex-unicode-maven-plugin/src/main/jflex/EnumeratedPropertyFileScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/EnumeratedPropertyFileScanner.flex index bd107fa50..2b5912c4c 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/EnumeratedPropertyFileScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/EnumeratedPropertyFileScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.SortedSet; import java.util.TreeSet; @@ -32,7 +32,7 @@ import java.util.TreeSet; String propertyName; int start; int end; - + public void addPropertyValueIntervals() { int prevEnd = -1; int prevStart = -1; @@ -56,14 +56,14 @@ import java.util.TreeSet; // Add final default property value interval, if necessary if (prevEnd < unicodeVersion.maximumCodePoint) { - unicodeVersion.addInterval(propertyName, defaultPropertyValue, + unicodeVersion.addInterval(propertyName, defaultPropertyValue, prevEnd + 1, unicodeVersion.maximumCodePoint); } - + // Add final named interval unicodeVersion.addInterval(propertyName, prevValue, prevStart, prevEnd); } - + protected boolean accept(String propertyValue) { return true; } diff --git a/jflex-unicode-maven-plugin/src/main/jflex/PropertyAliasesScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/PropertyAliasesScanner.flex index fd174cec0..62737fedf 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/PropertyAliasesScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/PropertyAliasesScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.HashSet; import java.util.Set; diff --git a/jflex-unicode-maven-plugin/src/main/jflex/PropertyValueAliasesScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/PropertyValueAliasesScanner.flex index d5e0b0289..948fcb507 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/PropertyValueAliasesScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/PropertyValueAliasesScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.HashSet; import java.util.Set; diff --git a/jflex-unicode-maven-plugin/src/main/jflex/ScriptExtensionsScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/ScriptExtensionsScanner.flex index 393bb80dc..aa09159df 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/ScriptExtensionsScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/ScriptExtensionsScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; import java.util.HashMap; import java.util.HashSet; @@ -34,11 +34,11 @@ import java.util.SortedMap; private int end; private UnicodeVersion unicodeVersion; private String propertyName; - private Map scriptIntervals + private Map scriptIntervals = new HashMap(); private boolean[] scriptExtensionsCodePoint; private Set scripts = new HashSet(); - + private void addPropertyValueIntervals() { // Add script property value for missing code points for (String script : scripts) { @@ -47,7 +47,7 @@ import java.util.SortedMap; intervals = new NamedRangeSet(); scriptIntervals.put(script, intervals); } - for (NamedRange range + for (NamedRange range : unicodeVersion.propertyValueIntervals.get(script).getRanges()) { for (int ch = range.start ; ch <= range.end ; ++ch) { if ( ! scriptExtensionsCodePoint[ch]) { diff --git a/jflex-unicode-maven-plugin/src/main/jflex/UnicodeDataScanner.flex b/jflex-unicode-maven-plugin/src/main/jflex/UnicodeDataScanner.flex index 4e8534881..e96d80549 100644 --- a/jflex-unicode-maven-plugin/src/main/jflex/UnicodeDataScanner.flex +++ b/jflex-unicode-maven-plugin/src/main/jflex/UnicodeDataScanner.flex @@ -1,4 +1,4 @@ -package jflex; +package jflex.maven.plugin.unicode; /** * From d505bb9d4eb0d02eff477f05bda962afda5f40fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Tue, 16 Oct 2018 22:27:09 +0200 Subject: [PATCH 03/13] Move classes from jflex-testsuite-... and cup-maven-plugin in package jflex.maven (#460) Follow-up of #458 * Move classes from jflex-testsuite-maven-plugin in package jflex.maven.plugin.testsuite; * Move cup-maven-plugin in jflex.maven.plugin.cup --- .../jflex => jflex/maven}/plugin/cup/CliCupInvoker.java | 2 +- .../{de/jflex => jflex/maven}/plugin/cup/GenerateMojo.java | 2 +- .../{de/jflex => jflex/maven}/plugin/cup/JavaUtils.java | 2 +- .../java/{de/jflex => jflex/maven}/plugin/cup/Logger.java | 2 +- .../maven}/plugin/cup/CliCupInvokerTest.java | 4 ++-- .../maven}/plugin/cup/GenerateMojoIntegrationTest.java | 7 +++++-- .../jflex => jflex/maven}/plugin/cup/GenerateMojoTest.java | 4 ++-- .../maven/plugin/testsuite}/CustomClassLoader.java | 2 +- .../maven/plugin/testsuite}/DiffStream.java | 2 +- .../{jflextest => jflex/maven/plugin/testsuite}/Exec.java | 2 +- .../maven/plugin/testsuite}/InputOutput.java | 2 +- .../maven/plugin/testsuite}/JFlexTestsuiteMojo.java | 2 +- .../maven/plugin/testsuite}/LoadException.java | 2 +- .../maven/plugin/testsuite}/PomUtils.java | 2 +- .../maven/plugin/testsuite}/TestCase.java | 2 +- .../maven/plugin/testsuite}/TestFailException.java | 2 +- .../maven/plugin/testsuite}/TestResult.java | 2 +- .../maven/plugin/testsuite}/Tester.java | 2 +- .../src/main/jflex/TestLoader.flex | 2 +- 19 files changed, 25 insertions(+), 22 deletions(-) rename cup-maven-plugin/src/main/java/{de/jflex => jflex/maven}/plugin/cup/CliCupInvoker.java (99%) rename cup-maven-plugin/src/main/java/{de/jflex => jflex/maven}/plugin/cup/GenerateMojo.java (99%) rename cup-maven-plugin/src/main/java/{de/jflex => jflex/maven}/plugin/cup/JavaUtils.java (97%) rename cup-maven-plugin/src/main/java/{de/jflex => jflex/maven}/plugin/cup/Logger.java (92%) rename cup-maven-plugin/src/test/java/{de/jflex => jflex/maven}/plugin/cup/CliCupInvokerTest.java (90%) rename cup-maven-plugin/src/test/java/{de/jflex => jflex/maven}/plugin/cup/GenerateMojoIntegrationTest.java (92%) rename cup-maven-plugin/src/test/java/{de/jflex => jflex/maven}/plugin/cup/GenerateMojoTest.java (97%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/CustomClassLoader.java (99%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/DiffStream.java (98%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/Exec.java (99%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/InputOutput.java (91%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/JFlexTestsuiteMojo.java (98%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/LoadException.java (75%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/PomUtils.java (97%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/TestCase.java (99%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/TestFailException.java (87%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/TestResult.java (94%) rename testsuite/jflex-testsuite-maven-plugin/src/main/java/{jflextest => jflex/maven/plugin/testsuite}/Tester.java (98%) diff --git a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/CliCupInvoker.java b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/CliCupInvoker.java similarity index 99% rename from cup-maven-plugin/src/main/java/de/jflex/plugin/cup/CliCupInvoker.java rename to cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/CliCupInvoker.java index 126f34797..02fb329fb 100644 --- a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/CliCupInvoker.java +++ b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/CliCupInvoker.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import static com.google.common.base.Preconditions.checkArgument; diff --git a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/GenerateMojo.java b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/GenerateMojo.java similarity index 99% rename from cup-maven-plugin/src/main/java/de/jflex/plugin/cup/GenerateMojo.java rename to cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/GenerateMojo.java index d885223a8..ef1093354 100644 --- a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/GenerateMojo.java +++ b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/GenerateMojo.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Optional; diff --git a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/JavaUtils.java b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/JavaUtils.java similarity index 97% rename from cup-maven-plugin/src/main/java/de/jflex/plugin/cup/JavaUtils.java rename to cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/JavaUtils.java index 375719c07..84d4d2640 100644 --- a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/JavaUtils.java +++ b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/JavaUtils.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import com.google.common.base.Strings; import java.io.File; diff --git a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/Logger.java b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/Logger.java similarity index 92% rename from cup-maven-plugin/src/main/java/de/jflex/plugin/cup/Logger.java rename to cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/Logger.java index 593f03c33..a92ceb9fa 100644 --- a/cup-maven-plugin/src/main/java/de/jflex/plugin/cup/Logger.java +++ b/cup-maven-plugin/src/main/java/jflex/maven/plugin/cup/Logger.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import org.apache.maven.plugin.logging.Log; diff --git a/cup-maven-plugin/src/test/java/de/jflex/plugin/cup/CliCupInvokerTest.java b/cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/CliCupInvokerTest.java similarity index 90% rename from cup-maven-plugin/src/test/java/de/jflex/plugin/cup/CliCupInvokerTest.java rename to cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/CliCupInvokerTest.java index cc0594580..01c9e95be 100644 --- a/cup-maven-plugin/src/test/java/de/jflex/plugin/cup/CliCupInvokerTest.java +++ b/cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/CliCupInvokerTest.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import static com.google.common.truth.Truth.assertThat; @@ -6,7 +6,7 @@ import java.io.File; import org.junit.Test; -/** Test for {@link CliCupInvoker}. */ +/** Test for {@link jflex.maven.plugin.cup.CliCupInvoker}. */ public class CliCupInvokerTest { @Test diff --git a/cup-maven-plugin/src/test/java/de/jflex/plugin/cup/GenerateMojoIntegrationTest.java b/cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/GenerateMojoIntegrationTest.java similarity index 92% rename from cup-maven-plugin/src/test/java/de/jflex/plugin/cup/GenerateMojoIntegrationTest.java rename to cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/GenerateMojoIntegrationTest.java index fed50a978..3ed7d19d9 100644 --- a/cup-maven-plugin/src/test/java/de/jflex/plugin/cup/GenerateMojoIntegrationTest.java +++ b/cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/GenerateMojoIntegrationTest.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; @@ -9,7 +9,10 @@ import org.junit.Rule; import org.junit.Test; -/** Integration test for {@link GenerateMojo} on {@code /jflex/cup/sample-project/pom.xml}. */ +/** + * Integration test for {@link jflex.maven.plugin.cup.GenerateMojo} on {@code + * /jflex/cup/sample-project/pom.xml}. + */ public class GenerateMojoIntegrationTest { private MavenProject mavenTestProject; diff --git a/cup-maven-plugin/src/test/java/de/jflex/plugin/cup/GenerateMojoTest.java b/cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/GenerateMojoTest.java similarity index 97% rename from cup-maven-plugin/src/test/java/de/jflex/plugin/cup/GenerateMojoTest.java rename to cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/GenerateMojoTest.java index 40de78530..a8dedd24c 100644 --- a/cup-maven-plugin/src/test/java/de/jflex/plugin/cup/GenerateMojoTest.java +++ b/cup-maven-plugin/src/test/java/jflex/maven/plugin/cup/GenerateMojoTest.java @@ -1,4 +1,4 @@ -package de.jflex.plugin.cup; +package jflex.maven.plugin.cup; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.endsWith; @@ -17,7 +17,7 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -/** Tests for {@link GenerateMojo}. */ +/** Tests for {@link jflex.maven.plugin.cup.GenerateMojo}. */ public class GenerateMojoTest { private GenerateMojo mojo; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/CustomClassLoader.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/CustomClassLoader.java similarity index 99% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/CustomClassLoader.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/CustomClassLoader.java index 1cfffc93a..f516020c2 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/CustomClassLoader.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/CustomClassLoader.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import java.io.ByteArrayOutputStream; import java.io.File; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/DiffStream.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/DiffStream.java similarity index 98% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/DiffStream.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/DiffStream.java index 0f7432d04..83f83df2d 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/DiffStream.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/DiffStream.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import java.io.BufferedReader; import java.io.IOException; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/Exec.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/Exec.java similarity index 99% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/Exec.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/Exec.java index 7429c4db5..7757c7cca 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/Exec.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/Exec.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import com.google.common.base.Joiner; import java.io.ByteArrayOutputStream; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/InputOutput.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/InputOutput.java similarity index 91% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/InputOutput.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/InputOutput.java index a90ce5b9c..3fbe43d10 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/InputOutput.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/InputOutput.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; class InputOutput { diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/JFlexTestsuiteMojo.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/JFlexTestsuiteMojo.java similarity index 98% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/JFlexTestsuiteMojo.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/JFlexTestsuiteMojo.java index 94926ad54..dd8cfb979 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/JFlexTestsuiteMojo.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/JFlexTestsuiteMojo.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import java.io.File; import java.io.FileNotFoundException; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/LoadException.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/LoadException.java similarity index 75% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/LoadException.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/LoadException.java index b7fa93bb6..c78e58c0d 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/LoadException.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/LoadException.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; public class LoadException extends Exception { diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/PomUtils.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/PomUtils.java similarity index 97% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/PomUtils.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/PomUtils.java index a72bfa508..7612607a1 100644 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/PomUtils.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/PomUtils.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import java.io.File; import java.io.FileNotFoundException; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestCase.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestCase.java similarity index 99% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestCase.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestCase.java index bff991aff..9b8d4fc79 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestCase.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestCase.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import com.google.common.collect.ImmutableList; import java.io.File; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestFailException.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestFailException.java similarity index 87% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestFailException.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestFailException.java index 799e23eff..264d0de3f 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestFailException.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestFailException.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; public class TestFailException extends Exception { diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestResult.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestResult.java similarity index 94% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestResult.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestResult.java index b70c7bdb8..e6bbed5af 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/TestResult.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/TestResult.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; /** * Stores the result (for now: output + success status) of a test run of one single program (jflex, diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/Tester.java b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/Tester.java similarity index 98% rename from testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/Tester.java rename to testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/Tester.java index d3d2cf38b..4e22e48ae 100755 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflextest/Tester.java +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/java/jflex/maven/plugin/testsuite/Tester.java @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import java.io.File; import java.io.FileReader; diff --git a/testsuite/jflex-testsuite-maven-plugin/src/main/jflex/TestLoader.flex b/testsuite/jflex-testsuite-maven-plugin/src/main/jflex/TestLoader.flex index 0d89dfdae..4a08bfee0 100644 --- a/testsuite/jflex-testsuite-maven-plugin/src/main/jflex/TestLoader.flex +++ b/testsuite/jflex-testsuite-maven-plugin/src/main/jflex/TestLoader.flex @@ -1,4 +1,4 @@ -package jflextest; +package jflex.maven.plugin.testsuite; import java.util.*; import jflex.sym; From 68ddb1506c52a2c27304e97a3b5a76abf5ec4694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 00:07:19 +0200 Subject: [PATCH 04/13] Update script aggregated sources (#461) * deploy-script.sh doesn't deploy anymore ; only prepares repo - The deploy phase is too late on Travis ; restrict it to "git push" - Everything else (building the aggregated-sources jar, compiling, and updating the repo) is done in prepare-java-sources.sh * Remove all plugins ./jflex/maven/plugin Thanks to #458 and #460 * Remove wrong import on import jflextest.TestLoader; * Set the remote push url in the deploy phase ; the github token isn't available before --- .travis.yml | 9 +++- ...ode.sh => preparare-deploy-source-code.sh} | 46 ++++++++++--------- 2 files changed, 32 insertions(+), 23 deletions(-) rename scripts/{deploy-source-code.sh => preparare-deploy-source-code.sh} (68%) diff --git a/.travis.yml b/.travis.yml index b18cbb064..af17430ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ matrix: - scripts/test-unit.sh - scripts/mvn-site.sh - scripts/mvn-aggregate-srcs.sh + - scripts/preparare-deploy-source-code.sh after_success: scripts/send-code-coverage.sh env: - PUBLISH_SOURCES=true @@ -133,4 +134,10 @@ deploy: - travis condition: - $PUBLISH_SOURCES - script: ./scripts/deploy-source-code.sh + script: + - echo "Push to https://github.com/jflex-de/jflex/tree/aggregated-java-sources" + # SECURITY NOTICE: Be sure to send stdout & stderr to /dev/null so that the the ${GITHUB_TOKEN} is never revealed + - cd repo + - git remote set-url --push origin "https://${GITHUB_TOKEN}@github.com/jflex-de/jflex.git" repo > /dev/null 2>&1 + - git push + diff --git a/scripts/deploy-source-code.sh b/scripts/preparare-deploy-source-code.sh similarity index 68% rename from scripts/deploy-source-code.sh rename to scripts/preparare-deploy-source-code.sh index 57db2a357..3ba63f050 100755 --- a/scripts/deploy-source-code.sh +++ b/scripts/preparare-deploy-source-code.sh @@ -1,5 +1,7 @@ #!/bin/bash -# Push aggregated source code back to git +# Prepare the aggregated source code in the 'repo' directory that is cloned from +# branch [aggregated-java-sources]. + # This is inspired by https://martinrotter.github.io/it-programming/2016/08/26/pushing-git-travis/ CWD="$PWD" @@ -10,13 +12,17 @@ source "$BASEDIR"/scripts/logger.sh set -e git_clone() { + if [[ -d repo ]]; then + backup=$(mktemp -d) + logi "Move existing repo to $backup" + mv repo $backup + fi if [[ -z "$CI" ]]; then logi "Cloning ssh://git@github.com:jflex-de/jflex.git (aggregated-java-sources)" - git clone --depth 1 --branch aggregated-java-sources "git@github.com:jflex-de/jflex.git" repo > /dev/null 2>&1 + git clone --depth 1 --branch aggregated-java-sources "git@github.com:jflex-de/jflex.git" else - logi "Cloning https://[GITHUB_TOKEN]@github.com/jflex-de/jflex/tree/aggregated-java-sources" - # SECURITY NOTICE: Be sure to send stdout & stderr to /dev/null so that the the ${GITHUB_TOKEN} is never revealed - git clone --depth 1 --branch aggregated-java-sources "https://${GITHUB_TOKEN}@github.com/jflex-de/jflex.git" repo > /dev/null 2>&1 + logi "Cloning https://github.com/jflex-de/jflex/tree/aggregated-java-sources" + git clone --depth 1 --branch aggregated-java-sources "https://github.com/jflex-de/jflex.git" repo fi } @@ -29,16 +35,22 @@ update_source() { cd repo git config user.name "Travis CI" git config user.email "deploy@travis-ci.org" - git rm -r META-INF jflex java_cup UnicodeProperties.java.skeleton - jar -xf ../target/jflex-*-sources.jar + git rm -r java + mkdir -p java + cd java + jar -xf ../../target/jflex-*-sources.jar logi "Remove unrelated sources" - logi "Download deps and Compile" - ./compile.sh + rm -rf jflex/maven logi "Checking licenses" - [[ -f LICENSE_CUP ]] || loge "Missing LICENSE_CUP for CUP" - [[ -f LICENSE_JFLEX ]] || loge "Missing LICENSE_JFLEX for JFlex" - [[ $(head -1 LICENSE_JFLEX | cut -f 1 -d " ") == "JFlex" ]] || loge "JFlex license has bad content" + [[ $(head -1 LICENSE_JFLEX | cut -f 1 -d " ") == "JFlex" ]] || \ + loge "JFlex license has bad content" && cat LICENSE_JFLEX + mv LICENSE_JFLEX .. + mv LICENSE_CUP .. + cd .. + + logi "Download deps and Compile" + ./compile.sh logi "Update git sources" git add --all @@ -54,14 +66,6 @@ update_source() { cd .. } -git_push() { - cd repo - logi "Push to https://github.com/jflex-de/jflex/tree/aggregated-java-sources" - git log -1 - git push - cd .. -} - # N.B. TRAVIS_BRANCH is the name of the branch targeted by the pull request (if PR) logi "On branch ${TRAVIS_PULL_REQUEST_SLUG}:${TRAVIS_PULL_REQUEST_BRANCH} → ${TRAVIS_BRANCH}" @@ -74,8 +78,6 @@ if [[ -z "$CI" ]]; then logi "git log -1" logi "git diff HEAD^1" logi "# git push" -else - git_push fi cd "$CWD" From ac464bd017f7c0bc2b75f78aeec59a390574df89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 00:08:34 +0200 Subject: [PATCH 05/13] Update README for third_party (#459) Explain how to add a dep --- third_party/README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/third_party/README.md b/third_party/README.md index d4e3f63b3..ba168a917 100644 --- a/third_party/README.md +++ b/third_party/README.md @@ -1,9 +1,18 @@ # Bazel third-party packages -This is *not* an example. -It contains BUILD aliases for the [Bazel build system][bazel]. +Contains BUILD aliases for the [Bazel build system][bazel]. To read how to use JFlex on your Bazel project, please read -[de/jflex/README.md](de/jflex/README.md) +[jflex/README.md](/README.md) + +## Add a new dependency + +Contributors who want to add a new dependency need to + +1. Add the `maven_jar` rule in `deps.bzl` +2. Create a directory in `third_party` that matches the artifact groupId. +3. Add a BUILD file in that directory + - The build must have a `license()` declaration. + - The build target must declare all its dependencies. [bazel]: https://bazel.build/ From 95389b96433fb7d7b8a7542f7525ab9b98d4a0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 01:15:21 +0200 Subject: [PATCH 06/13] Fix Travis the script deployer only accepts scripts --- .travis.yml | 7 +------ scripts/deploy-aggregated-sources.sh | 5 +++++ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100755 scripts/deploy-aggregated-sources.sh diff --git a/.travis.yml b/.travis.yml index af17430ef..7095ef71d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -134,10 +134,5 @@ deploy: - travis condition: - $PUBLISH_SOURCES - script: - - echo "Push to https://github.com/jflex-de/jflex/tree/aggregated-java-sources" - # SECURITY NOTICE: Be sure to send stdout & stderr to /dev/null so that the the ${GITHUB_TOKEN} is never revealed - - cd repo - - git remote set-url --push origin "https://${GITHUB_TOKEN}@github.com/jflex-de/jflex.git" repo > /dev/null 2>&1 - - git push + script: scripts/deploy-aggregated-sources.sh diff --git a/scripts/deploy-aggregated-sources.sh b/scripts/deploy-aggregated-sources.sh new file mode 100755 index 000000000..8bc199a69 --- /dev/null +++ b/scripts/deploy-aggregated-sources.sh @@ -0,0 +1,5 @@ +echo "Push to https://github.com/jflex-de/jflex/tree/aggregated-java-sources" +cd repo +# SECURITY NOTICE: Be sure to send stdout & stderr to /dev/null so that the the ${GITHUB_TOKEN} is$ +git remote set-url --push origin "https://${GITHUB_TOKEN}@github.com/jflex-de/jflex.git" repo > $ +git push From 9ebebabaec5675a17a4f50723106ff0a3b72952a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 09:45:59 +0200 Subject: [PATCH 07/13] Fix git remote set-utl in deploy script --- scripts/deploy-aggregated-sources.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/deploy-aggregated-sources.sh b/scripts/deploy-aggregated-sources.sh index 8bc199a69..48429d8d0 100755 --- a/scripts/deploy-aggregated-sources.sh +++ b/scripts/deploy-aggregated-sources.sh @@ -1,5 +1,5 @@ echo "Push to https://github.com/jflex-de/jflex/tree/aggregated-java-sources" cd repo # SECURITY NOTICE: Be sure to send stdout & stderr to /dev/null so that the the ${GITHUB_TOKEN} is$ -git remote set-url --push origin "https://${GITHUB_TOKEN}@github.com/jflex-de/jflex.git" repo > $ +git remote set-url --push origin "https://${GITHUB_TOKEN}@github.com/jflex-de/jflex.git" > /dev/null git push From df136407f6b6c248158236e102d0af68b0bb8f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 11:37:36 +0200 Subject: [PATCH 08/13] Add Cirrus-CI integration (#464) * Add Cirrus-CI integration https://cirrus-ci.com/github/jflex-de/jflex * Build script is trivial ``` bazel info bazel build //... bazel test //... ``` * Use free Cirrus Bazel remote cache * Use git_repostiry tag=v2 rather than branch Cirrus-CI seems to have an old version of Bazel which doesn't support `branch` attribute in `git_repository`. This is actually a good thing. A tag gives /jflex control, whereas a branch gives /bazel_rules control --- .travis.bazelrc => .ci.bazelrc | 0 .cirrus.yml | 12 ++++++++++++ WORKSPACE | 2 +- scripts/bazel.sh | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) rename .travis.bazelrc => .ci.bazelrc (100%) create mode 100644 .cirrus.yml diff --git a/.travis.bazelrc b/.ci.bazelrc similarity index 100% rename from .travis.bazelrc rename to .ci.bazelrc diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 000000000..310dea576 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,12 @@ +# Copyright 2018 Google LLC. +# SPDX-License-Identifier: Apache-2.0 + +container: + image: cirrusci/bazel:latest +task: + name: Bazel build and test + build_script: + - bazel --bazelrc=.ci.bazelrc info --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST release + - bazel --bazelrc=.ci.bazelrc build --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST //... + test_script: + - bazel --bazelrc=.ci.bazelrc test --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST //... diff --git a/WORKSPACE b/WORKSPACE index 346fc68fe..e7d89e9e9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -6,7 +6,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "jflex_rules", - branch = "stable", + tag = "v2", remote = "https://github.com/jflex-de/bazel_rules.git", ) diff --git a/scripts/bazel.sh b/scripts/bazel.sh index eeade1798..cdcdeecc9 100755 --- a/scripts/bazel.sh +++ b/scripts/bazel.sh @@ -9,7 +9,7 @@ source "$BASEDIR"/scripts/logger.sh set -e if [[ $TRAVIS ]]; then - BAZEL="bazel --bazelrc=$TRAVIS_BUILD_DIR/.travis.bazelrc --output_user_root=${HOME}/__bazel_travis_root__ --output_base=${HOME}/__bazel_output_base__" + BAZEL="bazel --bazelrc=$TRAVIS_BUILD_DIR/.ci.bazelrc --output_user_root=${HOME}/__bazel_travis_root__ --output_base=${HOME}/__bazel_output_base__" else BAZEL='bazel' fi From 9c9d0497538e4f82383b702e24eb72ba1004e711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 11:44:44 +0200 Subject: [PATCH 09/13] Move testsuite/manual-ex to examples (#452) * Add example from the user manual. https://stackoverflow.com/questions/52573382/jflex-cup-error-cannot-find-symbol-return-symbolsym-eqeq clains that it fails with ``` cannot find symbol { return new java_cup.runtime.Symbol(sym.EOF); } ^ symbol: variable sym location: class Lexer ``` * So add a cup parser * rename example to _minijava_ TODO: Make the mini java useful. --- docs/md/example.md | 32 +++-- jflex/examples/cup-java-minijava/BUILD | 51 ++++++++ jflex/examples/cup-java-minijava/README.md | 32 +++++ .../src/main/cup/minijava.cup | 67 ++++++++++ .../src/main/jflex/minijava.flex | 9 +- .../jflex/examples/minijava/LexerTest.java | 70 +++++++++++ .../src/test/cases/manual-ex/.gitignore | 1 - .../test/cases/manual-ex/manual-flex.output | 11 -- .../src/test/cases/manual-ex/manual.test | 7 -- .../src/test/cases/manual-ex/sym.java | 114 ------------------ 10 files changed, 247 insertions(+), 147 deletions(-) create mode 100644 jflex/examples/cup-java-minijava/BUILD create mode 100644 jflex/examples/cup-java-minijava/README.md create mode 100644 jflex/examples/cup-java-minijava/src/main/cup/minijava.cup rename testsuite/testcases/src/test/cases/manual-ex/manual.flex => jflex/examples/cup-java-minijava/src/main/jflex/minijava.flex (92%) create mode 100644 jflex/examples/cup-java-minijava/src/test/java/jflex/examples/minijava/LexerTest.java delete mode 100644 testsuite/testcases/src/test/cases/manual-ex/.gitignore delete mode 100644 testsuite/testcases/src/test/cases/manual-ex/manual-flex.output delete mode 100644 testsuite/testcases/src/test/cases/manual-ex/manual.test delete mode 100644 testsuite/testcases/src/test/cases/manual-ex/sym.java diff --git a/docs/md/example.md b/docs/md/example.md index 183febd4d..fc98e0064 100644 --- a/docs/md/example.md +++ b/docs/md/example.md @@ -2,23 +2,31 @@ A simple Example: How to work with JFlex {#Example} ======================================== To demonstrate how a lexical specification with JFlex looks like, this -section presents a part of the specification for the Java language. The -example does not describe the whole lexical structure of Java programs, -but only a small and simplified part of it (some keywords, some -operators, comments and only two kinds of literals). It also shows how -to interface with the LALR parser generator CUP [@CUP] and therefore uses -a class `sym` (generated by CUP), where integer constants for the -terminal tokens of the CUP grammar are declared. JFlex comes with a -directory `examples`, where you can find a small standalone scanner that -doesn’t need other tools like CUP to give you working example code without -dependencies. - -The `examples` directory also contains a *complete* JFlex specification of the +section presents a part of the specification for the Java language. + +The example does not describe the whole lexical structure of Java programs, +but only a small and simplified part of it: +- some keywords, +- some operators, +- comments +- and only two kinds of literals. + +It also shows how to interface with the LALR parser generator CUP [@CUP] +and therefore uses a class `sym` (generated by CUP), where integer constants +for the terminal tokens of the CUP grammar are declared. + +You can find this example in `examples/cup-java-simplified`. + +The `examples/cup-java` directory also contains a *complete* JFlex specification of the lexical structure of Java programs together with the CUP parser specification for Java by C. Scott Ananian, obtained from the CUP [@CUP] web site (modified to interface with the JFlex scanner). Both specifications adhere to the Java Language Specification [@LangSpec]. +In `examples/standalone`, you can find a small standalone scanner that +doesn’t need other dependencies or tools like CUP to give you working code. + + ``` /* JFlex example: partial Java language lexer specification */ import java_cup.runtime.*; diff --git a/jflex/examples/cup-java-minijava/BUILD b/jflex/examples/cup-java-minijava/BUILD new file mode 100644 index 000000000..0812fc081 --- /dev/null +++ b/jflex/examples/cup-java-minijava/BUILD @@ -0,0 +1,51 @@ +package(default_visibility = ["//visibility:public"]) + +load("@jflex_rules//jflex:jflex.bzl", "jflex") +load("//cup:cup.bzl", "cup") + +# The best practice is to define the rules in their respective directory in +# - src/main/java/org/example/foo/BUILD +# - src/main/jflex/BUILD +# - src/test/java/org/example/foo/BUILD +# - etc. +# However, this example is simple enough and we can define all rules here. + +java_binary( + name = "minijava_bin", + main_class = "Yylex", + runtime_deps = [":minijava"], +) + +java_library( + name = "minijava", + # glob is not a best practice, but it's good enough for this example + srcs = glob(["src/main/java/**/*.java"]) + [ + ":gen_lexer", + ":gen_parser", + ], + deps = ["//cup:cup_runtime"], +) + +jflex( + name = "gen_lexer", + srcs = ["src/main/jflex/minijava.flex"], + jflex_bin = "//jflex:jflex_bin", + outputs = ["Lexer.java"], +) + +cup( + name = "gen_parser", + src = "src/main/cup/minijava.cup", + symbols = "sym", +) + +# Tests +java_test( + name = "LexerTest", + srcs = ["src/test/java/jflex/examples/minijava/LexerTest.java"], + deps = [ + ":minijava", + "//cup/cup_runtime", + "//third_party/com/google/truth", + ], +) diff --git a/jflex/examples/cup-java-minijava/README.md b/jflex/examples/cup-java-minijava/README.md new file mode 100644 index 000000000..8f651495e --- /dev/null +++ b/jflex/examples/cup-java-minijava/README.md @@ -0,0 +1,32 @@ +# Example from the user manual + +This is the [example from the user manual](http://jflex.de/manual.html#Example). + +This example does not describe the whole lexical structure of Java programs, but only a small and +simplified part of it (some keywords, some operators, comments and only two kinds of literals). +It also shows how to interface with the LALR parser generator CUP and therefore uses a class `sym` +(generated by CUP), where integer constants for the terminal tokens of the CUP grammar are declared. + +For a full implementation of **Java 1.2**, see [cup-java](../cup-java). + +## Build, run, test + +### Using Maven + + ../../mvnw package + +To run the parser: + + java -cp target/cup-java-simplified-1.0.jar:../../../cup/cup/java-cup-11b.jar JavaParser + +or more simply the uberjar version: + + java -jar target/cup-java-simplified-full-1.0.jar + + +## Files + +* `src/main/jflex/minijava.flex` + Partial (simplified) specification of Java. +* `src/test/java/jflex/examples/minijava/LexerTest.java` + Test of the generated lexer. \ No newline at end of file diff --git a/jflex/examples/cup-java-minijava/src/main/cup/minijava.cup b/jflex/examples/cup-java-minijava/src/main/cup/minijava.cup new file mode 100644 index 000000000..6278183aa --- /dev/null +++ b/jflex/examples/cup-java-minijava/src/main/cup/minijava.cup @@ -0,0 +1,67 @@ +/* + * Copyright (C) 1998 C. Scott Ananian + * Copyright (C) 1999 Gerwin Klein + * Copyright (C) 2018 Google LLC + * + * This program is released under the terms of the GPL; see the file + * COPYING for more details. There is NO WARRANTY on this code. + */ +package jflex.examples.minijava; + +import java_cup.runtime.*; + + +/** Parser for a lamguages inspired by Java. */ + +// Keywords +terminal ABSTRACT; // "abstract" +terminal BOOLEAN; // "boolean" primitive_type +terminal BREAK; // "break" break_statement + +// Identifier matches each string that starts with a character of class jletter followed by zero or +// more characters of class jletterdigit +terminal java.lang.String IDENTIFIER; // name + +// Literals +terminal java.lang.Number INTEGER_LITERAL; +terminal java.lang.String STRING_LITERAL; + +// Operators +terminal EQ; +terminal EQEQ; // equality_expression +terminal PLUS; + + +// 19.3) Lexical Structure +non terminal literal; +// 19.4) Types, Values, and Variables +non terminal primitive_type; +// 19.5) Names +non terminal name; +// 19.12) Expressions +non terminal equality_expression; + +// Our simplified grammar +non terminal goal; + +// TODO +start with goal; + +goal ::= name + ; + +// 19.3) Lexical Structure. +literal ::= INTEGER_LITERAL + | STRING_LITERAL + ; + +// 19.4) Types, Values, and Variables +type ::= primitive_type + ; +primitive_type ::= + | BOOLEAN + ; + +// 19.5) Names +name ::= IDENTIFIER + ; diff --git a/testsuite/testcases/src/test/cases/manual-ex/manual.flex b/jflex/examples/cup-java-minijava/src/main/jflex/minijava.flex similarity index 92% rename from testsuite/testcases/src/test/cases/manual-ex/manual.flex rename to jflex/examples/cup-java-minijava/src/main/jflex/minijava.flex index d1c7707d3..ee5657207 100644 --- a/testsuite/testcases/src/test/cases/manual-ex/manual.flex +++ b/jflex/examples/cup-java-minijava/src/main/jflex/minijava.flex @@ -1,5 +1,10 @@ -/* JFlex example: part of Java language lexer specification */ -import java_cup.runtime.*; +// JFlex example from the user Manual + +package jflex.examples.minijava; + +import java_cup.runtime.Symbol; + +/** Lexer of a very minimal version of the Java programming language. */ %% diff --git a/jflex/examples/cup-java-minijava/src/test/java/jflex/examples/minijava/LexerTest.java b/jflex/examples/cup-java-minijava/src/test/java/jflex/examples/minijava/LexerTest.java new file mode 100644 index 000000000..f32a557ae --- /dev/null +++ b/jflex/examples/cup-java-minijava/src/test/java/jflex/examples/minijava/LexerTest.java @@ -0,0 +1,70 @@ +package jflex.examples.minijava; + +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import org.junit.After; +import org.junit.Test; + +/** + * Test for the generated {@link Lexer}. + * + *

The lexer is probably already correct thanks to the regression tests. This test class is + * mostly here to show how the lexer behaves. + */ +public class LexerTest { + + private Lexer lexer; + + @After + public void resetLexer() { + lexer = null; + } + + @Test + public void scan_tokenIdentifier() throws IOException { + scan("helloWorld"); + assertThat(nextToken()).isEqualTo(sym.IDENTIFIER); + } + + @Test + public void scan_assignment() throws IOException { + scan("boolean debug = 2 == 1 + 1"); + assertThat(nextToken()).isEqualTo(sym.BOOLEAN); + assertThat(nextToken()).isEqualTo(sym.IDENTIFIER); + assertThat(nextToken()).isEqualTo(sym.EQ); + assertThat(nextToken()).isEqualTo(sym.INTEGER_LITERAL); + assertThat(nextToken()).isEqualTo(sym.EQEQ); + assertThat(nextToken()).isEqualTo(sym.INTEGER_LITERAL); + assertThat(nextToken()).isEqualTo(sym.PLUS); + assertThat(nextToken()).isEqualTo(sym.INTEGER_LITERAL); + assertThat(nextToken()).isEqualTo(sym.EOF); + } + + @SuppressWarnings("TryFailThrowable") + @Test + public void scan_illegalChar() throws IOException { + scan("boolean debug;"); + assertThat(nextToken()).isEqualTo(sym.BOOLEAN); + assertThat(nextToken()).isEqualTo(sym.IDENTIFIER); + try { + nextToken(); + fail("Character `;` is not declared in the minijava.flex"); + } catch (Error expected) { + // This is bad, but the JFlex API doesn't allow better + // https://errorprone.info/bugpattern/TryFailThrowable + } + } + + private void scan(String input) { + Reader in = new StringReader(input); + lexer = new Lexer(in); + } + + private int nextToken() throws IOException { + return lexer.next_token().sym; + } +} diff --git a/testsuite/testcases/src/test/cases/manual-ex/.gitignore b/testsuite/testcases/src/test/cases/manual-ex/.gitignore deleted file mode 100644 index c9c7aa513..000000000 --- a/testsuite/testcases/src/test/cases/manual-ex/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Lexer.java diff --git a/testsuite/testcases/src/test/cases/manual-ex/manual-flex.output b/testsuite/testcases/src/test/cases/manual-ex/manual-flex.output deleted file mode 100644 index 2df8305d9..000000000 --- a/testsuite/testcases/src/test/cases/manual-ex/manual-flex.output +++ /dev/null @@ -1,11 +0,0 @@ -Reading "src/test/cases/manual-ex/manual.flex" - -Warning in file "src/test/cases/manual-ex/manual.flex" (line 90): -".|\n" does not match all characters, because "." excludes all Unicode newline chars - use "[^]" instead -.|\n { throw new Error("Illegal character <"+ -^ -Constructing NFA : 160 states in NFA -Converting NFA to DFA : -.......................................................... -62 states before minimization, 43 states in minimized DFA -Writing code to "src/test/cases/manual-ex/Lexer.java" diff --git a/testsuite/testcases/src/test/cases/manual-ex/manual.test b/testsuite/testcases/src/test/cases/manual-ex/manual.test deleted file mode 100644 index f8e5bbe22..000000000 --- a/testsuite/testcases/src/test/cases/manual-ex/manual.test +++ /dev/null @@ -1,7 +0,0 @@ -name: manual -description: -the introductory example from the manual - -jflex: --nobak - -javac-files: Lexer.java sym.java diff --git a/testsuite/testcases/src/test/cases/manual-ex/sym.java b/testsuite/testcases/src/test/cases/manual-ex/sym.java deleted file mode 100644 index 5aa831c28..000000000 --- a/testsuite/testcases/src/test/cases/manual-ex/sym.java +++ /dev/null @@ -1,114 +0,0 @@ - -//---------------------------------------------------- -// The following code was generated by CUP v0.10k -// Sat May 05 23:45:07 CEST 2001 -//---------------------------------------------------- - -/** CUP generated interface containing symbol constants. */ -public interface sym { - /* terminals */ - public static final int SHORT = 4; - public static final int IDENTIFIER = 98; - public static final int ANDEQ = 90; - public static final int GT = 70; - public static final int IMPLEMENTS = 36; - public static final int CONST = 101; - public static final int STRICTFP = 100; - public static final int NOTEQ = 75; - public static final int PLUSEQ = 85; - public static final int RBRACK = 11; - public static final int CATCH = 55; - public static final int COMMA = 15; - public static final int RBRACE = 17; - public static final int THROW = 53; - public static final int RPAREN = 20; - public static final int LBRACK = 10; - public static final int LT = 69; - public static final int ANDAND = 79; - public static final int OROR = 80; - public static final int DOUBLE = 9; - public static final int LBRACE = 16; - public static final int TRANSIENT = 32; - public static final int LPAREN = 19; - public static final int XOREQ = 91; - public static final int PROTECTED = 25; - public static final int INTEGER_LITERAL = 93; - public static final int NOT = 63; - public static final int FINAL = 29; - public static final int FLOAT = 8; - public static final int GOTO = 102; - public static final int URSHIFTEQ = 89; - public static final int PACKAGE = 22; - public static final int COMP = 62; - public static final int EQ = 18; - public static final int BOOLEAN_LITERAL = 95; - public static final int MOD = 65; - public static final int CLASS = 34; - public static final int SUPER = 40; - public static final int ABSTRACT = 28; - public static final int NATIVE = 30; - public static final int LONG = 6; - public static final int PLUS = 60; - public static final int QUESTION = 81; - public static final int WHILE = 48; - public static final int EXTENDS = 35; - public static final int INTERFACE = 41; - public static final int CHAR = 7; - public static final int BOOLEAN = 2; - public static final int SWITCH = 44; - public static final int DO = 47; - public static final int FOR = 49; - public static final int RSHIFTEQ = 88; - public static final int VOID = 37; - public static final int DIV = 64; - public static final int PUBLIC = 24; - public static final int RETURN = 52; - public static final int MULT = 14; - public static final int ELSE = 43; - public static final int TRY = 54; - public static final int GTEQ = 72; - public static final int BREAK = 50; - public static final int DOT = 12; - public static final int INT = 5; - public static final int NULL_LITERAL = 99; - public static final int THROWS = 38; - public static final int STRING_LITERAL = 97; - public static final int EQEQ = 74; - public static final int EOF = 0; - public static final int SEMICOLON = 13; - public static final int THIS = 39; - public static final int DEFAULT = 46; - public static final int MULTEQ = 82; - public static final int IMPORT = 23; - public static final int MINUS = 61; - public static final int LTEQ = 71; - public static final int OR = 78; - public static final int error = 1; - public static final int URSHIFT = 68; - public static final int SYNCHRONIZED = 31; - public static final int DIVEQ = 83; - public static final int LSHIFTEQ = 87; - public static final int FINALLY = 56; - public static final int CONTINUE = 51; - public static final int INSTANCEOF = 73; - public static final int IF = 42; - public static final int MODEQ = 84; - public static final int MINUSMINUS = 59; - public static final int COLON = 21; - public static final int CHARACTER_LITERAL = 96; - public static final int OREQ = 92; - public static final int VOLATILE = 33; - public static final int CASE = 45; - public static final int PLUSPLUS = 58; - public static final int NEW = 57; - public static final int RSHIFT = 67; - public static final int BYTE = 3; - public static final int AND = 76; - public static final int PRIVATE = 26; - public static final int STATIC = 27; - public static final int LSHIFT = 66; - public static final int XOR = 77; - public static final int FLOATING_POINT_LITERAL = 94; - public static final int MINUSEQ = 86; -} - From 16bc6e569b1a226c6841b8569528a263ea919ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 12:21:59 +0200 Subject: [PATCH 10/13] Add Cirrus-CI badge on README (#465) --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index fef8dc2cf..2d69e6685 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ Build status + + Bazel build status + Maven central From 22689eb31b74ac021f618c6f8e2a772e920d9300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Wed, 17 Oct 2018 12:22:25 +0200 Subject: [PATCH 11/13] Add @SuppressWarnings("FallThrough") on generated lexer. (#454) * Enabled Error-prone FallThrough WARN in Bazel * Add @SuppressWarnings("FallThrough") on generated lexer. * Let Travis use the project's bazelrc --- .bazelrc | 4 ++++ .ci.bazelrc | 2 ++ jflex/src/main/java/jflex/Emitter.java | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 .bazelrc diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000..7a7c74b6b --- /dev/null +++ b/.bazelrc @@ -0,0 +1,4 @@ +# https://errorprone.info/ +# TODO(#222) Increase to error when we build from jflex-1.7.1 with a lexer annotated with +# @SuppressWarnings +build --javacopt "-Xep:FallThrough:WARN" diff --git a/.ci.bazelrc b/.ci.bazelrc index a34c9f070..2f60348fe 100644 --- a/.ci.bazelrc +++ b/.ci.bazelrc @@ -1,3 +1,5 @@ +import %workspace%/.bazelrc + # This is from Bazel's former travis setup, to avoid blowing up the RAM usage. startup --host_jvm_args=-Xms2000m startup --host_jvm_args=-Xmx3000m diff --git a/jflex/src/main/java/jflex/Emitter.java b/jflex/src/main/java/jflex/Emitter.java index de45e63d9..15ac17648 100644 --- a/jflex/src/main/java/jflex/Emitter.java +++ b/jflex/src/main/java/jflex/Emitter.java @@ -434,6 +434,9 @@ private void emitUserCode() { } private void emitClassName() { + // TODO(#222) Actually fix the fall-through violations + println("// See https://github.com/jflex-de/jflex/issues/222"); + println("@SuppressWarnings(\"FallThrough\")"); if (scanner.isPublic) print("public "); if (scanner.isAbstract) print("abstract "); From 743b0e2919c1fa392bd0fe0fc8e8f96206d5c254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Thu, 18 Oct 2018 07:50:05 +0200 Subject: [PATCH 12/13] Add all error-prone checks (#468) Add all error-prone checks in the project bazelrc --- .bazelrc | 373 +++++++++++++++++- cup/cup_runtime/BUILD | 5 +- .../java/jflex/testing/javac/BUILD | 4 + 3 files changed, 379 insertions(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index 7a7c74b6b..b504d7f6d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,4 +1,373 @@ -# https://errorprone.info/ +http://errorprone.info/bugpatterns +# To avoid bugs in the code +# P1 Fix the errors and bump from :WARN to :ERROR +# P2 Fix the warnings and bump from :OFF to :WARN + +# On by default : ERROR +build --javacopt "-Xep:ArrayEquals:ERROR" +build --javacopt "-Xep:ArrayFillIncompatibleType:ERROR" +build --javacopt "-Xep:ArrayHashCode:ERROR" +build --javacopt "-Xep:ArrayToString:ERROR" +build --javacopt "-Xep:ArraysAsListPrimitiveArray:ERROR" +build --javacopt "-Xep:AsyncCallableReturnsNull:ERROR" +build --javacopt "-Xep:AsyncFunctionReturnsNull:ERROR" +build --javacopt "-Xep:AutoValueConstructorOrderChecker:ERROR" +build --javacopt "-Xep:BadShiftAmount:ERROR" +build --javacopt "-Xep:BundleDeserializationCast:ERROR" +build --javacopt "-Xep:ChainingConstructorIgnoresParameter:ERROR" +build --javacopt "-Xep:CheckReturnValue:ERROR" +build --javacopt "-Xep:CollectionIncompatibleType:ERROR" +build --javacopt "-Xep:ComparableType:ERROR" +build --javacopt "-Xep:ComparingThisWithNull:ERROR" +build --javacopt "-Xep:ComparisonOutOfRange:ERROR" +build --javacopt "-Xep:CompatibleWithAnnotationMisuse:ERROR" +build --javacopt "-Xep:CompileTimeConstant:ERROR" +build --javacopt "-Xep:ComplexBooleanConstant:ERROR" +build --javacopt "-Xep:ConditionalExpressionNumericPromotion:ERROR" +build --javacopt "-Xep:ConstantOverflow:ERROR" +build --javacopt "-Xep:DaggerProvidesNull:ERROR" +build --javacopt "-Xep:DeadException:ERROR" +build --javacopt "-Xep:DeadThread:ERROR" +build --javacopt "-Xep:DoNotCall:ERROR" +build --javacopt "-Xep:EqualsNaN:ERROR" +build --javacopt "-Xep:EqualsReference:ERROR" +build --javacopt "-Xep:EqualsWrongThing:ERROR" +build --javacopt "-Xep:ForOverride:ERROR" +build --javacopt "-Xep:FormatString:ERROR" +build --javacopt "-Xep:FormatStringAnnotation:ERROR" +build --javacopt "-Xep:FunctionalInterfaceMethodChanged:ERROR" +build --javacopt "-Xep:FuturesGetCheckedIllegalExceptionType:ERROR" +build --javacopt "-Xep:GetClassOnAnnotation:ERROR" +build --javacopt "-Xep:GetClassOnClass:ERROR" +build --javacopt "-Xep:GuardedBy:ERROR" +build --javacopt "-Xep:GuiceAssistedInjectScoping:ERROR" +build --javacopt "-Xep:GuiceAssistedParameters:ERROR" +build --javacopt "-Xep:GuiceInjectOnFinalField:ERROR" +build --javacopt "-Xep:HashtableContains:ERROR" +build --javacopt "-Xep:IdentityBinaryExpression:ERROR" +build --javacopt "-Xep:Immutable:ERROR" +build --javacopt "-Xep:ImmutableModification:ERROR" +build --javacopt "-Xep:IncompatibleArgumentType:ERROR" +build --javacopt "-Xep:IndexOfChar:ERROR" +build --javacopt "-Xep:InexactVarargsConditional:ERROR" +build --javacopt "-Xep:InfiniteRecursion:ERROR" +build --javacopt "-Xep:InjectMoreThanOneScopeAnnotationOnClass:ERROR" +build --javacopt "-Xep:InjectOnMemberAndConstructor:ERROR" +build --javacopt "-Xep:InvalidPatternSyntax:ERROR" +build --javacopt "-Xep:InvalidTimeZoneID:ERROR" +build --javacopt "-Xep:IsInstanceOfClass:ERROR" +build --javacopt "-Xep:IsLoggableTagLength:ERROR" +build --javacopt "-Xep:JUnit3TestNotRun:ERROR" +build --javacopt "-Xep:JUnit4ClassAnnotationNonStatic:ERROR" +build --javacopt "-Xep:JUnit4SetUpNotRun:ERROR" +build --javacopt "-Xep:JUnit4TearDownNotRun:ERROR" +build --javacopt "-Xep:JUnit4TestNotRun:ERROR" +build --javacopt "-Xep:JUnitAssertSameCheck:ERROR" +build --javacopt "-Xep:JavaxInjectOnAbstractMethod:ERROR" +build --javacopt "-Xep:LiteByteStringUtf8:ERROR" +build --javacopt "-Xep:LoopConditionChecker:ERROR" +build --javacopt "-Xep:MathRoundIntLong:ERROR" +#build --javacopt "-Xep:MislabeledAndroidString:ERROR" +build --javacopt "-Xep:MissingSuperCall:ERROR" +build --javacopt "-Xep:MissingTestCall:ERROR" +build --javacopt "-Xep:MisusedWeekYear:ERROR" +build --javacopt "-Xep:MockitoCast:ERROR" +build --javacopt "-Xep:MockitoUsage:ERROR" +build --javacopt "-Xep:ModifyingCollectionWithItself:ERROR" +build --javacopt "-Xep:MoreThanOneInjectableConstructor:ERROR" +build --javacopt "-Xep:MustBeClosedChecker:ERROR" +build --javacopt "-Xep:NCopiesOfChar:ERROR" +build --javacopt "-Xep:NonCanonicalStaticImport:ERROR" +build --javacopt "-Xep:NonFinalCompileTimeConstant:ERROR" +build --javacopt "-Xep:NonRuntimeAnnotation:ERROR" +build --javacopt "-Xep:NullTernary:ERROR" +build --javacopt "-Xep:OptionalEquality:ERROR" +build --javacopt "-Xep:OverlappingQualifierAndScopeAnnotation:ERROR" +build --javacopt "-Xep:OverridesJavaxInjectableMethod:ERROR" +build --javacopt "-Xep:PackageInfo:ERROR" +build --javacopt "-Xep:ParcelableCreator:ERROR" +build --javacopt "-Xep:PreconditionsCheckNotNull:ERROR" +build --javacopt "-Xep:PreconditionsCheckNotNullPrimitive:ERROR" +build --javacopt "-Xep:PredicateIncompatibleType:ERROR" +build --javacopt "-Xep:PrivateSecurityContractProtoAccess:ERROR" +build --javacopt "-Xep:ProtoFieldNullComparison:ERROR" +build --javacopt "-Xep:ProtoStringFieldReferenceEquality:ERROR" +build --javacopt "-Xep:ProtocolBufferOrdinal:ERROR" +build --javacopt "-Xep:ProvidesMethodOutsideOfModule:ERROR" +build --javacopt "-Xep:RandomCast:ERROR" +build --javacopt "-Xep:RandomModInteger:ERROR" +build --javacopt "-Xep:RectIntersectReturnValueIgnored:ERROR" +build --javacopt "-Xep:RestrictedApiChecker:ERROR" +build --javacopt "-Xep:ReturnValueIgnored:ERROR" +build --javacopt "-Xep:SelfAssignment:ERROR" +build --javacopt "-Xep:SelfComparison:ERROR" +build --javacopt "-Xep:SelfEquals:ERROR" +build --javacopt "-Xep:ShouldHaveEvenArgs:ERROR" +build --javacopt "-Xep:SizeGreaterThanOrEqualsZero:ERROR" +build --javacopt "-Xep:StreamToString:ERROR" +build --javacopt "-Xep:StringBuilderInitWithChar:ERROR" +build --javacopt "-Xep:SubstringOfZero:ERROR" +build --javacopt "-Xep:SuppressWarningsDeprecated:ERROR" +build --javacopt "-Xep:ThrowIfUncheckedKnownChecked:ERROR" +build --javacopt "-Xep:ThrowNull:ERROR" +build --javacopt "-Xep:TruthSelfEquals:ERROR" +build --javacopt "-Xep:TryFailThrowable:ERROR" +build --javacopt "-Xep:TypeParameterQualifier:ERROR" +build --javacopt "-Xep:UnnecessaryTypeArgument:ERROR" +build --javacopt "-Xep:UnusedAnonymousClass:ERROR" +build --javacopt "-Xep:UnusedCollectionModifiedInPlace:ERROR" +build --javacopt "-Xep:VarTypeName:ERROR" + +# On by default : WARNING +build --javacopt "-Xep:AmbiguousMethodReference:WARN" +build --javacopt "-Xep:ArgumentSelectionDefectChecker:WARN" +build --javacopt "-Xep:ArrayAsKeyOfSetOrMap:WARN" +build --javacopt "-Xep:AssertEqualsArgumentOrderChecker:WARN" +build --javacopt "-Xep:AssertThrowsMultipleStatements:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:AssertionFailureIgnored:OFF" +build --javacopt "-Xep:AutoValueFinalMethods:WARN" +build --javacopt "-Xep:BadAnnotationImplementation:WARN" +build --javacopt "-Xep:BadComparable:WARN" +build --javacopt "-Xep:BadImport:WARN" +build --javacopt "-Xep:BadInstanceof:WARN" +build --javacopt "-Xep:BigDecimalEquals:WARN" +build --javacopt "-Xep:BigDecimalLiteralDouble:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:BoxedPrimitiveConstructor:OFF" +build --javacopt "-Xep:ByteBufferBackingArray:WARN" +build --javacopt "-Xep:CannotMockFinalClass:WARN" +build --javacopt "-Xep:CanonicalDuration:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:CatchAndPrintStackTrace:OFF" +build --javacopt "-Xep:CatchFail:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:ClassCanBeStatic:WARN" +build --javacopt "-Xep:ClassNewInstance:WARN" +build --javacopt "-Xep:CloseableProvides:WARN" +build --javacopt "-Xep:CollectionToArraySafeParameter:WARN" +build --javacopt "-Xep:CollectorShouldNotUseState:WARN" +build --javacopt "-Xep:ComparableAndComparator:WARN" +build --javacopt "-Xep:DateFormatConstant:WARN" +# TODO(#469/#470) Fix these errors and re-enable violation +build --javacopt "-Xep:DefaultCharset:OFF" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:DeprecatedThreadMethods:OFF" +build --javacopt "-Xep:DoubleBraceInitialization:WARN" +build --javacopt "-Xep:DoubleCheckedLocking:WARN" +build --javacopt "-Xep:EqualsGetClass:WARN" +build --javacopt "-Xep:EqualsHashCode:WARN" +build --javacopt "-Xep:EqualsIncompatibleType:WARN" +build --javacopt "-Xep:EqualsUnsafeCast:WARN" +build --javacopt "-Xep:EqualsUsingHashCode:WARN" +build --javacopt "-Xep:ExtendingJUnitAssert:WARN" # TODO(#222) Increase to error when we build from jflex-1.7.1 with a lexer annotated with # @SuppressWarnings -build --javacopt "-Xep:FallThrough:WARN" +build --javacopt "-Xep:FallThrough:OFF" +build --javacopt "-Xep:Finally:WARN" +build --javacopt "-Xep:FloatCast:WARN" +build --javacopt "-Xep:FloatingPointAssertionWithinEpsilon:WARN" +build --javacopt "-Xep:FloatingPointLiteralPrecision:WARN" +build --javacopt "-Xep:FragmentInjection:WARN" +build --javacopt "-Xep:FragmentNotInstantiable:WARN" +build --javacopt "-Xep:FutureReturnValueIgnored:WARN" +build --javacopt "-Xep:GetClassOnEnum:WARN" +build --javacopt "-Xep:HidingField:WARN" +build --javacopt "-Xep:ImmutableAnnotationChecker:WARN" +build --javacopt "-Xep:ImmutableEnumChecker:WARN" +build --javacopt "-Xep:IncompatibleModifiers:WARN" +build --javacopt "-Xep:InconsistentCapitalization:WARN" +build --javacopt "-Xep:InconsistentHashCode:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:IncrementInForLoopAndHeader:OFF" +build --javacopt "-Xep:InjectOnConstructorOfAbstractClass:WARN" +build --javacopt "-Xep:InputStreamSlowMultibyteRead:WARN" +build --javacopt "-Xep:InstanceOfAndCastMatchWrongType:WARN" +build --javacopt "-Xep:IntLongMath:WARN" +build --javacopt "-Xep:IterableAndIterator:WARN" +build --javacopt "-Xep:JUnit3FloatingPointComparisonWithoutDelta:WARN" +build --javacopt "-Xep:JUnit4ClassUsedInJUnit3:WARN" +build --javacopt "-Xep:JUnitAmbiguousTestClass:WARN" +build --javacopt "-Xep:JavaLangClash:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:JdkObsolete:OFF" +build --javacopt "-Xep:LockNotBeforeTry:WARN" +build --javacopt "-Xep:LogicalAssignment:WARN" +build --javacopt "-Xep:MathAbsoluteRandom:WARN" +build --javacopt "-Xep:MissingCasesInEnumSwitch:WARN" +build --javacopt "-Xep:MissingFail:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:MissingOverride:OFF" +build --javacopt "-Xep:ModifiedButNotUsed:WARN" +build --javacopt "-Xep:ModifyCollectionInEnhancedForLoop:WARN" +build --javacopt "-Xep:MultipleParallelOrSequentialCalls:WARN" +build --javacopt "-Xep:MutableConstantField:WARN" +build --javacopt "-Xep:NarrowingCompoundAssignment:WARN" +build --javacopt "-Xep:NestedInstanceOfConditions:WARN" +build --javacopt "-Xep:NonAtomicVolatileUpdate:WARN" +build --javacopt "-Xep:NonOverridingEquals:WARN" +build --javacopt "-Xep:NullableConstructor:WARN" +build --javacopt "-Xep:NullablePrimitive:WARN" +build --javacopt "-Xep:NullableVoid:WARN" +build --javacopt "-Xep:ObjectToString:WARN" +build --javacopt "-Xep:ObjectsHashCodePrimitive:WARN" +build --javacopt "-Xep:OperatorPrecedence:WARN" +build --javacopt "-Xep:OptionalNotPresent:WARN" +build --javacopt "-Xep:OrphanedFormatString:WARN" +build --javacopt "-Xep:OverrideThrowableToString:WARN" +build --javacopt "-Xep:Overrides:WARN" +build --javacopt "-Xep:OverridesGuiceInjectableMethod:WARN" +build --javacopt "-Xep:ParameterName:WARN" +build --javacopt "-Xep:PreconditionsInvalidPlaceholder:WARN" +build --javacopt "-Xep:ProtoRedundantSet:WARN" +build --javacopt "-Xep:QualifierOrScopeOnInjectMethod:WARN" +build --javacopt "-Xep:ReachabilityFenceUsage:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:ReferenceEquality:OFF" +build --javacopt "-Xep:RequiredModifiers:WARN" +build --javacopt "-Xep:ShortCircuitBoolean:WARN" +build --javacopt "-Xep:StaticGuardedByInstance:WARN" +build --javacopt "-Xep:StreamResourceLeak:WARN" +build --javacopt "-Xep:StringSplitter:WARN" +build --javacopt "-Xep:SwigMemoryLeak:WARN" +build --javacopt "-Xep:SynchronizeOnNonFinalField:WARN" +build --javacopt "-Xep:ThreadJoinLoop:WARN" +build --javacopt "-Xep:ThreadLocalUsage:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:ThreadPriorityCheck:OFF" +build --javacopt "-Xep:ThreeLetterTimeZoneID:WARN" +build --javacopt "-Xep:ToStringReturnsNull:WARN" +build --javacopt "-Xep:TruthAssertExpected:WARN" +build --javacopt "-Xep:TruthConstantAsserts:WARN" +build --javacopt "-Xep:TruthIncompatibleType:WARN" +build --javacopt "-Xep:TypeNameShadowing:WARN" +build --javacopt "-Xep:TypeParameterShadowing:WARN" +build --javacopt "-Xep:TypeParameterUnusedInFormals:WARN" +build --javacopt "-Xep:URLEqualsHashCode:WARN" +build --javacopt "-Xep:UndefinedEquals:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:UnnecessaryParentheses:OFF" +build --javacopt "-Xep:UnsafeFinalization:WARN" +build --javacopt "-Xep:UnsafeReflectiveConstructionCast:WARN" +build --javacopt "-Xep:UnsynchronizedOverridesSynchronized:WARN" +build --javacopt "-Xep:UseCorrectAssertInTests:WARN" +build --javacopt "-Xep:VariableNameSameAsType:WARN" +build --javacopt "-Xep:WaitNotInLoop:WARN" +build --javacopt "-Xep:WakelockReleasedDangerously:WARN" + +#Experimental : ERROR +#build --javacopt "-Xep:AndroidJdkLibsChecker:ERROR" +build --javacopt "-Xep:AssistedInjectAndInjectOnSameConstructor:ERROR" +build --javacopt "-Xep:AutoFactoryAtInject:ERROR" +build --javacopt "-Xep:ClassName:ERROR" +build --javacopt "-Xep:ComparisonContractViolated:ERROR" +build --javacopt "-Xep:DepAnn:ERROR" +build --javacopt "-Xep:DivZero:ERROR" +build --javacopt "-Xep:EmptyIf:ERROR" +build --javacopt "-Xep:FuzzyEqualsShouldNotBeUsedInEqualsMethod:ERROR" +build --javacopt "-Xep:InjectInvalidTargetingOnScopingAnnotation:ERROR" +build --javacopt "-Xep:InjectMoreThanOneQualifier:ERROR" +build --javacopt "-Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass:ERROR" +build --javacopt "-Xep:InjectScopeOrQualifierAnnotationRetention:ERROR" +build --javacopt "-Xep:InjectedConstructorAnnotations:ERROR" +build --javacopt "-Xep:InsecureCryptoUsage:ERROR" +build --javacopt "-Xep:IterablePathParameter:ERROR" +build --javacopt "-Xep:JMockTestWithoutRunWithOrRuleAnnotation:ERROR" +build --javacopt "-Xep:Java7ApiChecker:ERROR" +build --javacopt "-Xep:JavaxInjectOnFinalField:ERROR" +build --javacopt "-Xep:LockMethodChecker:ERROR" +build --javacopt "-Xep:LongLiteralLowerCaseSuffix:ERROR" +build --javacopt "-Xep:NoAllocation:ERROR" +build --javacopt "-Xep:NumericEquality:ERROR" +build --javacopt "-Xep:ParameterPackage:ERROR" +build --javacopt "-Xep:RestrictTo:ERROR" +build --javacopt "-Xep:StaticOrDefaultInterfaceMethod:ERROR" +build --javacopt "-Xep:UnlockMethod:ERROR" + +# Experimental : WARNING +build --javacopt "-Xep:AnnotateFormatMethod:WARN" +build --javacopt "-Xep:AnnotationPosition:WARN" +build --javacopt "-Xep:AssertFalse:WARN" +build --javacopt "-Xep:AssistedInjectAndInjectOnConstructors:WARN" +build --javacopt "-Xep:BinderIdentityRestoredDangerously:WARN" +build --javacopt "-Xep:BindingToUnqualifiedCommonType:WARN" +# TODO(#469) Fix these errors and re-enable violation +build --javacopt "-Xep:ConstructorInvokesOverridable:OFF" +build --javacopt "-Xep:ConstructorLeaksThis:WARN" +build --javacopt "-Xep:EmptyTopLevelDeclaration:WARN" +build --javacopt "-Xep:EqualsBrokenForNull:WARN" +build --javacopt "-Xep:ExpectedExceptionChecker:WARN" +build --javacopt "-Xep:FunctionalInterfaceClash:WARN" +build --javacopt "-Xep:HardCodedSdCardPath:WARN" +# TODO(#469) Fix these errors and re-enable violation +build --javacopt "-Xep:InconsistentOverloads:OFF" +build --javacopt "-Xep:InvalidParam:WARN" +build --javacopt "-Xep:InvalidTag:WARN" +build --javacopt "-Xep:InvalidThrows:WARN" +# TODO(#469) Fix these errors and re-enable violation +build --javacopt "-Xep:MissingDefault:OFF" +build --javacopt "-Xep:MutableMethodReturnType:WARN" +build --javacopt "-Xep:NoFunctionalReturnType:WARN" +build --javacopt "-Xep:NonCanonicalStaticMemberImport:WARN" +build --javacopt "-Xep:NullableDereference:WARN" +build --javacopt "-Xep:PrimitiveArrayPassedToVarargsMethod:WARN" +build --javacopt "-Xep:ProtosAsKeyOfSetOrMap:WARN" +build --javacopt "-Xep:ProvidesFix:WARN" +build --javacopt "-Xep:QualifierWithTypeUse:WARN" +build --javacopt "-Xep:RedundantThrows:WARN" +build --javacopt "-Xep:ReturnFromVoid:WARN" +build --javacopt "-Xep:StaticQualifiedUsingExpression:WARN" +build --javacopt "-Xep:StringEquality:WARN" +build --javacopt "-Xep:SystemExitOutsideMain:WARN" +build --javacopt "-Xep:TestExceptionChecker:WARN" +build --javacopt "-Xep:UnnecessaryDefaultInEnumSwitch:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:Unused:OFF" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:UnusedException:OFF" +# TODO(#469) Fix these warnings +# bazel-out/darwin-fastbuild/genfiles/jflex/LexParse.java:2260: error: [Var] Non-constant variable missing @Var annotation +# RegExp RESULT =null; +build --javacopt "-Xep:Var:OFF" + +# Experimental : SUGGESTION +build --javacopt "-Xep:ClassNamedLikeTypeParameter:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:ConstantField:OFF" +build --javacopt "-Xep:EmptySetMultibindingContributions:WARN" +build --javacopt "-Xep:ExpectedExceptionRefactoring:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:FieldCanBeFinal:OFF" +build --javacopt "-Xep:FieldMissingNullable:WARN" +build --javacopt "-Xep:ImmutableRefactoring:WARN" +build --javacopt "-Xep:LambdaFunctionalInterface:WARN" +build --javacopt "-Xep:MethodCanBeStatic:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:MixedArrayDimensions:OFF" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:MultiVariableDeclaration:OFF" +build --javacopt "-Xep:MultipleTopLevelClasses:WARN" +build --javacopt "-Xep:MultipleUnaryOperatorsInMethodCall:WARN" +build --javacopt "-Xep:PackageLocation:WARN" +build --javacopt "-Xep:ParameterComment:WARN" +build --javacopt "-Xep:ParameterNotNullable:WARN" +build --javacopt "-Xep:PrivateConstructorForNoninstantiableModule:WARN" +build --javacopt "-Xep:PrivateConstructorForUtilityClass:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:RemoveUnusedImports:OFF" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:ReturnMissingNullable:OFF" +build --javacopt "-Xep:ScopeOnModule:WARN" +build --javacopt "-Xep:SwitchDefault:WARN" +build --javacopt "-Xep:TestExceptionRefactoring:WARN" +build --javacopt "-Xep:ThrowsUncheckedException:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:TryFailRefactoring:OFF" +build --javacopt "-Xep:TypeParameterNaming:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:UngroupedOverloads:OFF" +build --javacopt "-Xep:UnnecessarySetDefault:WARN" +build --javacopt "-Xep:UnnecessaryStaticImport:WARN" +build --javacopt "-Xep:UseBinds:WARN" +# TODO(#469) Fix these warnings +build --javacopt "-Xep:WildcardImport:OFF" diff --git a/cup/cup_runtime/BUILD b/cup/cup_runtime/BUILD index c9eea2124..bcf37a086 100644 --- a/cup/cup_runtime/BUILD +++ b/cup/cup_runtime/BUILD @@ -2,5 +2,8 @@ licenses(["notice"]) # BSD-like java_library( name = "cup_runtime", srcs = glob(["src/main/java/**/*.java"]), - visibility=["//visibility:public"] + visibility=["//visibility:public"], + javacopts=[ + # Not our code, there is nothing we can do + "-XepDisableAllChecks"], ) \ No newline at end of file diff --git a/testsuite/bzltestsuite/java/jflex/testing/javac/BUILD b/testsuite/bzltestsuite/java/jflex/testing/javac/BUILD index 978e7a4ad..67d35ebf3 100644 --- a/testsuite/bzltestsuite/java/jflex/testing/javac/BUILD +++ b/testsuite/bzltestsuite/java/jflex/testing/javac/BUILD @@ -6,4 +6,8 @@ java_library( deps = [ "//third_party/com/google/guava", ], + javacopts = [ + # Only used for testing + "-Xep:Java7ApiChecker:OFF", + ], ) From d1543720499c23cbcd0caed9f01cab62bd8c8df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Thu, 18 Oct 2018 08:20:45 +0200 Subject: [PATCH 13/13] Use cup.bzl from bazel_rules (#466) * Use cup.bzl from bazel_rules https://github.com/jflex-de/bazel_rules **N.B.** Cannot remove cup Still needed by Maven --- WORKSPACE | 2 +- cup/BUILD | 14 -------------- cup/sample-project/BUILD | 3 ++- jflex/BUILD | 5 +++-- jflex/examples/cup-java-minijava/BUILD | 2 +- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index e7d89e9e9..0ce790b05 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -6,7 +6,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") git_repository( name = "jflex_rules", - tag = "v2", + tag = "v3", remote = "https://github.com/jflex-de/bazel_rules.git", ) diff --git a/cup/BUILD b/cup/BUILD index ff7e3c245..0f8e4e046 100644 --- a/cup/BUILD +++ b/cup/BUILD @@ -2,20 +2,6 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) # GPL-compatible -java_binary( - name = "cup_bin", - main_class = "java_cup.Main", - runtime_deps = [ - ":cup", - ], -) - -# This is the full Java CUP (with runtime) -java_import( - name = "cup", - jars = ["cup/java-cup-11b.jar"], -) - alias( name = "cup_runtime", actual = "//cup/cup_runtime", diff --git a/cup/sample-project/BUILD b/cup/sample-project/BUILD index adac8145b..58e941586 100644 --- a/cup/sample-project/BUILD +++ b/cup/sample-project/BUILD @@ -1,6 +1,7 @@ -load("//cup:cup.bzl", "cup") +load("@jflex_rules//cup:cup.bzl", "cup") cup( name = "gen_parser", src = "src/main/cup/calculator.cup", + cup_bin = "@jflex_rules//cup:cup_bin", ) diff --git a/jflex/BUILD b/jflex/BUILD index 27ab922c3..d64013308 100644 --- a/jflex/BUILD +++ b/jflex/BUILD @@ -1,6 +1,6 @@ package(default_visibility = ["//visibility:public"]) -load("//cup:cup.bzl", "cup") +load("@jflex_rules//cup:cup.bzl", "cup") load("@jflex_rules//jflex:jflex.bzl", "jflex") java_binary( @@ -21,7 +21,7 @@ java_library( resources = glob(["src/main/resources/**"]), visibility = ["//visibility:public"], deps = [ - "//cup", + "//cup:cup_runtime", "//third_party/org/apache/ant", ], ) @@ -29,6 +29,7 @@ java_library( cup( name = "gen_parser", src = "src/main/cup/LexParse.cup", + cup_bin = "@jflex_rules//cup:cup_bin", interface = True, parser = "LexParse", symbols = "sym", diff --git a/jflex/examples/cup-java-minijava/BUILD b/jflex/examples/cup-java-minijava/BUILD index 0812fc081..cd7ede12c 100644 --- a/jflex/examples/cup-java-minijava/BUILD +++ b/jflex/examples/cup-java-minijava/BUILD @@ -1,7 +1,7 @@ package(default_visibility = ["//visibility:public"]) load("@jflex_rules//jflex:jflex.bzl", "jflex") -load("//cup:cup.bzl", "cup") +load("@jflex_rules//cup:cup.bzl", "cup") # The best practice is to define the rules in their respective directory in # - src/main/java/org/example/foo/BUILD