xref: /aosp_15_r20/external/crosvm/power_monitor/build.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2020 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 use std::env;
6 use std::path::PathBuf;
7 
main()8 fn main() {
9     let mut input_files = Vec::new();
10 
11     if cfg!(feature = "powerd") {
12         let power_manager_dir = match env::var("SYSROOT") {
13             Ok(dir) => PathBuf::from(dir).join("usr/include/chromeos/dbus/power_manager"),
14             // Use local copy of proto file when building upstream
15             Err(_) => PathBuf::from("."),
16         };
17 
18         input_files.push(power_manager_dir.join("power_supply_properties.proto"));
19     }
20 
21     let mut out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR env does not exist."));
22 
23     // ANDROID: b/259142784 - we remove protos subdir b/c cargo_embargo
24     // out_dir.push("protos");
25 
26     proto_build_tools::build_protos(&out_dir, &input_files);
27 }
28