Merge pull request #283480 from avdv/bazel_6.5.0

bazel_6: 6.4.0 -> 6.5.0

authored by Mario Rodas and committed by GitHub 05d79f2a f12c9a1f

+135 -39
+56
pkgs/development/tools/build-managers/bazel/bazel_6/darwin_sleep.patch
··· 1 + diff --git a/src/main/native/darwin/sleep_prevention_jni.cc b/src/main/native/darwin/sleep_prevention_jni.cc 2 + index 67c35b201e..e50a58320e 100644 3 + --- a/src/main/native/darwin/sleep_prevention_jni.cc 4 + +++ b/src/main/native/darwin/sleep_prevention_jni.cc 5 + @@ -33,31 +33,13 @@ static int g_sleep_state_stack = 0; 6 + static IOPMAssertionID g_sleep_state_assertion = kIOPMNullAssertionID; 7 + 8 + int portable_push_disable_sleep() { 9 + - std::lock_guard<std::mutex> lock(g_sleep_state_mutex); 10 + - BAZEL_CHECK_GE(g_sleep_state_stack, 0); 11 + - if (g_sleep_state_stack == 0) { 12 + - BAZEL_CHECK_EQ(g_sleep_state_assertion, kIOPMNullAssertionID); 13 + - CFStringRef reasonForActivity = CFSTR("build.bazel"); 14 + - IOReturn success = IOPMAssertionCreateWithName( 15 + - kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity, 16 + - &g_sleep_state_assertion); 17 + - BAZEL_CHECK_EQ(success, kIOReturnSuccess); 18 + - } 19 + - g_sleep_state_stack += 1; 20 + - return 0; 21 + + // Unreliable, disable for now 22 + + return -1; 23 + } 24 + 25 + int portable_pop_disable_sleep() { 26 + - std::lock_guard<std::mutex> lock(g_sleep_state_mutex); 27 + - BAZEL_CHECK_GT(g_sleep_state_stack, 0); 28 + - g_sleep_state_stack -= 1; 29 + - if (g_sleep_state_stack == 0) { 30 + - BAZEL_CHECK_NE(g_sleep_state_assertion, kIOPMNullAssertionID); 31 + - IOReturn success = IOPMAssertionRelease(g_sleep_state_assertion); 32 + - BAZEL_CHECK_EQ(success, kIOReturnSuccess); 33 + - g_sleep_state_assertion = kIOPMNullAssertionID; 34 + - } 35 + - return 0; 36 + + // Unreliable, disable for now 37 + + return -1; 38 + } 39 + 40 + } // namespace blaze_jni 41 + diff --git a/src/main/native/darwin/system_suspension_monitor_jni.cc b/src/main/native/darwin/system_suspension_monitor_jni.cc 42 + index 3483aa7935..51782986ec 100644 43 + --- a/src/main/native/darwin/system_suspension_monitor_jni.cc 44 + +++ b/src/main/native/darwin/system_suspension_monitor_jni.cc 45 + @@ -83,10 +83,7 @@ void portable_start_suspend_monitoring() { 46 + // Register to receive system sleep notifications. 47 + // Testing needs to be done manually. Use the logging to verify 48 + // that sleeps are being caught here. 49 + - suspend_state.connect_port = IORegisterForSystemPower( 50 + - &suspend_state, &notifyPortRef, SleepCallBack, &notifierObject); 51 + - BAZEL_CHECK_NE(suspend_state.connect_port, MACH_PORT_NULL); 52 + - IONotificationPortSetDispatchQueue(notifyPortRef, queue); 53 + + // XXX: Unreliable, disable for now 54 + 55 + // Register to deal with SIGCONT. 56 + // We register for SIGCONT because we can't catch SIGSTOP.
+51 -9
pkgs/development/tools/build-managers/bazel/bazel_6/default.nix
··· 8 8 # updater 9 9 , python3, writeScript 10 10 # Apple dependencies 11 - , cctools, libcxx, CoreFoundation, CoreServices, Foundation 11 + , cctools, libcxx, CoreFoundation, CoreServices, Foundation, sigtool 12 12 # Allow to independently override the jdks used to build and run respectively 13 13 , buildJdk, runJdk 14 14 , runtimeShell ··· 25 25 }: 26 26 27 27 let 28 - version = "6.4.0"; 28 + version = "6.5.0"; 29 29 sourceRoot = "."; 30 30 31 31 src = fetchurl { 32 32 url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"; 33 - hash = "sha256-vYj/YCyLuynugroqaxKtCS1R7GaMZXf5Yo8Y5I/05R4="; 33 + hash = "sha256-/InakZQVKJ8p5P8YpeAScOzppv6Dy2CWchi6xKO7PtI="; 34 34 }; 35 35 36 36 # Update with ··· 179 179 180 180 in 181 181 stdenv.mkDerivation rec { 182 - pname = "bazel"; 182 + pname = "bazel${ lib.optionalString enableNixHacks "-hacks" }"; 183 183 inherit version; 184 184 185 185 meta = with lib; { ··· 205 205 # the prebuilt one does not work in nix world. 206 206 ./java_toolchain.patch 207 207 208 + # Bazel integrates with apple IOKit to inhibit and track system sleep. 209 + # Inside the darwin sandbox, these API calls are blocked, and bazel 210 + # crashes. It seems possible to allow these APIs inside the sandbox, but it 211 + # feels simpler to patch bazel not to use it at all. So our bazel is 212 + # incapable of preventing system sleep, which is a small price to pay to 213 + # guarantee that it will always run in any nix context. 214 + # 215 + # See also ./bazel_darwin_sandbox.patch in bazel_5. That patch uses 216 + # NIX_BUILD_TOP env var to conditionnally disable sleep features inside the 217 + # sandbox. 218 + # 219 + # If you want to investigate the sandbox profile path, 220 + # IORegisterForSystemPower can be allowed with 221 + # 222 + # propagatedSandboxProfile = '' 223 + # (allow iokit-open (iokit-user-client-class "RootDomainUserClient")) 224 + # ''; 225 + # 226 + # I do not know yet how to allow IOPMAssertion{CreateWithName,Release} 227 + ./darwin_sleep.patch 228 + 208 229 # On Darwin, the last argument to gcc is coming up as an empty string. i.e: '' 209 230 # This is breaking the build of any C target. This patch removes the last 210 231 # argument if it's found to be an empty string. ··· 289 310 bazelTest = { name, bazelScript, workspaceDir, bazelPkg, buildInputs ? [] }: 290 311 let 291 312 be = extracted bazelPkg; 292 - in runLocal name { inherit buildInputs; } ( 313 + in runLocal name { 314 + inherit buildInputs; 315 + # Necessary for the tests to pass on Darwin with sandbox enabled. 316 + __darwinAllowLocalNetworking = true; 317 + } ( 293 318 # skip extraction caching on Darwin, because nobody knows how Darwin works 294 319 (lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 295 320 # set up home with pre-unpacked bazel ··· 403 428 export NIX_CFLAGS_COMPILE+=" -Wno-deprecated-builtins -Wno-gnu-offsetof-extensions" 404 429 405 430 # don't use system installed Xcode to run clang, use Nix clang instead 406 - sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \ 431 + sed -i -E \ 432 + -e "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \ 433 + -e "s;/usr/bin/codesign;CODESIGN_ALLOCATE=${cctools}/bin/${cctools.targetPrefix}codesign_allocate ${sigtool}/bin/codesign;" \ 434 + -e "s;env -i codesign;env -i CODESIGN_ALLOCATE=${cctools}/bin/${cctools.targetPrefix}codesign_allocate ${sigtool}/bin/codesign;" \ 407 435 scripts/bootstrap/compile.sh \ 408 436 tools/osx/BUILD 409 437 ··· 557 585 which 558 586 zip 559 587 python3.pkgs.absl-py # Needed to build fish completion 560 - ] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ]; 588 + ] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx sigtool CoreFoundation CoreServices Foundation ]; 561 589 562 590 # Bazel makes extensive use of symlinks in the WORKSPACE. 563 591 # This causes problems with infinite symlinks if the build output is in the same location as the ··· 593 621 ${python3}/bin/python3 ./bazel_src/scripts/generate_fish_completion.py \ 594 622 --bazel=./bazel_src/output/bazel \ 595 623 --output=./bazel_src/output/bazel-complete.fish 596 - 624 + '' + 625 + # disable execlog parser on darwin, since it fails to build 626 + # see https://github.com/NixOS/nixpkgs/pull/273774#issuecomment-1865322055 627 + lib.optionalString (!stdenv.isDarwin) '' 597 628 # need to change directory for bazel to find the workspace 598 629 cd ./bazel_src 599 630 # build execlog tooling ··· 617 648 wrapProgram $out/bin/bazel $wrapperfile --suffix PATH : ${defaultShellPath} 618 649 mv ./bazel_src/output/bazel $out/bin/bazel-${version}-${system}-${arch} 619 650 651 + '' + 652 + # disable execlog parser on darwin, since it fails to build 653 + # see https://github.com/NixOS/nixpkgs/pull/273774#issuecomment-1865322055 654 + (lib.optionalString (!stdenv.isDarwin) '' 620 655 mkdir $out/share 621 656 cp ./bazel_src/bazel-bin/src/tools/execlog/parser_deploy.jar $out/share/parser_deploy.jar 622 657 cat <<EOF > $out/bin/bazel-execlog ··· 624 659 ${runJdk}/bin/java -jar $out/share/parser_deploy.jar \$@ 625 660 EOF 626 661 chmod +x $out/bin/bazel-execlog 627 - 662 + '') + '' 628 663 # shell completion files 629 664 installShellCompletion --bash \ 630 665 --name bazel.bash \ ··· 677 712 678 713 # second call succeeds because it defers to $out/bin/bazel-{version}-{os_arch} 679 714 hello_test 715 + 716 + ## Test that the GSON serialisation files are present 717 + gson_classes=$(unzip -l $($out/bin/bazel info install_base)/A-server.jar | grep -F -c _GsonTypeAdapter.class) 718 + if [ "$gson_classes" -lt 10 ]; then 719 + echo "Missing GsonTypeAdapter classes in A-server.jar. Lockfile generation will not work" 720 + exit 1 721 + fi 680 722 681 723 runHook postInstall 682 724 '';
+22 -24
pkgs/development/tools/build-managers/bazel/bazel_6/src-deps.json
··· 22 22 "https://github.com/bazelbuild/stardoc/archive/1ef781ced3b1443dca3ed05dec1989eca1a4e1cd.tar.gz" 23 23 ] 24 24 }, 25 - "20211102.0.tar.gz": { 26 - "name": "20211102.0.tar.gz", 27 - "sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4", 25 + "20230802.0.tar.gz": { 26 + "name": "20230802.0.tar.gz", 27 + "sha256": "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5", 28 28 "urls": [ 29 - "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz", 30 - "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz" 29 + "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz" 31 30 ] 32 31 }, 33 32 "2f9af297c84c55c8b871ba4495e01ade42476c92.tar.gz": { ··· 365 364 "generator_function": "dist_http_archive", 366 365 "generator_name": "com_google_absl", 367 366 "name": "com_google_absl", 368 - "sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4", 369 - "strip_prefix": "abseil-cpp-20211102.0", 367 + "sha256": "59d2976af9d6ecf001a81a35749a6e551a335b949d34918cfade07737b9d93c5", 368 + "strip_prefix": "abseil-cpp-20230802.0", 370 369 "urls": [ 371 - "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz", 372 - "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz" 370 + "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz" 373 371 ] 374 372 }, 375 373 "com_google_googleapis": { ··· 1149 1147 "generator_function": "maybe", 1150 1148 "generator_name": "remote_java_tools", 1151 1149 "name": "remote_java_tools", 1152 - "sha256": "f58a358ca694a41416a9b6a92b852935ad301d8882e5d22f4f11134f035317d5", 1150 + "sha256": "aa11ecd5fc0af2769f0f2bdd25e2f4de7c1291ed24326fb23fa69bdd5dcae2b5", 1153 1151 "urls": [ 1154 - "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools-v12.6.zip", 1155 - "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools-v12.6.zip" 1152 + "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools-v12.7.zip", 1153 + "https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools-v12.7.zip" 1156 1154 ] 1157 1155 }, 1158 1156 "remote_java_tools_darwin_arm64": { 1159 1157 "generator_function": "maybe", 1160 1158 "generator_name": "remote_java_tools_darwin_arm64", 1161 1159 "name": "remote_java_tools_darwin_arm64", 1162 - "sha256": "c6ffcaf87965c436cc86fc0e9673dafc97c0761efae8225ad2691cf6cfe3d87a", 1160 + "sha256": "ecedf6305768dfd51751d0ad732898af092bd7710d497c6c6c3214af7e49395f", 1163 1161 "urls": [ 1164 - "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_darwin_arm64-v12.6.zip", 1165 - "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_darwin_arm64-v12.6.zip" 1162 + "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_darwin_arm64-v12.7.zip", 1163 + "https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_darwin_arm64-v12.7.zip" 1166 1164 ] 1167 1165 }, 1168 1166 "remote_java_tools_darwin_arm64_for_testing": { ··· 1187 1185 "generator_function": "maybe", 1188 1186 "generator_name": "remote_java_tools_darwin_x86_64", 1189 1187 "name": "remote_java_tools_darwin_x86_64", 1190 - "sha256": "c6545e82e543cb5775d3b8909d6270b5f481864b5ff083d20bfa5dcf77ac3ef7", 1188 + "sha256": "e116c649c0355ab57ffcc870ce1139e5e1528cabac458bd50263d2b84ea4ffb2", 1191 1189 "urls": [ 1192 - "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_darwin_x86_64-v12.6.zip", 1193 - "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_darwin_x86_64-v12.6.zip" 1190 + "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_darwin_x86_64-v12.7.zip", 1191 + "https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_darwin_x86_64-v12.7.zip" 1194 1192 ] 1195 1193 }, 1196 1194 "remote_java_tools_darwin_x86_64_for_testing": { ··· 1233 1231 "generator_function": "maybe", 1234 1232 "generator_name": "remote_java_tools_linux", 1235 1233 "name": "remote_java_tools_linux", 1236 - "sha256": "64294e91fe940c77e6d35818b4c3a1f07d78e33add01e330188d907032687066", 1234 + "sha256": "a346b9a291b6db1bb06f7955f267e47522d99963fe14e337da1d75d125a8599f", 1237 1235 "urls": [ 1238 - "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_linux-v12.6.zip", 1239 - "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_linux-v12.6.zip" 1236 + "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_linux-v12.7.zip", 1237 + "https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_linux-v12.7.zip" 1240 1238 ] 1241 1239 }, 1242 1240 "remote_java_tools_linux_for_testing": { ··· 1351 1349 "generator_function": "maybe", 1352 1350 "generator_name": "remote_java_tools_windows", 1353 1351 "name": "remote_java_tools_windows", 1354 - "sha256": "63f727d44011b8c504bb4e6d89c2cd982278efb34dae8629687e9483d8f7d62d", 1352 + "sha256": "bae6a03b5aeead5804ba7bcdcc8b14ec3ed05b37f3db5519f788ab060bc53b05", 1355 1353 "urls": [ 1356 - "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_windows-v12.6.zip", 1357 - "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_windows-v12.6.zip" 1354 + "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.7/java_tools_windows-v12.7.zip", 1355 + "https://github.com/bazelbuild/java_tools/releases/download/java_v12.7/java_tools_windows-v12.7.zip" 1358 1356 ] 1359 1357 }, 1360 1358 "remote_java_tools_windows_for_testing": {
+1 -1
pkgs/development/tools/build-managers/bazel/bazel_7/default.nix
··· 213 213 # 214 214 # See also ./bazel_darwin_sandbox.patch in bazel_5. That patch uses 215 215 # NIX_BUILD_TOP env var to conditionnally disable sleep features inside the 216 - # sandbox. Oddly, bazel_6 does not need that patch :-/. 216 + # sandbox. 217 217 # 218 218 # If you want to investigate the sandbox profile path, 219 219 # IORegisterForSystemPower can be allowed with
+1 -1
pkgs/development/tools/build-managers/bazel/cpp-test.nix
··· 41 41 '')); 42 42 43 43 testBazel = bazelTest { 44 - name = "bazel-test-cpp"; 44 + name = "${bazel.pname}-test-cpp"; 45 45 inherit workspaceDir; 46 46 bazelPkg = bazel; 47 47 bazelScript = ''
+1 -1
pkgs/development/tools/build-managers/bazel/java-test.nix
··· 41 41 '')); 42 42 43 43 testBazel = bazelTest { 44 - name = "bazel-test-java"; 44 + name = "${bazel.pname}-test-java"; 45 45 inherit workspaceDir; 46 46 bazelPkg = bazel; 47 47 buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];
+1 -1
pkgs/development/tools/build-managers/bazel/protobuf-test.nix
··· 160 160 '')); 161 161 162 162 testBazel = bazelTest { 163 - name = "bazel-test-protocol-buffers"; 163 + name = "${bazel.pname}-test-protocol-buffers"; 164 164 inherit workspaceDir; 165 165 bazelPkg = bazel; 166 166 buildInputs = [ (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) ];
+1 -1
pkgs/development/tools/build-managers/bazel/python-bin-path-test.nix
··· 71 71 '')); 72 72 73 73 testBazel = bazelTest { 74 - name = "bazel-test-builtin-rules"; 74 + name = "${bazel.pname}-test-builtin-rules"; 75 75 inherit workspaceDir; 76 76 bazelPkg = bazel; 77 77 bazelScript = ''
+1 -1
pkgs/top-level/all-packages.nix
··· 18189 18189 }; 18190 18190 18191 18191 bazel_6 = darwin.apple_sdk_11_0.callPackage ../development/tools/build-managers/bazel/bazel_6 { 18192 - inherit (darwin) cctools; 18192 + inherit (darwin) cctools sigtool; 18193 18193 inherit (darwin.apple_sdk_11_0.frameworks) CoreFoundation CoreServices Foundation; 18194 18194 buildJdk = jdk11_headless; 18195 18195 runJdk = jdk11_headless;