diff options
| author | datdenkikniet <jcdra1@gmail.com> | 2023-04-15 10:03:52 +0200 |
|---|---|---|
| committer | datdenkikniet <jcdra1@gmail.com> | 2023-04-15 10:03:52 +0200 |
| commit | 480aa210594a1ea808da93614aa49a508f9f35af (patch) | |
| tree | 332ea8ea9fe6abe8597c56f4481c4005f35b540d /xtask/src/argument_parsing.rs | |
| parent | f2115e3d474ac9b3c802e162af3dbec620598c4e (diff) | |
Always run stuff for all packages if none is specified
Diffstat (limited to 'xtask/src/argument_parsing.rs')
| -rw-r--r-- | xtask/src/argument_parsing.rs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/xtask/src/argument_parsing.rs b/xtask/src/argument_parsing.rs index f643cbb..7284fc5 100644 --- a/xtask/src/argument_parsing.rs +++ b/xtask/src/argument_parsing.rs @@ -29,6 +29,30 @@ impl Package { Package::RticTime => "rtic-time", } } + + pub fn all() -> Vec<Self> { + vec![ + Self::Rtic, + Self::RticCommon, + Self::RticMacros, + Self::RticMonotonics, + Self::RticSync, + Self::RticTime, + ] + } + + /// Get the features needed given the selected package + /// + /// Without package specified the features for RTIC are required + /// With only a single package which is not RTIC, no special + /// features are needed + pub fn extract_features(&self, target: Target, backend: Backends) -> Option<String> { + match self { + Package::Rtic => Some(target.and_features(backend.to_rtic_feature())), + Package::RticMacros => Some(backend.to_rtic_macros_feature().to_owned()), + _ => None, + } + } } pub struct TestMetadata {} @@ -247,7 +271,16 @@ pub struct PackageOpt { /// For which package/workspace member to operate /// /// If omitted, work on all - pub package: Option<Package>, + package: Option<Package>, +} + +impl PackageOpt { + pub fn packages(&self) -> impl Iterator<Item = Package> { + self.package + .map(|p| vec![p]) + .unwrap_or(Package::all()) + .into_iter() + } } #[derive(Args, Debug, Clone)] |
