1use std::{collections::HashMap, fs};
2
3use anyhow::{bail, Result};
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Serialize, Deserialize)]
7pub struct Blueprint {
8 pub libs: String,
10 pub headers: String,
12}
13
14#[derive(Debug, Serialize, Deserialize)]
15pub struct BlueprintFile {
16 pub bp: HashMap<String, Blueprint>,
17}
18
19pub fn read_blueprints() -> Result<BlueprintFile> {
20 let toml_str = match fs::read_to_string("build/blueprints.toml") {
21 Ok(str) => str,
22 Err(_) => {
23 bail!("Failed to read build/blueprints.toml.\nPerhaps run `bricks install` first?")
24 }
25 };
26 Ok(toml::from_str(&toml_str)?)
27}