From 036ae348e33150409e17f8ba95feb4bfd33f303b Mon Sep 17 00:00:00 2001 From: Dmitry Ivankov Date: Sun, 19 Jan 2025 13:58:59 +0100 Subject: [PATCH] bazel, bazel_7: move to pkgs/by-name/ba/ --- ci/OWNERS | 2 +- .../ba/bazel_7}/bazel_rc.patch | 0 .../ba}/bazel_7/darwin_sleep.patch | 0 .../ba}/bazel_7/java_toolchain.patch | 0 .../nix-build-bazel-package-hacks.patch | 0 .../ba/bazel_7/package.nix} | 6 +- .../ba/bazel_7}/strict_action_env.patch | 0 .../ba}/bazel_7/test_source_sort.patch | 0 .../trim-last-argument-to-gcc-if-empty.patch | 0 .../ba}/bazel_7/xcode_locator.patch | 0 .../tools/build-managers/bazel/README.md | 7 - .../build-managers/bazel/bash-tools-test.nix | 52 ----- .../tools/build-managers/bazel/cpp-test.nix | 62 ------ .../tools/build-managers/bazel/java-test.nix | 73 ------- .../build-managers/bazel/protobuf-test.nix | 194 ------------------ .../bazel/python-bin-path-test.nix | 89 -------- .../build-managers/bazel/shebang-test.nix | 62 ------ .../build-managers/bazel/update-srcDeps.py | 62 ------ pkgs/top-level/all-packages.nix | 2 +- 19 files changed, 5 insertions(+), 606 deletions(-) rename pkgs/{development/tools/build-managers/bazel => by-name/ba/bazel_7}/bazel_rc.patch (100%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba}/bazel_7/darwin_sleep.patch (100%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba}/bazel_7/java_toolchain.patch (100%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba}/bazel_7/nix-build-bazel-package-hacks.patch (100%) rename pkgs/{development/tools/build-managers/bazel/bazel_7/default.nix => by-name/ba/bazel_7/package.nix} (99%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba/bazel_7}/strict_action_env.patch (100%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba}/bazel_7/test_source_sort.patch (100%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba/bazel_7}/trim-last-argument-to-gcc-if-empty.patch (100%) rename pkgs/{development/tools/build-managers/bazel => by-name/ba}/bazel_7/xcode_locator.patch (100%) delete mode 100644 pkgs/development/tools/build-managers/bazel/README.md delete mode 100644 pkgs/development/tools/build-managers/bazel/bash-tools-test.nix delete mode 100644 pkgs/development/tools/build-managers/bazel/cpp-test.nix delete mode 100644 pkgs/development/tools/build-managers/bazel/java-test.nix delete mode 100644 pkgs/development/tools/build-managers/bazel/protobuf-test.nix delete mode 100644 pkgs/development/tools/build-managers/bazel/python-bin-path-test.nix delete mode 100644 pkgs/development/tools/build-managers/bazel/shebang-test.nix delete mode 100755 pkgs/development/tools/build-managers/bazel/update-srcDeps.py diff --git a/ci/OWNERS b/ci/OWNERS index 133517ed3a619..ff36987f0e3a2 100644 --- a/ci/OWNERS +++ b/ci/OWNERS @@ -337,7 +337,7 @@ pkgs/development/python-modules/buildcatrust/ @ajs124 @lukegb @mweinelt /pkgs/development/compilers/idris2 @mattpolzin # Bazel -/pkgs/development/tools/build-managers/bazel @Profpatsch +/pkgs/by-name/ba/bazel_7 @Profpatsch # NixOS modules for e-mail and dns services /nixos/modules/services/mail/mailman.nix @peti diff --git a/pkgs/development/tools/build-managers/bazel/bazel_rc.patch b/pkgs/by-name/ba/bazel_7/bazel_rc.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/bazel_rc.patch rename to pkgs/by-name/ba/bazel_7/bazel_rc.patch diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/darwin_sleep.patch b/pkgs/by-name/ba/bazel_7/darwin_sleep.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/bazel_7/darwin_sleep.patch rename to pkgs/by-name/ba/bazel_7/darwin_sleep.patch diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/java_toolchain.patch b/pkgs/by-name/ba/bazel_7/java_toolchain.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/bazel_7/java_toolchain.patch rename to pkgs/by-name/ba/bazel_7/java_toolchain.patch diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/nix-build-bazel-package-hacks.patch b/pkgs/by-name/ba/bazel_7/nix-build-bazel-package-hacks.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/bazel_7/nix-build-bazel-package-hacks.patch rename to pkgs/by-name/ba/bazel_7/nix-build-bazel-package-hacks.patch diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix b/pkgs/by-name/ba/bazel_7/package.nix similarity index 99% rename from pkgs/development/tools/build-managers/bazel/bazel_7/default.nix rename to pkgs/by-name/ba/bazel_7/package.nix index 7cd90a1f58225..539b563e10aae 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix +++ b/pkgs/by-name/ba/bazel_7/package.nix @@ -369,7 +369,7 @@ stdenv.mkDerivation rec { # 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. - ../trim-last-argument-to-gcc-if-empty.patch + ./trim-last-argument-to-gcc-if-empty.patch # --experimental_strict_action_env (which may one day become the default # see bazelbuild/bazel#2574) hardcodes the default @@ -377,13 +377,13 @@ stdenv.mkDerivation rec { # This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries. # So we are replacing this bazel paths by defaultShellPath, # improving hermeticity and making it work in nixos. - (replaceVars ../strict_action_env.patch { + (replaceVars ./strict_action_env.patch { strictActionEnvPatch = defaultShellPath; }) # bazel reads its system bazelrc in /etc # override this path to a builtin one - (replaceVars ../bazel_rc.patch { + (replaceVars ./bazel_rc.patch { bazelSystemBazelRCPath = bazelRC; }) ] diff --git a/pkgs/development/tools/build-managers/bazel/strict_action_env.patch b/pkgs/by-name/ba/bazel_7/strict_action_env.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/strict_action_env.patch rename to pkgs/by-name/ba/bazel_7/strict_action_env.patch diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/test_source_sort.patch b/pkgs/by-name/ba/bazel_7/test_source_sort.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/bazel_7/test_source_sort.patch rename to pkgs/by-name/ba/bazel_7/test_source_sort.patch diff --git a/pkgs/development/tools/build-managers/bazel/trim-last-argument-to-gcc-if-empty.patch b/pkgs/by-name/ba/bazel_7/trim-last-argument-to-gcc-if-empty.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/trim-last-argument-to-gcc-if-empty.patch rename to pkgs/by-name/ba/bazel_7/trim-last-argument-to-gcc-if-empty.patch diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/xcode_locator.patch b/pkgs/by-name/ba/bazel_7/xcode_locator.patch similarity index 100% rename from pkgs/development/tools/build-managers/bazel/bazel_7/xcode_locator.patch rename to pkgs/by-name/ba/bazel_7/xcode_locator.patch diff --git a/pkgs/development/tools/build-managers/bazel/README.md b/pkgs/development/tools/build-managers/bazel/README.md deleted file mode 100644 index 69ec0e30e1578..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# The Bazel build tool - -https://bazel.build/ - -The bazel tool requires regular maintenance, especially under darwin, so we created a maintainers team. - -Please ping @NixOS/bazel in your github PR/issue to increase your chance of a quick turnaround, thanks! diff --git a/pkgs/development/tools/build-managers/bazel/bash-tools-test.nix b/pkgs/development/tools/build-managers/bazel/bash-tools-test.nix deleted file mode 100644 index 6ca4aebcf3402..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/bash-tools-test.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - writeText, - bazel, - runLocal, - bazelTest, - distDir, - extraBazelArgs ? "", -}: - -# Tests that certain executables are available in bazel-executed bash shells. - -let - WORKSPACE = writeText "WORKSPACE" '' - workspace(name = "our_workspace") - ''; - - fileIn = writeText "input.txt" '' - one - two - three - ''; - - fileBUILD = writeText "BUILD" '' - genrule( - name = "tool_usage", - srcs = [ ":input.txt" ], - outs = [ "output.txt" ], - cmd = "cat $(location :input.txt) | gzip - | gunzip - | awk '/t/' > $@", - ) - ''; - - workspaceDir = runLocal "our_workspace" { } '' - mkdir $out - cp ${WORKSPACE} $out/WORKSPACE - cp ${fileIn} $out/input.txt - cp ${fileBUILD} $out/BUILD - ''; - - testBazel = bazelTest { - name = "bazel-test-bash-tools"; - bazelPkg = bazel; - inherit workspaceDir; - - bazelScript = '' - ${bazel}/bin/bazel build :tool_usage --distdir=${distDir} ${extraBazelArgs} - cp bazel-bin/output.txt $out - echo "Testing content" && [ "$(cat $out | wc -l)" == "2" ] && echo "OK" - ''; - }; - -in -testBazel diff --git a/pkgs/development/tools/build-managers/bazel/cpp-test.nix b/pkgs/development/tools/build-managers/bazel/cpp-test.nix deleted file mode 100644 index 6581331c7697c..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/cpp-test.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - bazel, - bazelTest, - bazel-examples, - stdenv, - cctools, - darwin, - extraBazelArgs ? "", - lib, - runLocal, - runtimeShell, - writeScript, - distDir, -}: - -let - - toolsBazel = writeScript "bazel" '' - #! ${runtimeShell} - - export CXX='${stdenv.cc}/bin/clang++' - export LD='${cctools}/bin/ld' - export LIBTOOL='${cctools}/bin/libtool' - export CC='${stdenv.cc}/bin/clang' - - # XXX: hack for macosX, this flags disable bazel usage of xcode - # See: https://github.com/bazelbuild/bazel/issues/4231 - export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 - - exec "$BAZEL_REAL" "$@" - ''; - - workspaceDir = runLocal "our_workspace" { } ( - '' - cp -r ${bazel-examples}/cpp-tutorial/stage3 $out - find $out -type d -exec chmod 755 {} \; - '' - + (lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir $out/tools - cp ${toolsBazel} $out/tools/bazel - '') - ); - - testBazel = bazelTest { - name = "${bazel.pname}-test-cpp"; - inherit workspaceDir; - bazelPkg = bazel; - bazelScript = '' - ${bazel}/bin/bazel build //... \ - --verbose_failures \ - --distdir=${distDir} \ - --curses=no \ - ${extraBazelArgs} \ - '' - + lib.optionalString (stdenv.hostPlatform.isDarwin) '' - --cxxopt=-x --cxxopt=c++ --host_cxxopt=-x --host_cxxopt=c++ \ - --linkopt=-stdlib=libc++ --host_linkopt=-stdlib=libc++ \ - ''; - }; - -in -testBazel diff --git a/pkgs/development/tools/build-managers/bazel/java-test.nix b/pkgs/development/tools/build-managers/bazel/java-test.nix deleted file mode 100644 index c3d94a7fd8e2f..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/java-test.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ - bazel, - bazelTest, - bazel-examples, - stdenv, - cctools, - extraBazelArgs ? "", - lib, - openjdk8, - jdk11_headless, - runLocal, - runtimeShell, - writeScript, - writeText, - distDir, -}: - -let - - toolsBazel = writeScript "bazel" '' - #! ${runtimeShell} - - export CXX='${stdenv.cc}/bin/clang++' - export LD='${cctools}/bin/ld' - export LIBTOOL='${cctools}/bin/libtool' - export CC='${stdenv.cc}/bin/clang' - - # XXX: hack for macosX, this flags disable bazel usage of xcode - # See: https://github.com/bazelbuild/bazel/issues/4231 - export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 - - exec "$BAZEL_REAL" "$@" - ''; - - workspaceDir = runLocal "our_workspace" { } ( - '' - cp -r ${bazel-examples}/java-tutorial $out - find $out -type d -exec chmod 755 {} \; - '' - + (lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir $out/tools - cp ${toolsBazel} $out/tools/bazel - '') - ); - - testBazel = bazelTest { - name = "${bazel.pname}-test-java"; - inherit workspaceDir; - bazelPkg = bazel; - buildInputs = [ - (if lib.strings.versionOlder bazel.version "5.0.0" then openjdk8 else jdk11_headless) - ]; - bazelScript = '' - ${bazel}/bin/bazel \ - run \ - --announce_rc \ - ${lib.optionalString (lib.strings.versionOlder "5.0.0" bazel.version) "--toolchain_resolution_debug='@bazel_tools//tools/jdk:(runtime_)?toolchain_type'"} \ - --distdir=${distDir} \ - --verbose_failures \ - --curses=no \ - --strict_java_deps=off \ - //:ProjectRunner \ - '' - + lib.optionalString (lib.strings.versionOlder bazel.version "5.0.0") '' - --host_javabase='@local_jdk//:jdk' \ - --java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \ - --javabase='@local_jdk//:jdk' \ - '' - + extraBazelArgs; - }; - -in -testBazel diff --git a/pkgs/development/tools/build-managers/bazel/protobuf-test.nix b/pkgs/development/tools/build-managers/bazel/protobuf-test.nix deleted file mode 100644 index 0cbcf2dae2aa1..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/protobuf-test.nix +++ /dev/null @@ -1,194 +0,0 @@ -{ - bazel, - bazelTest, - fetchFromGitHub, - fetchurl, - stdenv, - cctools, - lib, - openjdk8, - jdk11_headless, - runLocal, - runtimeShell, - writeScript, - writeText, - distDir, -}: - -let - com_google_protobuf = fetchFromGitHub { - owner = "protocolbuffers"; - repo = "protobuf"; - rev = "v3.13.0"; - sha256 = "1nqsvi2yfr93kiwlinz8z7c68ilg1j75b2vcpzxzvripxx5h6xhd"; - }; - - bazel_skylib = fetchFromGitHub { - owner = "bazelbuild"; - repo = "bazel-skylib"; - rev = "2ec2e6d715e993d96ad6222770805b5bd25399ae"; - sha256 = "1z2r2vx6kj102zvp3j032djyv99ski1x1sl4i3p6mswnzrzna86s"; - }; - - rules_python = fetchFromGitHub { - owner = "bazelbuild"; - repo = "rules_python"; - rev = "c8c79aae9aa1b61d199ad03d5fe06338febd0774"; - sha256 = "1zn58wv5wcylpi0xj7riw34i1jjpqahanxx8y9srwrv0v93b6pqz"; - }; - - rules_proto = fetchFromGitHub { - owner = "bazelbuild"; - repo = "rules_proto"; - rev = "a0761ed101b939e19d83b2da5f59034bffc19c12"; - sha256 = "09lqfj5fxm1fywxr5w8pnpqd859gb6751jka9fhxjxjzs33glhqf"; - }; - - net_zlib = fetchurl rec { - url = "https://zlib.net/zlib-1.2.11.tar.gz"; - sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"; - - passthru.sha256 = sha256; - }; - - WORKSPACE = writeText "WORKSPACE" '' - workspace(name = "our_workspace") - - load("//:proto-support.bzl", "protobuf_deps") - protobuf_deps() - load("@rules_proto//proto:repositories.bzl", "rules_proto_toolchains") - rules_proto_toolchains() - ''; - - protoSupport = writeText "proto-support.bzl" '' - """Load dependencies needed to compile the protobuf library as a 3rd-party consumer.""" - - load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - - def protobuf_deps(): - """Loads common dependencies needed to compile the protobuf library.""" - - if "zlib" not in native.existing_rules(): - # proto_library, cc_proto_library, and java_proto_library rules implicitly - # depend on @com_google_protobuf for protoc and proto runtimes. - # This statement defines the @com_google_protobuf repo. - native.local_repository( - name = "com_google_protobuf", - path = "${com_google_protobuf}", - ) - native.local_repository( - name = "bazel_skylib", - path = "${bazel_skylib}", - ) - native.local_repository( - name = "rules_proto", - path = "${rules_proto}", - ) - native.local_repository( - name = "rules_python", - path = "${rules_python}", - ) - - http_archive( - name = "zlib", - build_file = "@com_google_protobuf//:third_party/zlib.BUILD", - sha256 = "${net_zlib.sha256}", - strip_prefix = "zlib-1.2.11", - urls = ["file://${net_zlib}"], - ) - ''; - - personProto = writeText "person.proto" '' - syntax = "proto3"; - - package person; - - message Person { - string name = 1; - int32 id = 2; - string email = 3; - } - ''; - - personBUILD = writeText "BUILD" '' - load("@rules_proto//proto:defs.bzl", "proto_library") - - proto_library( - name = "person_proto", - srcs = ["person.proto"], - visibility = ["//visibility:public"], - ) - - java_proto_library( - name = "person_java_proto", - deps = [":person_proto"], - ) - - cc_proto_library( - name = "person_cc_proto", - deps = [":person_proto"], - ) - ''; - - toolsBazel = writeScript "bazel" '' - #! ${runtimeShell} - - export CXX='${stdenv.cc}/bin/clang++' - export LD='${cctools}/bin/ld' - export LIBTOOL='${cctools}/bin/libtool' - export CC='${stdenv.cc}/bin/clang' - - # XXX: hack for macosX, this flags disable bazel usage of xcode - # See: https://github.com/bazelbuild/bazel/issues/4231 - export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 - - exec "$BAZEL_REAL" "$@" - ''; - - workspaceDir = runLocal "our_workspace" { } ( - '' - mkdir $out - cp ${WORKSPACE} $out/WORKSPACE - touch $out/BUILD.bazel - cp ${protoSupport} $out/proto-support.bzl - mkdir $out/person - cp ${personProto} $out/person/person.proto - cp ${personBUILD} $out/person/BUILD.bazel - '' - + (lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir $out/tools - cp ${toolsBazel} $out/tools/bazel - '') - ); - - testBazel = bazelTest { - 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) - ]; - bazelScript = '' - ${bazel}/bin/bazel \ - build \ - --distdir=${distDir} \ - --verbose_failures \ - --curses=no \ - --subcommands \ - --strict_java_deps=off \ - --strict_proto_deps=off \ - //... \ - '' - + lib.optionalString (lib.strings.versionOlder bazel.version "5.0.0") '' - --host_javabase='@local_jdk//:jdk' \ - --java_toolchain='@bazel_tools//tools/jdk:toolchain_hostjdk8' \ - --javabase='@local_jdk//:jdk' \ - '' - + lib.optionalString (stdenv.hostPlatform.isDarwin) '' - --cxxopt=-x --cxxopt=c++ --host_cxxopt=-x --host_cxxopt=c++ \ - --linkopt=-stdlib=libc++ --host_linkopt=-stdlib=libc++ \ - ''; - }; - -in -testBazel diff --git a/pkgs/development/tools/build-managers/bazel/python-bin-path-test.nix b/pkgs/development/tools/build-managers/bazel/python-bin-path-test.nix deleted file mode 100644 index 4af2940d80c29..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/python-bin-path-test.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ - bazel, - bazelTest, - stdenv, - cctools, - extraBazelArgs ? "", - lib, - runLocal, - runtimeShell, - writeScript, - writeText, - distDir, -}: - -let - toolsBazel = writeScript "bazel" '' - #! ${runtimeShell} - - export CXX='${stdenv.cc}/bin/clang++' - export LD='${cctools}/bin/ld' - export LIBTOOL='${cctools}/bin/libtool' - export CC='${stdenv.cc}/bin/clang' - - # XXX: hack for macosX, this flags disable bazel usage of xcode - # See: https://github.com/bazelbuild/bazel/issues/4231 - export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 - - exec "$BAZEL_REAL" "$@" - ''; - - WORKSPACE = writeText "WORKSPACE" '' - workspace(name = "our_workspace") - ''; - - pythonLib = writeText "lib.py" '' - def foo(): - return 43 - ''; - - pythonBin = writeText "bin.py" '' - from lib import foo - - assert foo() == 43 - ''; - - pythonBUILD = writeText "BUILD" '' - py_library( - name = "lib", - srcs = [ "lib.py" ], - ) - - py_binary( - name = "bin", - srcs = [ "bin.py" ], - imports = [ "." ], - deps = [ ":lib" ], - ) - ''; - - workspaceDir = runLocal "our_workspace" { } ( - '' - mkdir $out - cp ${WORKSPACE} $out/WORKSPACE - mkdir $out/python - cp ${pythonLib} $out/python/lib.py - cp ${pythonBin} $out/python/bin.py - cp ${pythonBUILD} $out/python/BUILD.bazel - '' - + (lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir $out/tools - cp ${toolsBazel} $out/tools/bazel - '') - ); - - testBazel = bazelTest { - name = "${bazel.pname}-test-builtin-rules"; - inherit workspaceDir; - bazelPkg = bazel; - bazelScript = '' - ${bazel}/bin/bazel \ - run \ - --distdir=${distDir} \ - ${extraBazelArgs} \ - //python:bin - ''; - }; - -in -testBazel diff --git a/pkgs/development/tools/build-managers/bazel/shebang-test.nix b/pkgs/development/tools/build-managers/bazel/shebang-test.nix deleted file mode 100644 index fe12cf4de8812..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/shebang-test.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - bazel, - bazelTest, - extracted, - ripgrep, - runLocal, - unzip, - ... -}: - -# Tests that all shebangs are patched appropriately. -# #!/usr/bin/... should be replaced by Nix store references. -# #!.../bin/env python should be replaced by Nix store reference to the python interpreter. - -let - - workspaceDir = runLocal "our_workspace" { } "mkdir $out"; - - testBazel = bazelTest { - name = "bazel-test-shebangs"; - inherit workspaceDir; - bazelPkg = bazel; - bazelScript = '' - set -ueo pipefail - FAIL= - check_shebangs() { - local dir="$1" - { rg -e '#!/usr/bin' -e '#![^[:space:]]*/bin/env' $dir -e && echo && FAIL=1; } || true - } - extract() { - local dir="$1" - find "$dir" -type f '(' -name '*.zip' -or -name '*.jar' ')' -print0 \ - | while IFS="" read -r -d "" zip ; do - echo "Extracting $zip" - local unzipped="$zip-UNPACKED" - mkdir -p "$unzipped" - unzip -qq $zip -d "$unzipped" - extract "$unzipped" - rm -rf "$unzipped" "$zip" || true - done - check_shebangs "$dir" - } - - mkdir install_root - cp --no-preserve=all -r ${extracted bazel}/install/*/* install_root/ - extract ./install_root - - if [[ $FAIL = 1 ]]; then - echo "Found files in the bazel distribution with illegal shebangs." >&2 - echo "Replace those by explicit Nix store paths." >&2 - echo "Python scripts should not use \`bin/env python' but the Python interpreter's store path." >&2 - exit 1 - fi - ''; - buildInputs = [ - unzip - ripgrep - ]; - }; - -in -testBazel diff --git a/pkgs/development/tools/build-managers/bazel/update-srcDeps.py b/pkgs/development/tools/build-managers/bazel/update-srcDeps.py deleted file mode 100755 index 4105aeeb11bc2..0000000000000 --- a/pkgs/development/tools/build-managers/bazel/update-srcDeps.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -import sys -import json - -if len(sys.argv) == 1: - print("usage: ./this-script WORKSPACE", file=sys.stderr) - print("Takes the bazel WORKSPACE file and reads all archives into a json dict (by evaling it as python code)", file=sys.stderr) - print("Hail Eris.", file=sys.stderr) - sys.exit(1) - -http_archives = [] - -# just the kw args are the dict { name, sha256, urls … } -def http_archive(**kw): - http_archives.append(kw) -# like http_file -def http_file(**kw): - http_archives.append(kw) - -# this is inverted from http_archive/http_file and bundles multiple archives -def distdir_tar(**kw): - for archive_name in kw['archives']: - http_archives.append({ - "name": archive_name, - "sha256": kw['sha256'][archive_name], - "urls": kw['urls'][archive_name] - }) - -# stubs for symbols we are not interested in -# might need to be expanded if new bazel releases add symbols to the workspace -def workspace(name): pass -def load(*args): pass -def bind(**kw): pass -def list_source_repository(**kw): pass -def new_local_repository(**kw): pass -def local_repository(**kw): pass -DOC_VERSIONS = [] -def stardoc_repositories(**kw): pass -def skydoc_repositories(**kw): pass -def rules_sass_dependencies(**kw): pass -def node_repositories(**kw): pass -def sass_repositories(**kw): pass -def register_execution_platforms(*args): pass -def rbe_autoconfig(*args, **kw): pass -def rules_pkg_dependencies(*args, **kw): pass -def winsdk_configure(*args, **kw): pass -def register_local_rc_exe_toolchains(*args, **kw): pass -def register_toolchains(*args, **kw): pass -def debian_deps(): pass -def grpc_deps(): pass -def grpc_extra_deps(): pass -def bazel_skylib_workspace(): pass - -# execute the WORKSPACE like it was python code in this module, -# using all the function stubs from above. -with open(sys.argv[1]) as f: - exec(f.read()) - -# transform to a dict with the names as keys -d = { el['name']: el for el in http_archives } - -print(json.dumps(d, sort_keys=True, indent=4)) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f89c99011e65d..5768ec0cda0f3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6552,7 +6552,7 @@ with pkgs; bazel = bazel_7; - bazel_7 = callPackage ../development/tools/build-managers/bazel/bazel_7 { + bazel_7 = callPackage ../by-name/ba/bazel_7/package.nix { inherit (darwin) sigtool; buildJdk = jdk21_headless; runJdk = jdk21_headless;