From 71560d8be4e6ab4330d0fa7ef59f26f1eb4eccc4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 24 Sep 2021 22:40:16 +0200 Subject: Allow tasks to specify argument mappings --- src/resolve.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/resolve.rs') 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> 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); -- cgit v1.2.3