From 5580bc787d2561ba574e1e2aaa8ef57390090d06 Mon Sep 17 00:00:00 2001 From: Kuat Yessenov Date: Thu, 2 Jun 2022 12:21:48 -0700 Subject: [PATCH] antlr: patch rule for external consumption Signed-off-by: Kuat Yessenov --- bazel/antlr.bzl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bazel/antlr.bzl b/bazel/antlr.bzl index ec110c599..def928b39 100644 --- a/bazel/antlr.bzl +++ b/bazel/antlr.bzl @@ -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( @@ -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,