Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple target-os #187

Merged

Conversation

darrell-roberts
Copy link
Member

@darrell-roberts darrell-roberts commented Jul 31, 2024

  • Added support for multiple --target-os values.
  • Added support for handling #[cfg(not(..))] target_os parsing.
  • Updated test in core/data/tests/excluded_by_target_os/input.rs to include all possible target_os cfg definitions.
  • Added flexi_logger/replaced println eprintln.

To run the test and see the evaluation:

  • RUST_LOG=debug cargo t --all-features --test snapshot_tests excluded_by_target_os::typescript -- --nocapture

@darrell-roberts darrell-roberts force-pushed the multiple-target-os-option branch 2 times, most recently from 5675bf4 to 3ed2ea7 Compare August 1, 2024 18:16
Copy link
Collaborator

@seanaye seanaye left a comment

Choose a reason for hiding this comment

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

Everything looks good, just some leftover comments.

Maybe also worth mentioning in PR description that logging is improved

core/src/visitors.rs Show resolved Hide resolved
seanaye
seanaye previously requested changes Aug 2, 2024
Copy link
Collaborator

@seanaye seanaye left a comment

Choose a reason for hiding this comment

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

Just noticed this bug is still occurring while testing locally. It appears like its illustrated in the tests too

@darrell-roberts darrell-roberts marked this pull request as ready for review August 2, 2024 19:58
Copy link
Collaborator

@charlespierce charlespierce left a comment

Choose a reason for hiding this comment

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

Overall looks nice! Mostly comments about making sure we leave ourselves a good record of how things work so that going forward we can maintain / improve these areas.

core/Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
core/src/parser.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
cli/Cargo.toml Outdated Show resolved Hide resolved
core/Cargo.toml Outdated Show resolved Hide resolved
core/src/parser.rs Outdated Show resolved Hide resolved
core/src/parser.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@charlespierce charlespierce left a comment

Choose a reason for hiding this comment

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

There's been a lot of iteration on this PR, and I know the delay is frustrating. I definitely don't think we need to cover every possible edge case, however I do think it would be valuable—even if only for ourselves as future maintainers—to have a clear documentation of how the new flag works and why. That way, if we lose context but have to come back and re-evaluate, we can be more confident we're considering all of the cases that were originally considered.

core/src/target_os_check.rs Show resolved Hide resolved
core/src/target_os_check.rs Show resolved Hide resolved
Comment on lines +36 to +39
if meta.path().is_ident("not") {
debug!("encountered not");
scope = TargetScope::Reject
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this take into account the existing scope? I.e., if we're already in TargetScope::Reject for this node, would not turn that into TargetScope::Accept? It's super edge-case since I don't know that someone would realistically do this, but how do we handle #[cfg(not(not(target_os = "ios")))]?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤔

docs/src/usage/configuration.md Show resolved Hide resolved
Copy link
Collaborator

@charlespierce charlespierce left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for going through all the iteration and for adding the docs 🎉

@@ -0,0 +1,87 @@
# Target OS
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fantastic, thank you! I love the use of examples to call out the behavior in the more complicated scenarios 🎉

@charlespierce charlespierce dismissed seanaye’s stale review August 21, 2024 19:38

Issue was a typo in a test case, which was resolved

@charlespierce charlespierce merged commit ccccb33 into 1Password:main Aug 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants