ble: Add device information service
This commit is contained in:
parent
cd84754465
commit
dc54b55230
4 changed files with 152 additions and 1 deletions
22
build.rs
22
build.rs
|
|
@ -9,6 +9,7 @@ fn main() -> std::io::Result<()> {
|
|||
println!("cargo:rustc-link-arg=-Tlinkall.x");
|
||||
}
|
||||
|
||||
// compile protobuf definition to rust code
|
||||
let descriptor_path =
|
||||
std::path::PathBuf::from(env::var("OUT_DIR").unwrap()).join("proto_descriptor.bin");
|
||||
|
||||
|
|
@ -17,6 +18,27 @@ fn main() -> std::io::Result<()> {
|
|||
.compile_well_known_types()
|
||||
.compile_protos(&["docs/c_its-messages.proto"], &["docs/"])?;
|
||||
|
||||
// get git revision
|
||||
println!("cargo:rustc-rerun-if-changed=.git/HEAD");
|
||||
|
||||
// length:
|
||||
// - tag name: 6-8 chars (v0.1.0 to v1.23.42)
|
||||
// - offset+hash: 0-12 chars (up to 99 commits from tag + 8 char hash)
|
||||
// - SUM: 6-20
|
||||
let git_output = std::process::Command::new("git")
|
||||
.args(["describe", "--tags", "--match", "v*", "--always"])
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(
|
||||
git_output.stderr.is_empty(),
|
||||
"{}",
|
||||
String::from_utf8(git_output.stderr).unwrap()
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=GIT_REVISION={}",
|
||||
String::from_utf8(git_output.stdout).unwrap()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue