upgrade vergen to 3.0 (#11293)
* version: upgrade vergen to 3.0 * version: use vergen for target triple
This commit is contained in:
committed by
Niklas Adolfsson
parent
a016dc5c6c
commit
71f4f61146
@@ -24,11 +24,6 @@ use target_info::Target;
|
||||
use bytes::Bytes;
|
||||
use rlp::RlpStream;
|
||||
|
||||
mod vergen {
|
||||
#![allow(unused)]
|
||||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||
}
|
||||
|
||||
mod generated {
|
||||
include!(concat!(env!("OUT_DIR"), "/meta.rs"));
|
||||
}
|
||||
@@ -43,18 +38,21 @@ const THIS_TRACK: &'static str = "unstable";
|
||||
|
||||
/// Get the platform identifier.
|
||||
pub fn platform() -> String {
|
||||
let env = Target::env();
|
||||
let env_dash = if env.is_empty() { "" } else { "-" };
|
||||
format!("{}-{}{}{}", Target::arch(), Target::os(), env_dash, env)
|
||||
format!("{}", env!("VERGEN_TARGET_TRIPLE"))
|
||||
}
|
||||
|
||||
/// Get the standard version string for this software.
|
||||
pub fn version() -> String {
|
||||
let sha3 = vergen::short_sha();
|
||||
let sha3_dash = if sha3.is_empty() { "" } else { "-" };
|
||||
let commit_date = vergen::commit_date().replace("-", "");
|
||||
let date_dash = if commit_date.is_empty() { "" } else { "-" };
|
||||
format!("Parity-Ethereum/v{}-{}{}{}{}{}/{}/rustc{}", env!("CARGO_PKG_VERSION"), THIS_TRACK, sha3_dash, sha3, date_dash, commit_date, platform(), generated::rustc_version())
|
||||
let commit_date = format!("{}", env!("VERGEN_COMMIT_DATE")).replace("-", "");
|
||||
format!(
|
||||
"Parity-Ethereum/v{}-{}-{}-{}/{}/rustc{}",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
THIS_TRACK,
|
||||
env!("VERGEN_SHA_SHORT"),
|
||||
commit_date,
|
||||
platform(),
|
||||
generated::rustc_version(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the standard version data for this software.
|
||||
@@ -73,5 +71,5 @@ pub fn version_data() -> Bytes {
|
||||
|
||||
/// Provide raw information on the package.
|
||||
pub fn raw_package_info() -> (&'static str, &'static str, &'static str) {
|
||||
(THIS_TRACK, env!["CARGO_PKG_VERSION"], vergen::sha())
|
||||
(THIS_TRACK, env!["CARGO_PKG_VERSION"], env!["VERGEN_SHA"])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user