Skip to content

Commit af93072

Browse files
authored
add commit hash to version (#1016)
1 parent 5a438e5 commit af93072

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

pgml-extension/Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pgml-extension/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ csv = "1.2"
5353
[dev-dependencies]
5454
pgrx-tests = "=0.10.0"
5555

56+
[build-dependencies]
57+
vergen = { version = "8", features = ["build", "git", "gitcl"] }
58+
5659
[profile.dev]
5760
panic = "unwind"
5861
lto = "thin"

pgml-extension/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ fn main() {
1616
"cargo:link-args=-Wl,--version-script={}/ld.map",
1717
std::env::current_dir().unwrap().to_string_lossy(),
1818
);
19+
20+
vergen::EmitBuilder::builder().all_git().emit().unwrap();
1921
}

pgml-extension/src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub fn validate_shared_library() {
8484

8585
#[pg_extern(immutable, parallel_safe)]
8686
fn version() -> String {
87-
crate::VERSION.to_string()
87+
format!("{} ({})", crate::VERSION, crate::COMMIT)
8888
}
8989

9090
#[allow(clippy::too_many_arguments)]

pgml-extension/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ extern crate signal_hook;
77
use pgrx::*;
88

99
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
10+
pub const COMMIT: &str = env!("VERGEN_GIT_SHA");
1011

1112
pub mod api;
1213
pub mod bindings;

0 commit comments

Comments
 (0)