diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-10-28 18:29:57 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2021-10-28 18:31:02 +0200 |
commit | 86f4c08b81e2129b5d1012c1350e68e3c0560282 (patch) | |
tree | 750c520fcf6518d96a51d84dd279e437203518d1 /crates/driver/src/task.rs | |
parent | b35a75f4cb5417bb464639079d266fd708549b32 (diff) | |
download | rebel-86f4c08b81e2129b5d1012c1350e68e3c0560282.tar rebel-86f4c08b81e2129b5d1012c1350e68e3c0560282.zip |
Rename executor to driver
Diffstat (limited to 'crates/driver/src/task.rs')
-rw-r--r-- | crates/driver/src/task.rs | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/crates/driver/src/task.rs b/crates/driver/src/task.rs new file mode 100644 index 0000000..fe9572c --- /dev/null +++ b/crates/driver/src/task.rs @@ -0,0 +1,84 @@ +use std::collections::{HashMap, HashSet}; + +use serde::Deserialize; + +use common::{string_hash::StringHash, types::TaskID}; + +use crate::{ + args::{ArgMapping, ArgType}, + recipe, +}; + +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash, Default)] +pub struct RecipeMeta { + #[serde(default)] + pub name: String, + pub version: Option<String>, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash)] +pub struct TaskDep { + #[serde(flatten, deserialize_with = "recipe::deserialize_task_id")] + pub id: TaskID, + #[serde(default)] + pub args: ArgMapping, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash)] +pub struct Fetch { + pub name: String, + pub sha256: StringHash, +} + +fn default_output_name() -> String { + "default".to_string() +} + +#[derive(Clone, Debug, Deserialize)] +pub struct InheritDep { + #[serde(flatten)] + pub dep: TaskDep, +} + +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash)] +pub struct OutputDep { + #[serde(flatten)] + pub dep: TaskDep, + #[serde(default)] + pub noinherit: bool, + #[serde(default = "default_output_name")] + pub output: String, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct Output { + pub path: Option<String>, + #[serde(default)] + pub runtime_depends: HashSet<OutputDep>, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct Action { + #[serde(default)] + pub run: String, +} + +#[derive(Clone, Debug, Deserialize)] +pub struct TaskDef { + #[serde(skip)] + pub meta: RecipeMeta, + #[serde(default)] + pub args: HashMap<String, ArgType>, + #[serde(default)] + pub inherit: Option<InheritDep>, + #[serde(default)] + pub fetch: HashSet<Fetch>, + #[serde(default)] + pub build_depends: HashSet<OutputDep>, + #[serde(default)] + pub depends: HashSet<OutputDep>, + #[serde(default)] + pub output: HashMap<String, Output>, + #[serde(flatten)] + pub action: Action, +} |