From 1521a288b46861cd7ad79e48471adadcc67d2ac3 Mon Sep 17 00:00:00 2001 From: luofucong Date: Fri, 2 Aug 2024 15:46:08 +0800 Subject: [PATCH] Expose the "build" function to let projects with submodules control where to find the proper path. --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0c86fcc..c929dac 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -348,10 +348,10 @@ impl Shadow { pub fn build(deny_const: BTreeSet) -> SdResult { let src_path = std::env::var("CARGO_MANIFEST_DIR")?; let out_path = std::env::var("OUT_DIR")?; - Self::build_inner(src_path, out_path, deny_const) + Self::build_with(src_path, out_path, deny_const) } - fn build_inner( + pub fn build_with( src_path: String, out_path: String, deny_const: BTreeSet, @@ -552,7 +552,7 @@ mod tests { #[test] fn test_build() -> SdResult<()> { - Shadow::build_inner("./".into(), "./".into(), Default::default())?; + Shadow::build_with("./".into(), "./".into(), Default::default())?; let shadow = fs::read_to_string("./shadow.rs")?; assert!(!shadow.is_empty()); assert!(shadow.lines().count() > 0); @@ -563,7 +563,7 @@ mod tests { fn test_build_deny() -> SdResult<()> { let mut deny = BTreeSet::new(); deny.insert(CARGO_TREE); - Shadow::build_inner("./".into(), "./".into(), deny)?; + Shadow::build_with("./".into(), "./".into(), deny)?; let shadow = fs::read_to_string("./shadow.rs")?; assert!(!shadow.is_empty()); assert!(shadow.lines().count() > 0);