bazel_7: Separate test deps (without binaries)

+21 -9
+8 -6
pkgs/development/tools/build-managers/bazel/bazel_7/bazel-repository-cache.nix
··· 52 # } 53 let 54 attrs = value.attributes; 55 - entry = hash: urls: { 56 ${hash} = fetchurl { 57 name = "source"; # just like fetch*, to get some deduplication 58 inherit urls; 59 sha256 = hash; 60 passthru.sha256 = hash; 61 }; 62 }; 63 - insert = acc: hash: urls: 64 - acc // entry (sanitize hash) (map sanitize urls); 65 accWithRemotePatches = lib.foldlAttrs 66 - (acc: url: hash: insert acc hash [ url ]) 67 acc 68 (attrs.remote_patches or { }); 69 accWithNewSource = insert 70 accWithRemotePatches 71 (attrs.integrity or attrs.sha256) 72 - (attrs.urls or [ attrs.url ]); 73 in 74 if builtins.isAttrs value && value ? attributes 75 && (attrs ? sha256 || attrs ? integrity) ··· 86 # TODO: Do not re-hash. Use nix-hash to convert hashes 87 (drv: '' 88 filename=$(basename "${lib.head drv.urls}") 89 - echo Bundling $filename 90 hash=$(${rnix-hashes}/bin/rnix-hashes --encoding BASE16 ${drv.sha256} | cut -f 2) 91 mkdir -p content_addressable/sha256/$hash 92 ln -sfn ${drv} content_addressable/sha256/$hash/file
··· 52 # } 53 let 54 attrs = value.attributes; 55 + entry = hash: urls: name: { 56 ${hash} = fetchurl { 57 name = "source"; # just like fetch*, to get some deduplication 58 inherit urls; 59 sha256 = hash; 60 passthru.sha256 = hash; 61 + passthru.source_name = name; 62 }; 63 }; 64 + insert = acc: hash: urls: name: 65 + acc // entry (sanitize hash) (map sanitize urls) (sanitize name); 66 accWithRemotePatches = lib.foldlAttrs 67 + (acc: url: hash: insert acc hash [ url ] attrs.name) 68 acc 69 (attrs.remote_patches or { }); 70 accWithNewSource = insert 71 accWithRemotePatches 72 (attrs.integrity or attrs.sha256) 73 + (attrs.urls or [ attrs.url ]) 74 + attrs.name; 75 in 76 if builtins.isAttrs value && value ? attributes 77 && (attrs ? sha256 || attrs ? integrity) ··· 88 # TODO: Do not re-hash. Use nix-hash to convert hashes 89 (drv: '' 90 filename=$(basename "${lib.head drv.urls}") 91 + echo Bundling $filename ${lib.optionalString (drv?source_name) "from ${drv.source_name}"} 92 hash=$(${rnix-hashes}/bin/rnix-hashes --encoding BASE16 ${drv.sha256} | cut -f 2) 93 mkdir -p content_addressable/sha256/$hash 94 ln -sfn ${drv} content_addressable/sha256/$hash/file
+13 -3
pkgs/development/tools/build-managers/bazel/bazel_7/default.nix
··· 82 null != builtins.match "rules_java~.*~toolchains~remote_java_tools" name; 83 }; 84 85 defaultShellUtils = 86 # Keep this list conservative. For more exotic tools, prefer to use 87 # @rules_nixpkgs to pull in tools from the nix repository. Example: ··· 331 done 332 ''; 333 334 - # -e "s,%{cc},${stdenv.cc}/bin/clang,g" \ 335 genericPatches = '' 336 # unzip builtins_bzl.zip so the contents get patched 337 builtins_bzl=src/main/java/com/google/devtools/build/lib/bazel/rules/builtins_bzl ··· 611 # 612 # in the nixpkgs checkout root to exercise them locally. 613 tests = callPackage ./tests.nix { 614 - inherit Foundation bazel_self distDir repoCache runJdk; 615 }; 616 617 updater = throw "TODO"; 618 619 - inherit distDir repoCache; 620 }; 621 }
··· 82 null != builtins.match "rules_java~.*~toolchains~remote_java_tools" name; 83 }; 84 85 + # Two-in-one format 86 + testRepoCache = callPackage ./bazel-repository-cache.nix { 87 + inherit lockfile; 88 + # We use the release tarball that already has everything bundled, 89 + # But we need one extra dep required by our nonprebuilt java toolchains. 90 + requiredDepNamePredicate = name: 91 + null == builtins.match ".*(macos|osx|linux|win|apple|android).*" name; 92 + }; 93 + 94 defaultShellUtils = 95 # Keep this list conservative. For more exotic tools, prefer to use 96 # @rules_nixpkgs to pull in tools from the nix repository. Example: ··· 340 done 341 ''; 342 343 genericPatches = '' 344 # unzip builtins_bzl.zip so the contents get patched 345 builtins_bzl=src/main/java/com/google/devtools/build/lib/bazel/rules/builtins_bzl ··· 619 # 620 # in the nixpkgs checkout root to exercise them locally. 621 tests = callPackage ./tests.nix { 622 + inherit Foundation bazel_self runJdk; 623 + distDir = testRepoCache; 624 + repoCache = testRepoCache; 625 }; 626 627 updater = throw "TODO"; 628 629 + inherit distDir repoCache testRepoCache; 630 }; 631 }