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