aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/BUILD
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-04-09 21:10:33 +0000
committerGravatar Ulf Adams <ulfjack@google.com>2015-04-10 08:02:42 +0000
commit5f9c6babed7a941cf23557fc152692a79b90395a (patch)
treea386009780f6d26ea5d9e481e415a158ddf53bc0 /scripts/BUILD
parent29728d4c37721aa88621a8578a7c2d7bfe8b5c68 (diff)
Open-source Bazel bash completion script
This script enable shell completion for Bazel inside the Bourne-again shell. Fixes #38 -- MOS_MIGRATED_REVID=90745457
Diffstat (limited to 'scripts/BUILD')
-rw-r--r--scripts/BUILD28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/BUILD b/scripts/BUILD
new file mode 100644
index 0000000000..e3892a675f
--- /dev/null
+++ b/scripts/BUILD
@@ -0,0 +1,28 @@
+# Scripts for IDE / Environment support for Bazel
+package(default_visibility = ["//visibility:private"])
+
+# The master copy of the completion logic are bazel-complete-template.bash
+# and bazel-complete-header.bash.
+# This is where you should make edits.
+genrule(
+ name = "bash_completion",
+ srcs = ["bazel-complete-template.bash"],
+ outs = ["bazel-complete.bash"],
+ cmd = "set +x; cat $(SRCS) > $@\n" +
+ "touch WORKSPACE err.log\n" +
+ "trap \"rm WORKSPACE err.log\" EXIT\n" +
+ "$(location //src:bazel) help completion 2>err.log >>$@ || { cat err.log; exit 1; }",
+ output_to_bindir = 1,
+ tools = ["//src:bazel"],
+)
+
+sh_test(
+ name = "bash_completion_test",
+ size = "small",
+ srcs = ["bash_completion_test.sh"],
+ data = [
+ "bazel-complete.bash",
+ "testenv.sh",
+ "//src/test/shell:bashunit",
+ ],
+)