Skip to content

Commit

Permalink
Fail DRT build quickly if lean build dir isn't present (#477)
Browse files Browse the repository at this point in the history
Signed-off-by: John Kastner <[email protected]>
  • Loading branch information
john-h-kastner-aws authored Nov 19, 2024
1 parent 093f0b3 commit 2af65bc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cedar-drt/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@
*/

use std::env;
use std::path::Path;
const LEAN_BUILD_DIR: &'static str = "../cedar-lean/.lake/build/lib";
fn main() {
let lean_dir = env::var("LEAN_LIB_DIR").expect(
"`LEAN_LIB_DIR` environment variable is not set! Try running `source set_env_vars.sh`",
);
println!("cargo:rustc-link-search=native=../cedar-lean/.lake/build/lib");
// We'll need to link against some files found here later, and it's nicer to
// fail quickly with a helpful error message.
if !Path::new(LEAN_BUILD_DIR).exists() {
panic!("Lean build directory does not exist! Try running `( cd ../cedar-lean && ../cedar-drt/build_lean_lib.sh )`")
}
println!("cargo:rustc-link-search=native={LEAN_BUILD_DIR}");
println!("cargo:rustc-link-search=native={lean_dir}");
println!(
"cargo:rustc-link-search=native=../cedar-lean/.lake/packages/batteries/.lake/build/lib"
);
println!("cargo:rerun-if-changed=../cedar-lean/.lake/build/lib");
println!("cargo:rerun-if-changed={LEAN_BUILD_DIR}");
}

0 comments on commit 2af65bc

Please sign in to comment.