-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: Support OS specific tasks. (#1626)
* Add new option. * Support arrays. * Add tests. * Update docs. * Add blog post. * Add more tests. * Update changelog.
- Loading branch information
Showing
25 changed files
with
499 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
mod input_path; | ||
mod output_path; | ||
mod poly; | ||
|
||
pub use input_path::*; | ||
pub use output_path::*; | ||
pub use poly::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use moon_common::cacheable; | ||
use schematic::schema::UnionType; | ||
use schematic::{Schema, SchemaBuilder, Schematic}; | ||
|
||
cacheable!( | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
#[serde(untagged, expecting = "expected a single value, or a list of values")] | ||
pub enum OneOrMany<T: Schematic> { | ||
One(T), | ||
Many(Vec<T>), | ||
} | ||
); | ||
|
||
impl<T: Schematic + Clone> OneOrMany<T> { | ||
pub fn to_list(&self) -> Vec<T> { | ||
match self { | ||
Self::One(item) => vec![item.to_owned()], | ||
Self::Many(list) => list.to_owned(), | ||
} | ||
} | ||
} | ||
|
||
impl<T: Schematic> Schematic for OneOrMany<T> { | ||
fn schema_name() -> Option<String> { | ||
None | ||
} | ||
|
||
fn build_schema(mut schema: SchemaBuilder) -> Schema { | ||
schema.union(UnionType::new_any([ | ||
schema.infer::<T>(), | ||
schema.infer::<Vec<T>>(), | ||
])) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/task-builder/tests/__fixtures__/builder/options-os/moon.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
tasks: | ||
os-windows: | ||
command: 'execute --win' | ||
options: | ||
os: windows | ||
os-linux: | ||
script: 'execute --nix' | ||
options: | ||
os: linux | ||
os-macos: | ||
command: 'execute --mac' | ||
options: | ||
os: macos |
Oops, something went wrong.