build(deps): update deps (#479)

This commit is contained in:
Sanchith Hegde
2023-01-31 15:21:34 +05:30
committed by GitHub
parent 3cbd5f9816
commit d1ab46238e
14 changed files with 212 additions and 232 deletions

View File

@ -75,8 +75,8 @@ pub fn workspace_path() -> PathBuf {
/// Version of the crate containing the following information:
///
/// - Semantic Version from the latest git tag. If tags are not present in the repository, crate
/// version from the crate manifest is used instead.
/// - The latest git tag. If tags are not present in the repository, the short commit hash is used
/// instead.
/// - Short hash of the latest git commit.
/// - Timestamp of the latest git commit.
///
@ -85,9 +85,9 @@ pub fn workspace_path() -> PathBuf {
macro_rules! version {
() => {
concat!(
env!("VERGEN_GIT_SEMVER"),
env!("VERGEN_GIT_DESCRIBE"),
"-",
env!("VERGEN_GIT_SHA_SHORT"),
env!("VERGEN_GIT_SHA"),
"-",
env!("VERGEN_GIT_COMMIT_TIMESTAMP"),
)
@ -95,7 +95,7 @@ macro_rules! version {
}
///
/// A string uniquely idendify build of the service.
/// A string uniquely identify build of the service.
///
/// Consists of combination of
/// - Version defined in the crate file
@ -113,7 +113,7 @@ macro_rules! build {
concat!(
env!("CARGO_PKG_VERSION"),
"-",
env!("VERGEN_GIT_SHA_SHORT"),
env!("VERGEN_GIT_SHA"),
"-",
env!("VERGEN_GIT_COMMIT_TIMESTAMP"),
"-",
@ -180,6 +180,6 @@ macro_rules! service_name {
#[macro_export]
macro_rules! profile {
() => {
env!("VERGEN_CARGO_PROFILE")
env!("CARGO_PROFILE")
};
}

View File

@ -8,53 +8,26 @@
/// Panics if `vergen` fails to generate `cargo` build instructions.
#[allow(clippy::expect_used)]
pub fn generate_cargo_instructions() {
use vergen::{vergen, Config, ShaKind};
use std::io::Write;
let mut config = Config::default();
use vergen::EmitBuilder;
let build = config.build_mut();
*build.enabled_mut() = false;
*build.skip_if_error_mut() = true;
EmitBuilder::builder()
.cargo_debug()
.cargo_opt_level()
.cargo_target_triple()
.git_commit_timestamp()
.git_describe(true, true)
.git_sha(true)
.rustc_semver()
.rustc_commit_hash()
.emit()
.expect("Failed to generate `cargo` build instructions");
let cargo = config.cargo_mut();
*cargo.enabled_mut() = true;
*cargo.features_mut() = false;
*cargo.profile_mut() = true;
*cargo.target_triple_mut() = true;
let git = config.git_mut();
*git.enabled_mut() = true;
*git.commit_author_mut() = false;
*git.commit_count_mut() = false;
*git.commit_message_mut() = false;
*git.commit_timestamp_mut() = true;
*git.semver_mut() = true;
*git.semver_dirty_mut() = Some("-dirty");
*git.skip_if_error_mut() = true;
*git.sha_kind_mut() = ShaKind::Both;
*git.skip_if_error_mut() = true;
let rustc = config.rustc_mut();
*rustc.enabled_mut() = true;
*rustc.channel_mut() = false;
*rustc.commit_date_mut() = false;
*rustc.host_triple_mut() = false;
*rustc.llvm_version_mut() = false;
*rustc.semver_mut() = true;
*rustc.sha_mut() = true; // required for semver to be available
*rustc.skip_if_error_mut() = true;
let sysinfo = config.sysinfo_mut();
*sysinfo.enabled_mut() = false;
*sysinfo.os_version_mut() = false;
*sysinfo.user_mut() = false;
*sysinfo.memory_mut() = false;
*sysinfo.cpu_vendor_mut() = false;
*sysinfo.cpu_core_count_mut() = false;
*sysinfo.cpu_name_mut() = false;
*sysinfo.cpu_brand_mut() = false;
*sysinfo.cpu_frequency_mut() = false;
*sysinfo.skip_if_error_mut() = true;
vergen(config).expect("Failed to generate `cargo` build instructions");
writeln!(
&mut std::io::stdout(),
"cargo:rustc-env=CARGO_PROFILE={}",
std::env::var("PROFILE").expect("Failed to obtain `cargo` profile")
)
.expect("Failed to set `CARGO_PROFILE` environment variable");
}