Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/netsuke-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ The manifest version is parsed using the `semver` crate to validate that it
follows semantic versioning rules. Global and target variable maps now share
the `HashMap<String, String>` type for consistency. This keeps YAML manifests
concise while ensuring forward compatibility.
Targets also accept optional `phony` and `always` booleans. They default to
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): This paragraph exceeds the 80 column wrapping limit for paragraphs and bullets.

Please wrap this paragraph so that no line exceeds 80 columns, as per the documentation guidelines.

Review instructions:

Path patterns: **/*.md

Instructions:
Paragraphs and bullets must be wrapped to 80 columns

`false`, making it explicit when a step should run regardless of file
timestamps.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (review_instructions): This line is part of a paragraph that is not wrapped to 80 columns.

Please wrap the entire paragraph to 80 columns as required by the style guide.

Review instructions:

Path patterns: **/*.md

Instructions:
Paragraphs and bullets must be wrapped to 80 columns


### 3.5 Testing

Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ compilation pipeline from parsing to execution.
- [ ] Implement parsing for the netsuke_version field and validate it using
the semver crate.

- [ ] Support `phony` and `always` boolean flags on targets.
- [x] Support `phony` and `always` boolean flags on targets. *(done)*

- [ ] Parse the optional steps list, treating each entry as a target with
phony: true by default.
Expand Down
31 changes: 31 additions & 0 deletions tests/ast_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,34 @@ fn invalid_enum_variants() {
"#;
assert!(serde_yml::from_str::<NetsukeManifest>(yaml).is_err());
}

#[test]
fn phony_and_always_flags() {
let yaml = r#"
netsuke_version: "1.0.0"
targets:
- name: clean
recipe:
kind: command
command: rm -rf build
phony: true
always: true
"#;
let manifest = serde_yml::from_str::<NetsukeManifest>(yaml).expect("parse");
let target = manifest.targets.first().expect("target");
assert!(target.phony);
assert!(target.always);

let yaml = r#"
netsuke_version: "1.0.0"
targets:
- name: clean
recipe:
kind: command
command: rm -rf build
"#;
let manifest = serde_yml::from_str::<NetsukeManifest>(yaml).expect("parse");
let target = manifest.targets.first().expect("target");
assert!(!target.phony);
assert!(!target.always);
}
8 changes: 8 additions & 0 deletions tests/data/phony.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
netsuke_version: "1.0.0"
targets:
- name: clean
recipe:
kind: command
command: "rm -rf build"
phony: true
always: true
5 changes: 5 additions & 0 deletions tests/features/manifest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ Feature: Manifest parsing
When the manifest file "tests/data/minimal.yml" is parsed
Then the manifest version is "1.0.0"
And the first target name is "hello"

Scenario: Parse phony and always flags
When the manifest file "tests/data/phony.yml" is parsed
Then the first target is phony
And the first target is always rebuilt
14 changes: 14 additions & 0 deletions tests/steps/manifest_steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,17 @@ fn first_target_name(world: &mut CliWorld, name: String) {
other => panic!("Expected StringOrList::String, got: {other:?}"),
}
}

#[then("the first target is phony")]
fn first_target_phony(world: &mut CliWorld) {
let manifest = world.manifest.as_ref().expect("manifest");
let first = manifest.targets.first().expect("targets");
assert!(first.phony);
}

#[then("the first target is always rebuilt")]
fn first_target_always(world: &mut CliWorld) {
let manifest = world.manifest.as_ref().expect("manifest");
let first = manifest.targets.first().expect("targets");
assert!(first.always);
}