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/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 "); 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 diff --git a/scripts/deploy-aggregated-sources.sh b/scripts/deploy-aggregated-sources.sh new file mode 100755 index 000000000..48429d8d0 --- /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" > /dev/null +git push diff --git a/scripts/deploy-source-code.sh b/scripts/preparare-deploy-source-code.sh similarity index 65% rename from scripts/deploy-source-code.sh rename to scripts/preparare-deploy-source-code.sh index 7cfee0a7f..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 @@ -49,16 +61,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" - cd .. -} - -git_push() { - cd repo - logi "Push to https://github.com/jflex-de/jflex/tree/aggregated-java-sources" - git log -1 - git push + -m "Pseudo-Merge $gitlog" \ + -m "Updated from $version" cd .. } @@ -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" 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", + ], ) 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; 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; -} - 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/