fix(tvix/utils): Optionally add support for Cargo in filterRustCrateSrc
Previously we would unconditionally add Cargo.toml to the fileset. We
mostly use buildRustCrate in tvix so it does not make sense to add it by
default, instead I made it so you enable cargoSupport if you want
Cargo.{toml,lock} to be added to the fileset.
Change-Id: I5a6016534fc5599e85ab581fe3d9b81e7a24f940
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11950
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
This commit is contained in:
parent
fc63594631
commit
63654fbeb1
2 changed files with 7 additions and 5 deletions
|
|
@ -22,21 +22,23 @@
|
|||
(powerset features));
|
||||
|
||||
# Filters the given source, only keeping files related to the build, preventing unnecessary rebuilds.
|
||||
# Includes src in the root, all other .rs files, as well as Cargo.toml.
|
||||
# Includes src in the root, all other .rs files and optionally Cargo specific files.
|
||||
# Additional files to be included can be specified in extraFileset.
|
||||
filterRustCrateSrc =
|
||||
{ root # The original src
|
||||
, extraFileset ? null # Additional filesets to include (e.g. fileFilter for proto files)
|
||||
, cargoSupport ? false
|
||||
}:
|
||||
lib.fileset.toSource {
|
||||
inherit root;
|
||||
fileset = (lib.fileset.intersection
|
||||
fileset = lib.fileset.intersection
|
||||
(lib.fileset.fromSource root) # We build our final fileset from the original src
|
||||
(lib.fileset.unions ([
|
||||
(root + "/src")
|
||||
(lib.fileset.fileFilter (f: f.hasExt "rs") root)
|
||||
# We assume that every Rust crate will at a minimum have .rs files and a Cargo.toml
|
||||
] ++ lib.optionals cargoSupport [
|
||||
(lib.fileset.fileFilter (f: f.name == "Cargo.toml") root)
|
||||
] ++ lib.optional (extraFileset != null) extraFileset)));
|
||||
(lib.fileset.maybeMissing (root + "/Cargo.lock"))
|
||||
] ++ lib.optional (extraFileset != null) extraFileset));
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ let
|
|||
|
||||
[dependencies.tvix-eval]
|
||||
-path = "../../tvix/eval"
|
||||
+path = "${depot.tvix.crates.workspaceMembers.tvix-eval.build.src}"
|
||||
+path = "${../../tvix/eval}"
|
||||
default-features = false
|
||||
|
||||
[dependencies.serde]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue