bazel: fix bash completion, halve build time (#44097)

This finally fixes the build to avoid having to completely rebuild
bazel from source a second time just to generate the bash completion
script!

It also makes completion actually _work_ for bash users by
correcting the name of the installed script.
This commit is contained in:
Benjamin Staffin 2018-07-27 14:45:43 -04:00 committed by GitHub
parent 9cbe75b269
commit 28e11a0b6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,10 +128,10 @@ stdenv.mkDerivation rec {
buildPhase = ''
export TMPDIR=/tmp/.bazel-$UID
./compile.sh
./output/bazel --output_user_root=$TMPDIR/.bazel build //scripts:bash_completion \
--spawn_strategy=standalone \
--genrule_strategy=standalone
cp bazel-bin/scripts/bazel-complete.bash output/
scripts/generate_bash_completion.sh \
--bazel=./output/bazel \
--output=output/bazel-complete.bash \
--prepend=scripts/bazel-complete-template.bash
'';
# Build the CPP and Java examples to verify that Bazel works.
@ -149,7 +149,7 @@ stdenv.mkDerivation rec {
mv output/bazel $out/bin
wrapProgram "$out/bin/bazel" --set JAVA_HOME "${jdk}"
mkdir -p $out/share/bash-completion/completions $out/share/zsh/site-functions
mv output/bazel-complete.bash $out/share/bash-completion/completions/
mv output/bazel-complete.bash $out/share/bash-completion/completions/bazel
cp scripts/zsh_completion/_bazel $out/share/zsh/site-functions/
'';