mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
filter out test folders in nix build
This commit is contained in:
parent
2c8c1e0ced
commit
3fed1ba129
2 changed files with 35 additions and 14 deletions
|
@ -1,6 +1,5 @@
|
||||||
mod frame;
|
mod frame;
|
||||||
mod instance;
|
mod instance;
|
||||||
mod tests;
|
|
||||||
mod value_store;
|
mod value_store;
|
||||||
pub mod wasi;
|
pub mod wasi;
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,31 @@ let
|
||||||
|
|
||||||
repoRoot = ../.;
|
repoRoot = ../.;
|
||||||
|
|
||||||
|
# The file set api does not currently have a way to easily remove folders dynamically
|
||||||
|
# since the nix build does not run tests try to remove any folders with just tests
|
||||||
|
removedTests =
|
||||||
|
let
|
||||||
|
dir_filter = path_str: (
|
||||||
|
let dirName = baseNameOf path_str; in !(
|
||||||
|
# remove any folder whos name is `tests` or starts with `test_`
|
||||||
|
dirName == "tests"
|
||||||
|
|
||||||
# "old" way of filtering files that fileset does not support yet
|
# TODO: while the below logic seems to work to filter out folders,
|
||||||
# remove anything ignored by git
|
# cargo still cares if the path exists (even for dev) :(
|
||||||
# baseSrc = nix-gitignore.gitignoreSource [ ] repoRoot;
|
# || lib.strings.hasPrefix "test_" dirName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
removeTestFiler =
|
||||||
|
path: type:
|
||||||
|
# only do a "real" check on directory, allow everything else through
|
||||||
|
(type == "directory" && dir_filter path)
|
||||||
|
|| type != "directory";
|
||||||
|
in
|
||||||
|
lib.sources.cleanSourceWith { src = repoRoot; filter = removeTestFiler; };
|
||||||
|
fsBase = fs.fromSource removedTests;
|
||||||
|
|
||||||
|
# fsBase = fs.fromSource repoRoot;
|
||||||
|
|
||||||
fsBase = fs.fromSource repoRoot;
|
|
||||||
|
|
||||||
|
|
||||||
# only look at files in the crates folder
|
# only look at files in the crates folder
|
||||||
|
@ -37,24 +56,27 @@ let
|
||||||
includeCargoRootFiles
|
includeCargoRootFiles
|
||||||
(fs.fileFilter (fileDoesNotHaveExt extensionsToRemove) repoRoot);
|
(fs.fileFilter (fileDoesNotHaveExt extensionsToRemove) repoRoot);
|
||||||
|
|
||||||
# the above filter can make the doc crate sad since it deals with pictures
|
# the above filter can make the doc crate sad since it has pictures
|
||||||
docsAddedBack = fs.unions [
|
docsAddedBack = fs.unions [
|
||||||
../crates/docs
|
../crates/docs
|
||||||
removedSimpleFiles
|
removedSimpleFiles
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# ===============================
|
||||||
#
|
|
||||||
# If you are trying to see what is ok to exclude from the "main" builds (cli/lang_server)
|
# If you are trying to see what is ok to exclude from the "main" builds (cli/lang_server)
|
||||||
# use `cargo tree` https://doc.rust-lang.org/cargo/commands/cargo-tree.html
|
# use `cargo tree` https://doc.rust-lang.org/cargo/commands/cargo-tree.html
|
||||||
#
|
#
|
||||||
# Ex: `cargo tree -i roc_build` will show all deps of the `roc_build` crate
|
# Ex: `cargo tree -i roc_build` will show all deps of the `roc_build` crate
|
||||||
# if only the package passed with `-i` is shown, nothing depends on it
|
# if only the package passed with `-i` is shown, nothing depends on it
|
||||||
|
# ===============================
|
||||||
|
|
||||||
in
|
|
||||||
fs.toSource {
|
filteredSrc = fs.toSource {
|
||||||
root = repoRoot;
|
root = repoRoot;
|
||||||
# to debug you can switch to
|
# to debug you can switch to
|
||||||
# fileset = fs.traceVal <file set>
|
# fileset = fs.traceVal <file set>
|
||||||
fileset = docsAddedBack;
|
fileset = docsAddedBack;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
filteredSrc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue