aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/BUILD
diff options
context:
space:
mode:
authorGravatar Julio Merino <jmmv@google.com>2017-02-01 19:08:32 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-02-02 10:13:36 +0000
commit37debf0e532ccba7e9b6e2758b247659d28e905c (patch)
treee87775c249503f3e88c3ad67046589a804f674b0 /scripts/BUILD
parent73d835f38f5921ed829a1b907b5d0205f2bd498d (diff)
Make the bash completion generation easier to customize per product.
Refactor the code to generate the bash completions file by moving the logic to a separate script and keeping the genrule as a dumb invocation of this script. This allows us to more easily customize the rules for Blaze. -- PiperOrigin-RevId: 146265210 MOS_MIGRATED_REVID=146265210
Diffstat (limited to 'scripts/BUILD')
-rw-r--r--scripts/BUILD15
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/BUILD b/scripts/BUILD
index decf702cfc..7c782cc760 100644
--- a/scripts/BUILD
+++ b/scripts/BUILD
@@ -8,15 +8,16 @@ genrule(
name = "bash_completion",
srcs = ["bazel-complete-template.bash"],
outs = ["bazel-complete.bash"],
- cmd = "cat $(SRCS) > $@\n" +
- "touch err.log\n" +
- "TMP=`mktemp -d $${TMPDIR:-/tmp}/tmp.XXXXXXXXXX`\n" +
- "trap \"rm -fr err.log $${TMP}\" EXIT\n" +
- "$(location //src:bazel) " +
- " --batch --output_user_root=$${TMP} --host_javabase=$(JAVABASE) " +
- " help completion 2>err.log >>$@ || { cat err.log; exit 1; }",
+ cmd = " ".join([
+ "$(location :generate_bash_completion.sh)",
+ "--bazel=$(location //src:bazel)",
+ "--javabase=$(JAVABASE)",
+ "--output=$@",
+ "--prepend=$(location bazel-complete-template.bash)",
+ ]),
output_to_bindir = 1,
tools = [
+ ":generate_bash_completion.sh",
"//src:bazel",
"//tools/defaults:jdk",
],