diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-09-24 22:40:16 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-09-24 22:40:16 +0200 |
commit | 71560d8be4e6ab4330d0fa7ef59f26f1eb4eccc4 (patch) | |
tree | 2d81dda542faeb0ade9c41636d962857bc15b225 /src/resolve.rs | |
parent | 071b82ad92c39d2cf2c4e2dae57e2586399c4447 (diff) | |
download | rebel-71560d8be4e6ab4330d0fa7ef59f26f1eb4eccc4.tar rebel-71560d8be4e6ab4330d0fa7ef59f26f1eb4eccc4.zip |
Allow tasks to specify argument mappings
Diffstat (limited to 'src/resolve.rs')
-rw-r--r-- | src/resolve.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/resolve.rs b/src/resolve.rs index 32ceedc..5032351 100644 --- a/src/resolve.rs +++ b/src/resolve.rs @@ -53,6 +53,7 @@ pub enum Error<'ctx> { OutputNotFound(DepChain<'ctx>, &'ctx str), DependencyCycle(DepChain<'ctx>), InvalidArgument(DepChain<'ctx>, &'ctx str), + InvalidArgRef(DepChain<'ctx>, &'ctx str), } impl<'ctx> Error<'ctx> { @@ -74,6 +75,7 @@ impl<'ctx> Error<'ctx> { Error::OutputNotFound(ref mut tasks, _) => tasks, Error::DependencyCycle(ref mut tasks) => tasks, Error::InvalidArgument(ref mut tasks, _) => tasks, + Error::InvalidArgRef(ref mut tasks, _) => tasks, }; tasks.0.push(task.clone()); } @@ -98,6 +100,13 @@ impl<'ctx> fmt::Display for Error<'ctx> { arg, tasks ) } + Error::InvalidArgRef(tasks, arg) => { + write!( + f, + "Invalid reference for argument '{}' of task: {}", + arg, tasks + ) + } } } } @@ -107,6 +116,7 @@ impl<'ctx> From<context::Error<'ctx>> for Error<'ctx> { match err { context::Error::TaskNotFound(task) => Error::task_not_found(task), context::Error::InvalidArgument(task, arg) => Error::InvalidArgument(task.into(), arg), + context::Error::InvalidArgRef(task, arg) => Error::InvalidArgRef(task.into(), arg), } } } @@ -152,7 +162,7 @@ where let mut errors = Vec::new(); for runtime_dep in &output.runtime_depends { - match ctx.output_ref(runtime_dep, &task.args) { + match ctx.output_ref(runtime_dep, &task.args, false) { Ok(output_ref) => { for mut error in add_dep(ret, ctx, output_ref) { error.extend(task); |