char/avril

(wip) why'd you have to go and make things so complicaaaaated?

git clone https://git.t4t.associates/char/avril

Charlotte Somdeslop(task): unify watchset + glob machinerya29d09f

main
2.2 KiB69 linesraw
1use std::collections::BTreeMap;
2
3mod cache;
4mod env;
5mod execution;
6mod fingerprint;
7mod glob;
8mod graph;
9mod watch;
10
11pub use cache::Cache;
12pub use env::{Error as EnvError, load_values as load_env_values};
13pub use execution::{CancelToken, Execution, FailedTask, ReadyTask, Report, RunOptions, Step};
14pub use fingerprint::graph_fingerprint;
15pub use glob::{
16    PatternError, collect_paths, compile_pattern, covers, expand_files, normalize_pattern,
17    validate_output_pattern, validate_pattern,
18};
19pub use graph::{Action, CallbackRef, Graph, Task, shell_quote};
20pub use watch::{
21    EnvResolution, Relevance, WatchContext, WatchEvent, WatchSet, WatchState, external_roots,
22    forget_directories, known_directories, normalize_path, relative_to, remember_directories,
23    resolution_paths, resolve_watch_target, resolved_input_paths,
24};
25
26#[derive(Debug, thiserror::Error)]
27pub enum Error {
28    #[error("Unknown task {0:?}")]
29    UnknownTask(String),
30    #[error("Task cycle detected: {0}")]
31    Cycle(String),
32    #[error("Task {task:?} files pattern {pattern:?} matched no files")]
33    UnmatchedFiles { task: String, pattern: String },
34    #[error("Task {task:?}: invalid glob pattern {pattern:?}: {message}")]
35    Pattern {
36        task: String,
37        pattern: String,
38        message: String,
39    },
40    #[error("Task {task:?}: cannot read {path}: {source}")]
41    Read {
42        task: String,
43        path: String,
44        #[source]
45        source: std::io::Error,
46    },
47    #[error("Invalid environment variable name {0:?}")]
48    EnvName(String),
49    #[error(transparent)]
50    Env(#[from] EnvError),
51    #[error("Task {task:?}: unsupported action {kind} in this driver")]
52    UnsupportedAction { task: String, kind: &'static str },
53    #[error(transparent)]
54    Io(#[from] std::io::Error),
55}
56
57pub type Result<T> = std::result::Result<T, Error>;
58pub type EnvMap = BTreeMap<String, String>;
59
60// ------------------------------------------------------------------ reporter
61
62pub trait Reporter {
63    fn cached(&self, _name: &str) {}
64    fn unmatched_output(&self, _name: &str, _pattern: &str) {}
65    fn cache_error(&self, _name: &str, _message: &str) {}
66}
67
68pub struct NoopReporter;
69impl Reporter for NoopReporter {}