git.delta.rocks / jrsonnet / refs/commits / 4ad9956e5f9b

difftreelog

source

crates/jrsonnet-stdlib/build.rs594 Bsourcehistory
1use std::{borrow::Cow, env, fs::File, io::Write, path::Path};23use bincode::serialize;4use jrsonnet_parser::{parse, ParserSettings, Source};56fn main() {7	let parsed = parse(8		include_str!("./src/std.jsonnet"),9		&ParserSettings {10			file_name: Source::new_virtual(11				Cow::Borrowed("<std>"),12				include_str!("./src/std.jsonnet").into(),13			),14		},15	)16	.expect("parse");1718	{19		let out_dir = env::var("OUT_DIR").unwrap();20		let dest_path = Path::new(&out_dir).join("stdlib.bincode");21		let mut f = File::create(&dest_path).unwrap();22		f.write_all(&serialize(&parsed).unwrap()).unwrap();23	}24}