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

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

Floss: Check for C++ output dir instead of Rust output dir

To determine whether to re-run build script for btadapterd, check the
C++ output dir instead of Rust output dir, otherwise we will always
rebuild btadapterd unconditionally.

Bug: 203696027
Tag: #floss
Test: Manual - cargo build and check that btadapterd is only built once
unless there is a change in C++ output dir

Change-Id: I54fe4293a64d0d1abad3828d12590b63650d4ee6
parent 01cef9a2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -249,6 +249,7 @@ class HostBuild():
        self.env['RUSTFLAGS'] = self._generate_rustflags()
        self.env['CXX_ROOT_PATH'] = os.path.join(self.platform_dir, 'bt')
        self.env['CROS_SYSTEM_API_ROOT'] = os.path.join(self.platform_dir, 'system_api')
        self.env['CXX_OUTDIR'] = self._gn_default_output()

    def run_command(self, target, args, cwd=None, env=None):
        """ Run command and stream the output.
+2 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ use pkg_config::Config;

fn main() {
    let target_dir = std::env::var_os("CARGO_TARGET_DIR").unwrap();
    let cxx_outdir = std::env::var_os("CXX_OUTDIR").unwrap();

    // The main linking point with c++ code is the libbluetooth-static.a
    // These includes all the symbols built via C++ but doesn't include other
@@ -9,7 +10,7 @@ fn main() {
    println!("cargo:rustc-link-lib=static=bluetooth-static");
    println!("cargo:rustc-link-search=native={}", target_dir.clone().into_string().unwrap());
    // Also re-run the build if anything in the C++ build changes
    println!("cargo:rerun-if-changed={}", target_dir.into_string().unwrap());
    println!("cargo:rerun-if-changed={}", cxx_outdir.into_string().unwrap());

    // A few dynamic links
    println!("cargo:rustc-link-lib=dylib=flatbuffers");