Skip to content

Commit

Permalink
Merge pull request #154 from google/antlr_update
Browse files Browse the repository at this point in the history
antlr: patch rule for external consumption
  • Loading branch information
kyessenov authored Jun 2, 2022
2 parents 3953cb2 + 5580bc7 commit 1adb613
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 1adb613

Please sign in to comment.