Merge pull request #283480 from avdv/bazel_6.5.0

bazel_6: 6.4.0 -> 6.5.0
This commit is contained in:
Mario Rodas 2024-04-24 22:23:22 -05:00 committed by GitHub
commit 05d79f2aee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 135 additions and 39 deletions

View file

@ -0,0 +1,56 @@
diff --git a/src/main/native/darwin/sleep_prevention_jni.cc b/src/main/native/darwin/sleep_prevention_jni.cc
index 67c35b201e..e50a58320e 100644
--- a/src/main/native/darwin/sleep_prevention_jni.cc
+++ b/src/main/native/darwin/sleep_prevention_jni.cc
@@ -33,31 +33,13 @@ static int g_sleep_state_stack = 0;
static IOPMAssertionID g_sleep_state_assertion = kIOPMNullAssertionID;
int portable_push_disable_sleep() {
- std::lock_guard<std::mutex> lock(g_sleep_state_mutex);
- BAZEL_CHECK_GE(g_sleep_state_stack, 0);
- if (g_sleep_state_stack == 0) {
- BAZEL_CHECK_EQ(g_sleep_state_assertion, kIOPMNullAssertionID);
- CFStringRef reasonForActivity = CFSTR("build.bazel");
- IOReturn success = IOPMAssertionCreateWithName(
- kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity,
- &g_sleep_state_assertion);
- BAZEL_CHECK_EQ(success, kIOReturnSuccess);
- }
- g_sleep_state_stack += 1;
- return 0;
+ // Unreliable, disable for now
+ return -1;
}
int portable_pop_disable_sleep() {
- std::lock_guard<std::mutex> lock(g_sleep_state_mutex);
- BAZEL_CHECK_GT(g_sleep_state_stack, 0);
- g_sleep_state_stack -= 1;
- if (g_sleep_state_stack == 0) {
- BAZEL_CHECK_NE(g_sleep_state_assertion, kIOPMNullAssertionID);
- IOReturn success = IOPMAssertionRelease(g_sleep_state_assertion);
- BAZEL_CHECK_EQ(success, kIOReturnSuccess);
- g_sleep_state_assertion = kIOPMNullAssertionID;
- }
- return 0;
+ // Unreliable, disable for now
+ return -1;
}
} // namespace blaze_jni
diff --git a/src/main/native/darwin/system_suspension_monitor_jni.cc b/src/main/native/darwin/system_suspension_monitor_jni.cc
index 3483aa7935..51782986ec 100644
--- a/src/main/native/darwin/system_suspension_monitor_jni.cc
+++ b/src/main/native/darwin/system_suspension_monitor_jni.cc
@@ -83,10 +83,7 @@ void portable_start_suspend_monitoring() {
// Register to receive system sleep notifications.
// Testing needs to be done manually. Use the logging to verify
// that sleeps are being caught here.
- suspend_state.connect_port = IORegisterForSystemPower(
- &suspend_state, &notifyPortRef, SleepCallBack, &notifierObject);
- BAZEL_CHECK_NE(suspend_state.connect_port, MACH_PORT_NULL);
- IONotificationPortSetDispatchQueue(notifyPortRef, queue);
+ // XXX: Unreliable, disable for now
// Register to deal with SIGCONT.
// We register for SIGCONT because we can't catch SIGSTOP.

View file

@ -8,7 +8,7 @@
# updater
, python3, writeScript
# Apple dependencies
, cctools, libcxx, CoreFoundation, CoreServices, Foundation
, cctools, libcxx, CoreFoundation, CoreServices, Foundation, sigtool
# Allow to independently override the jdks used to build and run respectively
, buildJdk, runJdk
, runtimeShell
@ -25,12 +25,12 @@
}:
let
version = "6.4.0";
version = "6.5.0";
sourceRoot = ".";
src = fetchurl {
url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip";
hash = "sha256-vYj/YCyLuynugroqaxKtCS1R7GaMZXf5Yo8Y5I/05R4=";
hash = "sha256-/InakZQVKJ8p5P8YpeAScOzppv6Dy2CWchi6xKO7PtI=";
};
# Update with
@ -179,7 +179,7 @@ let
in
stdenv.mkDerivation rec {
pname = "bazel";
pname = "bazel${ lib.optionalString enableNixHacks "-hacks" }";
inherit version;
meta = with lib; {
@ -205,6 +205,27 @@ stdenv.mkDerivation rec {
# the prebuilt one does not work in nix world.
./java_toolchain.patch
# Bazel integrates with apple IOKit to inhibit and track system sleep.
# Inside the darwin sandbox, these API calls are blocked, and bazel
# crashes. It seems possible to allow these APIs inside the sandbox, but it
# feels simpler to patch bazel not to use it at all. So our bazel is
# incapable of preventing system sleep, which is a small price to pay to
# guarantee that it will always run in any nix context.
#
# See also ./bazel_darwin_sandbox.patch in bazel_5. That patch uses
# NIX_BUILD_TOP env var to conditionnally disable sleep features inside the
# sandbox.
#
# If you want to investigate the sandbox profile path,
# IORegisterForSystemPower can be allowed with
#
# propagatedSandboxProfile = ''
# (allow iokit-open (iokit-user-client-class "RootDomainUserClient"))
# '';
#
# I do not know yet how to allow IOPMAssertion{CreateWithName,Release}
./darwin_sleep.patch
# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
# This is breaking the build of any C target. This patch removes the last
# argument if it's found to be an empty string.
@ -289,7 +310,11 @@ stdenv.mkDerivation rec {
bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }:
let
be = extracted bazelPkg;
in runLocal name { inherit buildInputs; } (
in runLocal name {
inherit buildInputs;
# Necessary for the tests to pass on Darwin with sandbox enabled.
__darwinAllowLocalNetworking = true;
} (
# skip extraction caching on Darwin, because nobody knows how Darwin works
(lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
# set up home with pre-unpacked bazel
@ -403,7 +428,10 @@ stdenv.mkDerivation rec {
export NIX_CFLAGS_COMPILE+=" -Wno-deprecated-builtins -Wno-gnu-offsetof-extensions"
# don't use system installed Xcode to run clang, use Nix clang instead
sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
sed -i -E \
-e "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
-e "s;/usr/bin/codesign;CODESIGN_ALLOCATE=${cctools}/bin/${cctools.targetPrefix}codesign_allocate ${sigtool}/bin/codesign;" \
-e "s;env -i codesign;env -i CODESIGN_ALLOCATE=${cctools}/bin/${cctools.targetPrefix}codesign_allocate ${sigtool}/bin/codesign;" \
scripts/bootstrap/compile.sh \
tools/osx/BUILD
@ -557,7 +585,7 @@ stdenv.mkDerivation rec {
which
zip
python3.pkgs.absl-py # Needed to build fish completion
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx sigtool CoreFoundation CoreServices Foundation ];
# Bazel makes extensive use of symlinks in the WORKSPACE.
# This causes problems with infinite symlinks if the build output is in the same location as the
@ -593,7 +621,10 @@ 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
'' +
# disable execlog parser on darwin, since it fails to build
# see https://github.com/NixOS/nixpkgs/pull/273774#issuecomment-1865322055
lib.optionalString (!stdenv.isDarwin) ''
# need to change directory for bazel to find the workspace
cd ./bazel_src
# build execlog tooling
@ -617,6 +648,10 @@ stdenv.mkDerivation rec {
wrapProgram $out/bin/bazel $wrapperfile --suffix PATH : ${defaultShellPath}
mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch}
'' +
# disable execlog parser on darwin, since it fails to build
# see https://github.com/NixOS/nixpkgs/pull/273774#issuecomment-1865322055
(lib.optionalString (!stdenv.isDarwin) ''
mkdir $out/share
cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar
cat <<EOF > $out/bin/bazel-execlog
@ -624,7 +659,7 @@ stdenv.mkDerivation rec {
${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@
EOF
chmod +x $out/bin/bazel-execlog
'') + ''
# shell completion files
installShellCompletion --bash \
--name bazel.bash \
@ -678,6 +713,13 @@ stdenv.mkDerivation rec {
# second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch}
hello_test
## Test that the GSON serialisation files are present
gson_classes=$(unzip -l $($out/bin/bazel info install_base)/A-server.jar | grep -F -c _GsonTypeAdapter.class)
if [ "$gson_classes" -lt 10 ]; then
echo "Missing GsonTypeAdapter classes in A-server.jar. Lockfile generation will not work"
exit 1
fi
runHook postInstall
'';

View file

@ -22,12 +22,11 @@
"https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz"
]
},
"20211102.0.tar.gz": {
"name": "20211102.0.tar.gz",
"sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
"20230802.0.tar.gz": {
"name": "20230802.0.tar.gz",
"sha256": "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz"
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz"
]
},
"2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz": {
@ -365,11 +364,10 @@
"generator_function": "dist_http_archive",
"generator_name": "com_google_absl",
"name": "com_google_absl",
"sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
"strip_prefix": "abseil-cpp-20211102.0",
"sha256": "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5",
"strip_prefix": "abseil-cpp-20230802.0",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz"
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz"
]
},
"com_google_googleapis": {
@ -1149,20 +1147,20 @@
"generator_function": "maybe",
"generator_name": "remote_java_tools",
"name": "remote_java_tools",
"sha256": "f58a358ca694a41416a9b6a92b852935ad301d8882e5d22f4f11134f035317d5",
"sha256": "aa11ecd5fc0af2769f0f2bdd25e2f4de7c1291ed24326fb23fa69bdd5dcae2b5",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools-v12.6.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools-v12.6.zip"
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools-v12.7.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools-v12.7.zip"
]
},
"remote_java_tools_darwin_arm64": {
"generator_function": "maybe",
"generator_name": "remote_java_tools_darwin_arm64",
"name": "remote_java_tools_darwin_arm64",
"sha256": "c6ffcaf87965c436cc86fc0e9673dafc97c0761efae8225ad2691cf6cfe3d87a",
"sha256": "ecedf6305768dfd51751d0ad732898af092bd7710d497c6c6c3214af7e49395f",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_darwin_arm64-v12.6.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_darwin_arm64-v12.6.zip"
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_darwin_arm64-v12.7.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_darwin_arm64-v12.7.zip"
]
},
"remote_java_tools_darwin_arm64_for_testing": {
@ -1187,10 +1185,10 @@
"generator_function": "maybe",
"generator_name": "remote_java_tools_darwin_x86_64",
"name": "remote_java_tools_darwin_x86_64",
"sha256": "c6545e82e543cb5775d3b8909d6270b5f481864b5ff083d20bfa5dcf77ac3ef7",
"sha256": "e116c649c0355ab57ffcc870ce1139e5e1528cabac458bd50263d2b84ea4ffb2",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_darwin_x86_64-v12.6.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_darwin_x86_64-v12.6.zip"
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_darwin_x86_64-v12.7.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_darwin_x86_64-v12.7.zip"
]
},
"remote_java_tools_darwin_x86_64_for_testing": {
@ -1233,10 +1231,10 @@
"generator_function": "maybe",
"generator_name": "remote_java_tools_linux",
"name": "remote_java_tools_linux",
"sha256": "64294e91fe940c77e6d35818b4c3a1f07d78e33add01e330188d907032687066",
"sha256": "a346b9a291b6db1bb06f7955f267e47522d99963fe14e337da1d75d125a8599f",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_linux-v12.6.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_linux-v12.6.zip"
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_linux-v12.7.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_linux-v12.7.zip"
]
},
"remote_java_tools_linux_for_testing": {
@ -1351,10 +1349,10 @@
"generator_function": "maybe",
"generator_name": "remote_java_tools_windows",
"name": "remote_java_tools_windows",
"sha256": "63f727d44011b8c504bb4e6d89c2cd982278efb34dae8629687e9483d8f7d62d",
"sha256": "bae6a03b5aeead5804ba7bcdcc8b14ec3ed05b37f3db5519f788ab060bc53b05",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_windows-v12.6.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_windows-v12.6.zip"
"https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_windows-v12.7.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_windows-v12.7.zip"
]
},
"remote_java_tools_windows_for_testing": {

View file

@ -213,7 +213,7 @@ stdenv.mkDerivation rec {
#
# See also ./bazel_darwin_sandbox.patch in bazel_5. That patch uses
# NIX_BUILD_TOP env var to conditionnally disable sleep features inside the
# sandbox. Oddly, bazel_6 does not need that patch :-/.
# sandbox.
#
# If you want to investigate the sandbox profile path,
# IORegisterForSystemPower can be allowed with

View file

@ -41,7 +41,7 @@ let
''));
testBazel = bazelTest {
name = "bazel-test-cpp";
name = "${bazel.pname}-test-cpp";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript = ''

View file

@ -41,7 +41,7 @@ let
''));
testBazel = bazelTest {
name = "bazel-test-java";
name = "${bazel.pname}-test-java";
inherit workspaceDir;
bazelPkg = bazel;
buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];

View file

@ -160,7 +160,7 @@ let
''));
testBazel = bazelTest {
name = "bazel-test-protocol-buffers";
name = "${bazel.pname}-test-protocol-buffers";
inherit workspaceDir;
bazelPkg = bazel;
buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];

View file

@ -71,7 +71,7 @@ let
''));
testBazel = bazelTest {
name = "bazel-test-builtin-rules";
name = "${bazel.pname}-test-builtin-rules";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript = ''

View file

@ -18189,7 +18189,7 @@ with pkgs;
};
bazel_6 = darwin.apple_sdk_11_0.callPackage ../development/tools/build-managers/bazel/bazel_6 {
inherit (darwin) cctools;
inherit (darwin) cctools sigtool;
inherit (darwin.apple_sdk_11_0.frameworks) CoreFoundation CoreServices Foundation;
buildJdk = jdk11_headless;
runJdk = jdk11_headless;