mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 12:45:27 +03:00
bazel_7: Separate test deps (without binaries)
This commit is contained in:
parent
b09a742323
commit
7051773ca8
2 changed files with 21 additions and 9 deletions
|
@ -52,24 +52,26 @@ let
|
||||||
# }
|
# }
|
||||||
let
|
let
|
||||||
attrs = value.attributes;
|
attrs = value.attributes;
|
||||||
entry = hash: urls: {
|
entry = hash: urls: name: {
|
||||||
${hash} = fetchurl {
|
${hash} = fetchurl {
|
||||||
name = "source"; # just like fetch*, to get some deduplication
|
name = "source"; # just like fetch*, to get some deduplication
|
||||||
inherit urls;
|
inherit urls;
|
||||||
sha256 = hash;
|
sha256 = hash;
|
||||||
passthru.sha256 = hash;
|
passthru.sha256 = hash;
|
||||||
|
passthru.source_name = name;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
insert = acc: hash: urls:
|
insert = acc: hash: urls: name:
|
||||||
acc // entry (sanitize hash) (map sanitize urls);
|
acc // entry (sanitize hash) (map sanitize urls) (sanitize name);
|
||||||
accWithRemotePatches = lib.foldlAttrs
|
accWithRemotePatches = lib.foldlAttrs
|
||||||
(acc: url: hash: insert acc hash [ url ])
|
(acc: url: hash: insert acc hash [ url ] attrs.name)
|
||||||
acc
|
acc
|
||||||
(attrs.remote_patches or { });
|
(attrs.remote_patches or { });
|
||||||
accWithNewSource = insert
|
accWithNewSource = insert
|
||||||
accWithRemotePatches
|
accWithRemotePatches
|
||||||
(attrs.integrity or attrs.sha256)
|
(attrs.integrity or attrs.sha256)
|
||||||
(attrs.urls or [ attrs.url ]);
|
(attrs.urls or [ attrs.url ])
|
||||||
|
attrs.name;
|
||||||
in
|
in
|
||||||
if builtins.isAttrs value && value ? attributes
|
if builtins.isAttrs value && value ? attributes
|
||||||
&& (attrs ? sha256 || attrs ? integrity)
|
&& (attrs ? sha256 || attrs ? integrity)
|
||||||
|
@ -86,7 +88,7 @@ let
|
||||||
# TODO: Do not re-hash. Use nix-hash to convert hashes
|
# TODO: Do not re-hash. Use nix-hash to convert hashes
|
||||||
(drv: ''
|
(drv: ''
|
||||||
filename=$(basename "${lib.head drv.urls}")
|
filename=$(basename "${lib.head drv.urls}")
|
||||||
echo Bundling $filename
|
echo Bundling $filename ${lib.optionalString (drv?source_name) "from ${drv.source_name}"}
|
||||||
hash=$(${rnix-hashes}/bin/rnix-hashes --encoding BASE16 ${drv.sha256} | cut -f 2)
|
hash=$(${rnix-hashes}/bin/rnix-hashes --encoding BASE16 ${drv.sha256} | cut -f 2)
|
||||||
mkdir -p content_addressable/sha256/$hash
|
mkdir -p content_addressable/sha256/$hash
|
||||||
ln -sfn ${drv} content_addressable/sha256/$hash/file
|
ln -sfn ${drv} content_addressable/sha256/$hash/file
|
||||||
|
|
|
@ -82,6 +82,15 @@ let
|
||||||
null != builtins.match "rules_java~.*~toolchains~remote_java_tools" name;
|
null != builtins.match "rules_java~.*~toolchains~remote_java_tools" name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Two-in-one format
|
||||||
|
testRepoCache = callPackage ./bazel-repository-cache.nix {
|
||||||
|
inherit lockfile;
|
||||||
|
# We use the release tarball that already has everything bundled,
|
||||||
|
# But we need one extra dep required by our nonprebuilt java toolchains.
|
||||||
|
requiredDepNamePredicate = name:
|
||||||
|
null == builtins.match ".*(macos|osx|linux|win|apple|android).*" name;
|
||||||
|
};
|
||||||
|
|
||||||
defaultShellUtils =
|
defaultShellUtils =
|
||||||
# Keep this list conservative. For more exotic tools, prefer to use
|
# Keep this list conservative. For more exotic tools, prefer to use
|
||||||
# @rules_nixpkgs to pull in tools from the nix repository. Example:
|
# @rules_nixpkgs to pull in tools from the nix repository. Example:
|
||||||
|
@ -331,7 +340,6 @@ stdenv.mkDerivation rec {
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# -e "s,%{cc},${stdenv.cc}/bin/clang,g" \
|
|
||||||
genericPatches = ''
|
genericPatches = ''
|
||||||
# unzip builtins_bzl.zip so the contents get patched
|
# unzip builtins_bzl.zip so the contents get patched
|
||||||
builtins_bzl=src/main/java/com/google/devtools/build/lib/bazel/rules/builtins_bzl
|
builtins_bzl=src/main/java/com/google/devtools/build/lib/bazel/rules/builtins_bzl
|
||||||
|
@ -611,11 +619,13 @@ stdenv.mkDerivation rec {
|
||||||
#
|
#
|
||||||
# in the nixpkgs checkout root to exercise them locally.
|
# in the nixpkgs checkout root to exercise them locally.
|
||||||
tests = callPackage ./tests.nix {
|
tests = callPackage ./tests.nix {
|
||||||
inherit Foundation bazel_self distDir repoCache runJdk;
|
inherit Foundation bazel_self runJdk;
|
||||||
|
distDir = testRepoCache;
|
||||||
|
repoCache = testRepoCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
updater = throw "TODO";
|
updater = throw "TODO";
|
||||||
|
|
||||||
inherit distDir repoCache;
|
inherit distDir repoCache testRepoCache;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue