2022-09-13 17:55:17 +00:00
|
|
|
// Copyright 2020 The ChromiumOS Authors
|
2020-11-10 09:24:04 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2022-12-22 21:23:29 +00:00
|
|
|
use std::env;
|
|
|
|
use std::path::PathBuf;
|
2020-11-10 09:24:04 +00:00
|
|
|
|
2022-12-22 21:23:29 +00:00
|
|
|
fn main() {
|
|
|
|
let mut input_files = Vec::new();
|
2020-11-10 09:24:04 +00:00
|
|
|
|
2022-12-22 21:23:29 +00:00
|
|
|
if cfg!(feature = "powerd") {
|
2022-09-20 18:07:14 +00:00
|
|
|
let power_manager_dir = match env::var("SYSROOT") {
|
|
|
|
Ok(dir) => PathBuf::from(dir).join("usr/include/chromeos/dbus/power_manager"),
|
|
|
|
// Use local copy of proto file when building upstream
|
|
|
|
Err(_) => PathBuf::from("."),
|
2020-11-10 09:24:04 +00:00
|
|
|
};
|
|
|
|
|
2022-12-22 21:23:29 +00:00
|
|
|
input_files.push(power_manager_dir.join("power_supply_properties.proto"));
|
|
|
|
}
|
2020-11-10 09:24:04 +00:00
|
|
|
|
2022-12-22 21:23:29 +00:00
|
|
|
let mut out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR env does not exist."));
|
|
|
|
out_dir.push("protos");
|
2020-11-10 09:24:04 +00:00
|
|
|
|
2022-12-22 21:23:29 +00:00
|
|
|
proto_build_tools::build_protos(&out_dir, &input_files);
|
2020-11-10 09:24:04 +00:00
|
|
|
}
|