diff options
Diffstat (limited to 'crates/rebel/src/task.rs')
-rw-r--r-- | crates/rebel/src/task.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/crates/rebel/src/task.rs b/crates/rebel/src/task.rs index 7875869..1220d45 100644 --- a/crates/rebel/src/task.rs +++ b/crates/rebel/src/task.rs @@ -2,21 +2,26 @@ use std::collections::{HashMap, HashSet}; use serde::Deserialize; -use rebel_common::{string_hash::StringHash, types::TaskID}; +use rebel_common::{string_hash::StringHash, types::TaskIDRef}; -use crate::{ - args::{ArgMapping, ArgType, TaskArgs}, - recipe, -}; +use crate::args::{ArgMapping, ArgType, TaskArgs}; #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash)] pub struct TaskDep { - #[serde(flatten, deserialize_with = "recipe::deserialize_task_id")] - pub id: TaskID, + pub recipe: Option<String>, + pub task: String, #[serde(default)] pub args: ArgMapping, } +impl TaskDep { + pub fn id<'a>(&'a self, recipe: &'a str) -> TaskIDRef<'a> { + let recipe = self.recipe.as_deref().unwrap_or(recipe); + let task = &self.task; + TaskIDRef { recipe, task } + } +} + #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash)] pub struct Fetch { pub name: String, |