bazel_4: 4.0.0 -> 4.1.0

https://github.com/bazelbuild/bazel/releases/tag/4.1.0

other minor changes:
- grep for /bin/ rather than /bin for blanket substitute
- invoke {pre,post}{Build,Install} hooks

(cherry picked from commit a15204fcc02ab20abeb19fc6d71403c4b9f6fd85)
This commit is contained in:
Dmitry Ivankov
2021-06-01 16:03:08 +00:00
committed by github-actions[bot]
parent e2e4a34717
commit 12fa8699c3
2 changed files with 176 additions and 69 deletions
@@ -27,12 +27,12 @@
}:
let
version = "4.0.0";
version = "4.1.0";
sourceRoot = ".";
src = fetchurl {
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
sha256 = "1lfdx54dpzwrqysg5ngqhq7a0i01xk981crd4pdk4jb5f07ghl6k";
sha256 = "1svf9n345m0ag05hlcw3cwsl6bw2imcn4da25yyzcl3ar5axfxzk";
};
# Update with `eval $(nix-build -A bazel.updater)`,
@@ -52,8 +52,8 @@ let
srcs.io_bazel_rules_sass
srcs.platforms
(if stdenv.hostPlatform.isDarwin
then srcs."java_tools_javac11_darwin-v10.5.zip"
else srcs."java_tools_javac11_linux-v10.5.zip")
then srcs."java_tools_javac11_darwin-v10.6.zip"
else srcs."java_tools_javac11_linux-v10.6.zip")
srcs."coverage_output_generator-v2.5.zip"
srcs.build_bazel_rules_nodejs
srcs."android_tools_pkg-0.19.0rc3.tar.gz"
@@ -120,7 +120,7 @@ let
remote_java_tools = stdenv.mkDerivation {
name = "remote_java_tools_${system}";
src = srcDepsSet."java_tools_javac11_${system}-v10.5.zip";
src = srcDepsSet."java_tools_javac11_${system}-v10.6.zip";
nativeBuildInputs = [ autoPatchelfHook unzip ];
buildInputs = [ gcc-unwrapped ];
@@ -128,12 +128,20 @@ let
sourceRoot = ".";
buildPhase = ''
runHook preBuild
mkdir $out;
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -Ra * $out/
touch $out/WORKSPACE
runHook postInstall
'';
};
@@ -318,7 +326,11 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ unzip ];
inherit sourceRoot;
installPhase = ''
runHook preInstall
cp -r . "$out"
runHook postInstall
'';
};
# update the list of workspace dependencies
@@ -430,7 +442,7 @@ stdenv.mkDerivation rec {
--replace '"#!/usr/bin/env " + pythonExecutableName' "\"#!${python3}/bin/python\""
# substituteInPlace is rather slow, so prefilter the files with grep
grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
grep -rlZ /bin/ src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
# If you add more replacements here, you must change the grep above!
# Only files containing /bin are taken into account.
# We default to python3 where possible. See also `postFixup` where
@@ -540,6 +552,8 @@ stdenv.mkDerivation rec {
# Needed to build fish completion
propagatedBuildInputs = [ python3.pkgs.absl-py ];
buildPhase = ''
runHook preBuild
# Increasing memory during compilation might be necessary.
# export BAZEL_JAVAC_OPTS="-J-Xmx2g -J-Xms200m"
@@ -567,9 +581,13 @@ stdenv.mkDerivation rec {
export HOME=$(mktemp -d)
./output/bazel build src/tools/execlog:parser_deploy.jar
cd -
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
# official wrapper scripts that searches for $WORKSPACE_ROOT/tools/bazel
@@ -632,6 +650,8 @@ stdenv.mkDerivation rec {
# second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch}
hello_test
runHook postInstall
'';
# Save paths to hardcoded dependencies so Nix can detect them.