Make dependencies execute in order they appear

It doesn't seem particularly valuable for dependencies to execute in any
order, so make Recipe.dependencies a vec so they execute in order.
This commit is contained in:
Casey Rodarmor 2016-10-09 00:30:33 -07:00
parent fbe8c07d43
commit e5efa3f7d5
2 changed files with 6 additions and 4 deletions

View File

@ -24,6 +24,8 @@ create:
clean:
rm -r tmp
polyglot: python js perl sh ruby
python:
#!/usr/bin/env python3
print('Hello from python!')

View File

@ -50,7 +50,7 @@ pub struct Recipe<'a> {
name: &'a str,
leading_whitespace: &'a str,
lines: Vec<&'a str>,
dependencies: BTreeSet<&'a str>,
dependencies: Vec<&'a str>,
shebang: bool,
}
@ -502,15 +502,15 @@ pub fn parse<'a>(text: &'a str) -> Result<Justfile, Error> {
}
let rest = captures.at(2).unwrap().trim();
let mut dependencies = BTreeSet::new();
let mut dependencies = vec![];
for part in whitespace_re.split(rest) {
if name_re.is_match(part) {
if dependencies.contains(part) {
if dependencies.contains(&part) {
return Err(error(text, i, ErrorKind::DuplicateDependency{
name: part,
}));
}
dependencies.insert(part);
dependencies.push(part);
} else {
return Err(error(text, i, ErrorKind::UnparsableDependencies));
}