forked from project-senjuko/conch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
56 lines (49 loc) · 2.17 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2022-present qianjunakasumi <i@qianjunakasumi.ren> /
// project-senjuko/conch Contributors /
// /
// https://github.com/qianjunakasumi /
// https://github.com/project-senjuko/conch/graphs/contributors /
// /
// This Source Code Form is subject to the terms of the Mozilla Public /
// License, v. 2.0. If a copy of the MPL was not distributed with this /
// file, You can obtain one at http://mozilla.org/MPL/2.0/. /
////////////////////////////////////////////////////////////////////////////////////////////////////
use {
std::{io::Result, process::Command, time::{SystemTime, UNIX_EPOCH}}
};
fn main() -> Result<()> {
prost_build::compile_protos(
&["src/network/protocol/protobuf/oicq/device_report.proto"],
&["src/network/protocol/protobuf/"],
)?;
println!(
"cargo:rustc-env=GIT_HASH={}",
String::from_utf8(
Command::new("git")
.args(["rev-parse", "HEAD"])
.output().unwrap().stdout
).unwrap(),
);
println!(
"cargo:rustc-env=GIT_BRANCH={}",
String::from_utf8(
Command::new("git")
.args(["rev-parse", "--abbrev-ref", "HEAD"])
.output().unwrap().stdout,
).unwrap(),
);
println!(
"cargo:rustc-env=RUST_VERSION={}",
String::from_utf8(
Command::new("rustc")
.args(["--version"])
.output().unwrap().stdout,
).unwrap(),
);
println!(
"cargo:rustc-env=BUILD_TIME={}",
SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
);
Ok(())
}