[bake] initial commit
This commit is contained in:
parent
c9d964b20d
commit
eb0ef2c4b2
32
bake/Cargo.lock
generated
Normal file
32
bake/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bake"
|
||||||
|
version = "0.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"eyre",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "eyre"
|
||||||
|
version = "0.6.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
|
||||||
|
dependencies = [
|
||||||
|
"indenter",
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indenter"
|
||||||
|
version = "0.3.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.20.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||||
14
bake/Cargo.toml
Normal file
14
bake/Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[package]
|
||||||
|
name = "bake"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "lib/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "bake"
|
||||||
|
path = "bin/main.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
eyre = "0.6.12"
|
||||||
35
bake/bin/main.rs
Normal file
35
bake/bin/main.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
use std::process::ExitCode;
|
||||||
|
|
||||||
|
use eyre::Context;
|
||||||
|
|
||||||
|
const USAGE: &str = r#"
|
||||||
|
bake [target...] [-- [args-for-last-target...]]
|
||||||
|
"#;
|
||||||
|
|
||||||
|
fn print_usage() {
|
||||||
|
println!("{USAGE}");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn go() -> eyre::Result<()> {
|
||||||
|
let contents = match std::fs::read_to_string("build.bake") {
|
||||||
|
Ok(v) => v,
|
||||||
|
Err(e) => match e.kind() {
|
||||||
|
std::io::ErrorKind::NotFound => {
|
||||||
|
println!("build.bake not present in current directory");
|
||||||
|
return Ok(());
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
return Err(e).wrap_err("Failed to read contents of build.bake")
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut graph = bake::build_graph_from_str(&contents)?;
|
||||||
|
bake::execute_graph(&graph)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> eyre::Result<()> {
|
||||||
|
go()
|
||||||
|
}
|
||||||
1
bake/build.bake
Normal file
1
bake/build.bake
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
(-> :name run (phony) (phony) "cargo run")
|
||||||
22
bake/lib/lib.rs
Normal file
22
bake/lib/lib.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
pub type Result<T> = core::result::Result<T, Error>;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Error;
|
||||||
|
impl core::fmt::Display for Error {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "{self:?}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for Error {
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Graph;
|
||||||
|
|
||||||
|
pub fn build_graph_from_str(s: &str) -> Result<Graph> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_graph(graph: &Graph) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue