refactor(readTree): Pass all readTree parameters as function args

Instead of having a mix of depot-passed args (for the filter) and args
to the readTree function itself, make everything a single attribute
set of arguments passed to the function.

This also makes it a bit easier to extend this in the future.

Change-Id: I633c1fc96026d137b451bb604ef92be32571a0f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3498
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2021-09-08 18:16:11 +03:00 committed by tazjin
parent 4c4aa8e413
commit aedde913d1
4 changed files with 53 additions and 24 deletions

View file

@ -56,8 +56,10 @@ let
};
};
readTree' = import ./nix/readTree {
argsFilter = depotArgsFilter;
readDepot = depotArgs: import ./nix/readTree {} {
args = depotArgs;
path = ./.;
filter = depotArgsFilter;
};
# To determine build targets, we walk through the depot tree and
@ -91,7 +93,7 @@ let
(node.meta.targets or []))
else [];
in fix(self: (readTree' {
in fix(self: (readDepot {
depot = self;
# Pass third_party as 'pkgs' (for compatibility with external
@ -107,7 +109,7 @@ in fix(self: (readTree' {
# Note that it is intended for exceptional circumstance, such as
# debugging by bisecting nixpkgs.
externalArgs = args;
} ./.) // {
}) // {
# Make the path to the depot available for things that might need it
# (e.g. NixOS module inclusions)
path = ./.;