difftreelog
fix build without codegenerated-stdlib feature
in: master
2 files changed
crates/jrsonnet-stdlib/build.rsdiffbeforeafterboth1use std::{env, fs::File, io::Write, path::Path};23use jrsonnet_parser::{parse, ParserSettings, Source};4use structdump::CodegenResult;56fn main() {1fn main() {2 #[cfg(feature = "codegenerated-stdlib")]3 {4 use std::{env, fs::File, io::Write, path::Path};56 use jrsonnet_parser::{parse, ParserSettings, Source};7 use structdump::CodegenResult;87 let parsed = parse(9 let parsed = parse(8 include_str!("./src/std.jsonnet"),10 include_str!("./src/std.jsonnet"),21 let dest_path = Path::new(&out_dir).join("stdlib.rs");26 let dest_path = Path::new(&out_dir).join("stdlib.rs");22 let mut f = File::create(dest_path).unwrap();27 let mut f = File::create(dest_path).unwrap();23 f.write_all(28 f.write_all(24 ("#[allow(clippy::redundant_clone)]".to_owned() + &v.to_string())29 ("#[allow(clippy::redundant_clone)]".to_owned() + &v.to_string()).as_bytes(),25 .replace(';', ";\n")26 .as_bytes(),27 )30 )28 .unwrap();31 .unwrap();29 }32 }33 }30}34}3135crates/jrsonnet-stdlib/src/expr.rsdiffbeforeafterboth1use jrsonnet_parser::LocExpr;1use jrsonnet_parser::LocExpr;23mod structdump_import {4 pub(super) use std::{option::Option, rc::Rc, vec};56 pub(super) use jrsonnet_parser::*;7}829pub fn stdlib_expr() -> LocExpr {3pub fn stdlib_expr() -> LocExpr {10 #[cfg(feature = "serialized-stdlib")]4 #[cfg(feature = "serialized-stdlib")]857986 #[cfg(feature = "codegenerated-stdlib")]80 #[cfg(feature = "codegenerated-stdlib")]87 {81 {82 mod structdump_import {83 pub(super) use std::{option::Option, rc::Rc, vec};8485 pub(super) use jrsonnet_parser::*;86 };8788 include!(concat!(env!("OUT_DIR"), "/stdlib.rs"))88 include!(concat!(env!("OUT_DIR"), "/stdlib.rs"))89 }89 }909091 #[cfg(not(feature = "codegenerated-stdlib"))]91 #[cfg(not(feature = "codegenerated-stdlib"))]92 {92 {93 use jrsonnet_parser::Source;9495 const STDLIB_STR: &str = include_str!("./std.jsonnet");9693 jrsonnet_parser::parse(97 jrsonnet_parser::parse(94 STDLIB_STR,98 STDLIB_STR,95 &ParserSettings {99 &jrsonnet_parser::ParserSettings {96 file_name: Source::new_virtual(Cow::Borrowed("<std>"), STDLIB_STR.into()),100 source: Source::new_virtual("<std>".into(), STDLIB_STR.into()),97 },101 },98 )102 )99 .unwrap()103 .unwrap()