-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bazel: build antlr parsers using bazel (#3927)
- move antlr parsers to /antlr directory - make building the parsers hermetic - check them to "check generated" CI step
- Loading branch information
Showing
32 changed files
with
97 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
load("@rules_antlr//antlr:antlr4.bzl", "antlr") | ||
|
||
antlr( | ||
name = "traffic_class", | ||
srcs = ["TrafficClass.g4"], | ||
language = "Go", | ||
package = "traffic_class", | ||
) | ||
|
||
antlr( | ||
name = "sequence", | ||
srcs = ["Sequence.g4"], | ||
language = "Go", | ||
package = "sequence", | ||
) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
GAZELLE_MODE=$1 | ||
|
||
ROOTDIR=$(dirname "$0")/.. | ||
|
||
GOSDK=$(bazel info output_base 2>/dev/null)/external/go_sdk/bin | ||
|
||
function generate { | ||
PACKAGE=$1 | ||
|
||
bazel build //antlr:${PACKAGE} | ||
rm -rf ${ROOTDIR}/antlr/${PACKAGE} | ||
mkdir ${ROOTDIR}/antlr/${PACKAGE} | ||
cp -r ${ROOTDIR}/bazel-bin/antlr/${PACKAGE}.go/${PACKAGE}/* ${ROOTDIR}/antlr/${PACKAGE} | ||
chmod 0644 ${ROOTDIR}/antlr/${PACKAGE}/* | ||
${GOSDK}/gofmt -w antlr/${PACKAGE}/*.go | ||
# Make the generated files deterministic. | ||
sed -i '/Code generated from/c\// File generated by ANTLR. DO NOT EDIT.' ${ROOTDIR}/antlr/${PACKAGE}/* | ||
} | ||
|
||
generate traffic_class | ||
generate sequence | ||
|
||
bazel run //:gazelle -- update -mode=${GAZELLE_MODE} -index=false -external=external ${ROOTDIR}/antlr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...athpol/sequence/sequence_base_listener.go → antlr/sequence/sequence_base_listener.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
go/lib/pathpol/sequence/sequence_lexer.go → antlr/sequence/sequence_lexer.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
go/lib/pathpol/sequence/sequence_listener.go → antlr/sequence/sequence_listener.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
go/lib/pathpol/sequence/sequence_parser.go → antlr/sequence/sequence_parser.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...affic_class/trafficclass_base_listener.go → ...affic_class/trafficclass_base_listener.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ls/traffic_class/trafficclass_listener.go → antlr/traffic_class/trafficclass_listener.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.