mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-29 19:30:37 +00:00
feat: add common_version customization (#7869)
* feat: add product name customization * chore: update tests
This commit is contained in:
@@ -29,6 +29,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let refresh = profile == "release";
|
||||
|
||||
println!("cargo:rerun-if-env-changed=RUSTC");
|
||||
println!("cargo:rerun-if-env-changed=GREPTIME_PRODUCT_NAME");
|
||||
|
||||
// The "CARGO_WORKSPACE_DIR" is set manually (not by Rust itself) in Cargo config file, to
|
||||
// solve the problem where the "CARGO_MANIFEST_DIR" is not what we want when this repo is
|
||||
@@ -44,6 +45,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let product_version = load_product_version(&workspace_root);
|
||||
println!("cargo:rustc-env=GREPTIME_PRODUCT_VERSION={product_version}");
|
||||
|
||||
let product_name = load_product_name();
|
||||
println!("cargo:rustc-env=GREPTIME_PRODUCT_NAME={product_name}");
|
||||
|
||||
let repository = open_repository(&workspace_root);
|
||||
|
||||
if refresh {
|
||||
@@ -100,6 +104,10 @@ fn load_product_version(workspace_root: &Path) -> String {
|
||||
.unwrap_or_else(|| env::var("CARGO_PKG_VERSION").unwrap())
|
||||
}
|
||||
|
||||
fn load_product_name() -> String {
|
||||
env::var("GREPTIME_PRODUCT_NAME").unwrap_or_else(|_| "GreptimeDB".to_string())
|
||||
}
|
||||
|
||||
fn emit_workspace_watch_list(
|
||||
workspace_root: &Path,
|
||||
repository: Option<&Repository>,
|
||||
|
||||
@@ -109,6 +109,10 @@ pub const fn version() -> &'static str {
|
||||
BUILD_INFO.version
|
||||
}
|
||||
|
||||
pub const fn product_name() -> &'static str {
|
||||
env!("GREPTIME_PRODUCT_NAME")
|
||||
}
|
||||
|
||||
pub const fn verbose_version() -> &'static str {
|
||||
const_format::formatcp!(
|
||||
"\nbranch: {}\ncommit: {}\nclean: {}\nversion: {}",
|
||||
|
||||
Reference in New Issue
Block a user