-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this is pretty much a nothing commit, just practiced some yaml
- Loading branch information
1 parent
e198aa2
commit dd18e33
Showing
7 changed files
with
77 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ members = [ | |
"object", | ||
"linker", | ||
"ast", | ||
"project", | ||
"ty", | ||
"ir", | ||
"e2e", | ||
] | ||
|
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,7 +1,8 @@ | ||
type: Project | ||
name: | ||
details: | ||
|
||
type: project | ||
name: | ||
targets: | ||
- | ||
hooks: | ||
--- | ||
type: Exe | ||
name: ty | ||
|
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,10 @@ | ||
[package] | ||
name = "project" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = { version = "1", features = [ "derive" ] } | ||
serde_yaml = "0" |
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,48 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_yaml::{self}; | ||
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
pub struct Recipe { | ||
kind: String, | ||
name: String, | ||
details: serde_yaml::Value, | ||
} | ||
|
||
pub struct ProjectConfig {} | ||
|
||
impl ProjectConfig { | ||
pub fn new() -> ProjectConfig { | ||
ProjectConfig {} | ||
} | ||
pub fn parse_multi_yaml(&mut self, file: String) -> () { | ||
for document in serde_yaml::Deserializer::from_str(&file) { | ||
let v = Recipe::deserialize(document).unwrap(); | ||
println!("{:?}", v); | ||
} | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let yaml = "\ | ||
kind: project\n\ | ||
name: SDL\n\ | ||
details:\n\ | ||
- ref: help\n\ | ||
- me\n\ | ||
---\n\ | ||
kind: target\n\ | ||
name: sdl_exe\n\ | ||
details:\n\ | ||
- help\n\ | ||
- me\n\ | ||
" | ||
.to_string(); | ||
let mut project = ProjectConfig::new(); | ||
project.parse_multi_yaml(yaml); | ||
} | ||
} |
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,8 @@ | ||
[package] | ||
name = "ty" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
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,3 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
} |