package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.file/B0_srcs/index.html
Module B0_srcsSource
Select source files.
FIXME. This will need a few more design rounds. Here are a few things:
- Review w.r.t.
b0. - We likely want combinators represenging
sels and producingtand ways unionts (for `Fut users). - The
`Futcase should return at. - Support for watermaking should likely occur here.
This module provides a type to select source files for build units in b0 files. To support generated source files, selections can depend on the build.
In a nutshell the declaration:
let srcs =
Fpath.[ `Dir (v "src-exe"); `Dir_rec (v "src"); `X (v "src/not.ml");
`X (v "src/not")]instructs to:
- Select all the files in directory
src-exe. - Select all the files in the file hierarchy rooted at directory
src. - Remove from the files found in directories the files whose paths segments are prefixed by
src/not.mlandsrc/not.
Relative file paths are expressed relative to the build unit's scope directory.
The prefix relation for exclusions respects path segments boundaries. In the example any file whose path matches src/not.ml, src/not.ml/*, src/not or src/not/* is excluded from the selection. But for example src/not.c is not.
The relative order of directory selections and exclusions doesn't matter, the semantics is to select all the files via `Dir and `Dir_rec and then apply the exclusion `X on the resulting set. Exclusions affect only directory selections, not file `File and future `Future selections.
When a directory is selected via `Dir or `Dir_rec, all its files are, modulo exclusions. It is expected that build units themselves filter the final result by file extension or additional mechanisms. Consult the documentation of build units for more information.
Source selection
type sel = [ | `Dir of B0_std.Fpath.t| `Dir_rec of B0_std.Fpath.t| `X of B0_std.Fpath.t| `File of B0_std.Fpath.t| `Fut of B0_build.t -> B0_std.Fpath.Set.t B0_std.Fut.t
]The type for file selectors.
`File funconditionaly selects the filef.fmust exist and be a file.`Dir dselects the files of directorydmodulo`Xexclusions.dmust exist and be a directory. dotfile paths are ignored.`Dir_rec dselects the files of the file hierarchy rooted atdmodulo`Xexclusions.dmust exist and be a directory. dotfile paths are ignored.`X xremoves from directory selections any file whose path segments are prefixed byx, respecting segment boundaries. A potential trailing directory separators inxis removed.`Fut fuses the given future during the build to determine a set of files unconditionally added to the selection. FIXME this s not the right interface, maybe we should return atitself and merge the results
Except for `Fut, any relative path is made absolute to the current build unit with B0_unit.scope_dir.
The type for source selection results.
select b sels selects in b the sources specified by sels.
Important. All files in the map that were selected via `File, `D and `D_rec are automatically made ready in b. For those selected via `Fut readyness determination is left to the invoked funtion.
FIXME. Provide ordering guarantes and avoid non-det from the fs.
by_ext s are the selected files mapped by their file extension (not multiple file extension). Each file is guaranteed to appear only once in the map and is absolute.