Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7fc60e3 authored by Sonny Sasaka's avatar Sonny Sasaka
Browse files

Floss: Add TOPSHIM_SHOULD_REBUILD optional env var

Cargo does not have a convenient way to rebuild by specifying wildcard
(e.g. *.h files). In development, topshim will most likely be always
rebuilt since developers likely change any file inside system/. This
adds a development option in environment variable to ignore topshim
rebuild to speed up edit compile cycle when topshim isn't expected to
change.

Bug: 217273154
Tag: #floss
Test: Manual - Build Floss on Linux

Change-Id: Ica667d0d3fdd0229fc7ae8f8a28486e85e09a410
parent 075469d2
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -29,8 +29,18 @@ fn main() {
    let bt_searches =
        paths.iter().map(|tail| format!("-I{}{}", search_root, tail)).collect::<Vec<String>>();

    // Also re-run bindgen if anything in the C++ source changes
    // Also re-run bindgen if anything in the C++ source changes. Unfortunately the Rust source
    // files also reside in the same directory so any changes of Rust files (and other non-C files
    // actually) will cause topshim to be rebuild. The TOPSHIM_SHOULD_REBUILD env variable is a
    // development tool to speed up build that can be set to "no" if topshim is not expected to be
    // change.
    let topshim_should_rebuild = match env::var("TOPSHIM_SHOULD_REBUILD") {
        Err(_) => true,
        Ok(should_rebuild) => should_rebuild != "no",
    };
    if topshim_should_rebuild {
        println!("cargo:rerun-if-changed={}{}", search_root, "/system/");
    }

    // "-x" and "c++" must be separate due to a bug
    let clang_args: Vec<&str> = vec!["-x", "c++", "-std=c++17"];