summaryrefslogtreecommitdiffstats
path: root/crates/rebel-resolve
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2024-04-20 17:11:34 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2024-04-20 17:12:02 +0200
commit7164660d63052bfa47a082711a64529b026b35f2 (patch)
treeaa1358f85c6afe9ce50676d8e1f439fc97517367 /crates/rebel-resolve
parent801f049969be0ca907b74e53597bec33cba97af4 (diff)
downloadrebel-7164660d63052bfa47a082711a64529b026b35f2.tar
rebel-7164660d63052bfa47a082711a64529b026b35f2.zip
Move rebel-parse dependency from rebel-resolve to rebel
Diffstat (limited to 'crates/rebel-resolve')
-rw-r--r--crates/rebel-resolve/Cargo.toml1
-rw-r--r--crates/rebel-resolve/src/context.rs23
2 files changed, 9 insertions, 15 deletions
diff --git a/crates/rebel-resolve/Cargo.toml b/crates/rebel-resolve/Cargo.toml
index 65eae78..4b3e113 100644
--- a/crates/rebel-resolve/Cargo.toml
+++ b/crates/rebel-resolve/Cargo.toml
@@ -9,7 +9,6 @@ edition = "2021"
[dependencies]
rebel-common = { path = "../rebel-common" }
-rebel-parse = { path = "../rebel-parse" }
deb-version = "0.1.1"
enum-kinds = "0.5.1"
diff --git a/crates/rebel-resolve/src/context.rs b/crates/rebel-resolve/src/context.rs
index 88d5deb..996d981 100644
--- a/crates/rebel-resolve/src/context.rs
+++ b/crates/rebel-resolve/src/context.rs
@@ -14,7 +14,6 @@ use rebel_common::{
string_hash::ArchiveHash,
types::TaskIDRef,
};
-use rebel_parse::{self as parse, TaskFlags};
use crate::{
args::*,
@@ -362,16 +361,12 @@ impl Context {
})
}
- pub fn parse(&self, s: &str) -> error::Result<(TaskRef, TaskFlags)> {
- let (parsed, flags) = parse::task_ref_with_flags(s)
- .ok()
- .context("Invalid task syntax")?;
-
- let id = TaskIDRef {
- recipe: parsed.id.recipe,
- task: parsed.id.task,
- };
-
+ pub fn lookup(
+ &self,
+ id: TaskIDRef,
+ host: Option<&str>,
+ target: Option<&str>,
+ ) -> error::Result<TaskRef> {
let (ctx_recipe, recipe_tasks) = self
.tasks
.get_key_value(id.recipe)
@@ -386,7 +381,7 @@ impl Context {
let mut args = self.globals.clone();
- if let Some(host) = parsed.args.host {
+ if let Some(host) = host {
let plat = self
.platforms
.get(host)
@@ -394,7 +389,7 @@ impl Context {
args.set("host", Some(plat));
args.set("target", Some(plat));
}
- if let Some(target) = parsed.args.target {
+ if let Some(target) = target {
let plat = self
.platforms
.get(target)
@@ -406,7 +401,7 @@ impl Context {
.task_ref(ctx_id, &args)
.with_context(|| format!("Failed to instantiate task {}", id))?;
- Ok((task_ref, flags))
+ Ok(task_ref)
}
fn map_args<'ctx, 'args>(