Skip to content

Commit

Permalink
antlr: patch rule for external consumption
Browse files Browse the repository at this point in the history
Signed-off-by: Kuat Yessenov <[email protected]>
  • Loading branch information
kyessenov committed Jun 2, 2022
1 parent 3953cb2 commit 5580bc7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bazel/antlr.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def _antlr_library(ctx):
antlr_args.add("-package", ctx.attr.package)
antlr_args.add(ctx.file.src)

# Strip ".g4" extension.
basename = ctx.file.src.basename[:-3]

suffixes = ["Lexer", "Parser", "BaseVisitor", "Visitor"]

ctx.actions.run(
Expand All @@ -66,7 +68,7 @@ def _antlr_library(ctx):
for suffix in suffixes:
header = ctx.actions.declare_file(basename + suffix + ".h")
source = ctx.actions.declare_file(basename + suffix + ".cpp")
generated = output.path + "/" + ctx.file.src.short_path[:-3] + suffix
generated = output.path + "/" + ctx.file.src.path[:-3] + suffix

ctx.actions.run_shell(
mnemonic = "CopyHeader" + suffix,
Expand Down

0 comments on commit 5580bc7

Please sign in to comment.