From 0b9f90ef5f2c5dabafa12e8d8a5e549ad901149e Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Fri, 5 Feb 2021 00:53:50 +0100 Subject: [PATCH 1/2] bazel: add execlog parser This is a tool to help troubleshoot debug issues: https://docs.bazel.build/versions/master/remote-execution-caching-debug.html --- .../build-managers/bazel/bazel_3/default.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix index 41ae9ce21125..5b20ece76803 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix @@ -62,6 +62,7 @@ let srcs.rules_cc srcs.rules_java srcs.rules_proto + srcs.com_google_protobuf ]); distDir = runCommand "bazel-deps" {} '' @@ -527,6 +528,13 @@ stdenv.mkDerivation rec { --output=./bazel_src/output/bazel-complete.bash \ --prepend=./bazel_src/scripts/bazel-complete-header.bash \ --prepend=./bazel_src/scripts/bazel-complete-template.bash + + # need to change directory for bazel to find the workspace + cd ./bazel_src + # build execlog tooling + export HOME=$(mktemp -d) + ./output/bazel build src/tools/execlog:parser_deploy.jar + cd - ''; installPhase = '' @@ -537,7 +545,15 @@ stdenv.mkDerivation rec { # The binary _must_ exist with this naming if your project contains a .bazelversion # file. cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel + + mkdir $out/share + cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch} + cat < $out/bin/bazel-execlog + #!${runtimeShell} -e + ${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@ + EOF + chmod +x $out/bin/bazel-execlog # shell completion files installShellCompletion --bash \ From ef1045cd64a822d51f7f60bf150a53cb8a880110 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Wed, 17 Mar 2021 00:13:58 +0100 Subject: [PATCH 2/2] bazel_4: add bazel-execlog binary similar to what was done for bazel 3 --- .../build-managers/bazel/bazel_4/default.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix index 5482db67caee..e29705008fc2 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix @@ -560,6 +560,13 @@ stdenv.mkDerivation rec { ${python3}/bin/python3 ./bazel_src/scripts/generate_fish_completion.py \ --bazel=./bazel_src/output/bazel \ --output=./bazel_src/output/bazel-complete.fish + + # need to change directory for bazel to find the workspace + cd ./bazel_src + # build execlog tooling + export HOME=$(mktemp -d) + ./output/bazel build src/tools/execlog:parser_deploy.jar + cd - ''; installPhase = '' @@ -572,6 +579,14 @@ stdenv.mkDerivation rec { cp ./bazel_src/scripts/packages/bazel.sh $out/bin/bazel mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch} + mkdir $out/share + cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar + cat < $out/bin/bazel-execlog + #!${runtimeShell} -e + ${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@ + EOF + chmod +x $out/bin/bazel-execlog + # shell completion files installShellCompletion --bash \ --name bazel.bash \