Skip to content

Commit 49e9748

Browse files
committed
feat: affix d to the end of debug vers
1 parent 5e3da34 commit 49e9748

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

shell.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44

55
with pkgs; mkShell {
66
buildInputs = [
7-
clang
7+
clang_14
88
curl
99
go
1010
iconv
11-
llvmPackages.libclang
11+
llvmPackages_14.libclang
1212
nettle
1313
openssl_1_1
1414
pkg-config
1515
protobuf
1616
rustup
1717
systemd
18+
rocksdb_7_10
1819
];
1920

2021
shellHook = ''
21-
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
22+
export LIBCLANG_PATH="${llvmPackages_14.libclang.lib}/lib";
2223
'';
2324
}

version/src/lib.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,29 +67,48 @@ impl Default for Version {
6767
major: env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
6868
minor: env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
6969
patch: env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
70-
commit: compute_commit(option_env!("CI_COMMIT")),
70+
commit: if cfg!(debug_assertions) {
71+
Some(0)
72+
} else {
73+
compute_commit(option_env!("CI_COMMIT"))
74+
},
7175
feature_set,
7276
}
7377
}
7478
}
7579

7680
impl fmt::Display for Version {
7781
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
78-
write!(f, "{}.{}.{}", self.major, self.minor, self.patch,)
82+
write!(
83+
f,
84+
"{}.{}.{}{} {:?}",
85+
self.major,
86+
self.minor,
87+
self.patch,
88+
if self.commit == Some(0) { "d" } else { "" },
89+
self
90+
)
7991
}
8092
}
8193

8294
impl fmt::Debug for Version {
8395
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8496
write!(
8597
f,
86-
"{}.{}.{} (src:{}; feat:{})",
98+
"{}.{}.{}{} (src:{}; feat:{})",
8799
self.major,
88100
self.minor,
89101
self.patch,
102+
if self.commit == Some(0) { "d" } else { "" },
90103
match self.commit {
91104
None => "devbuild".to_string(),
92-
Some(commit) => format!("{:08x}", commit),
105+
Some(commit) => {
106+
if commit == 0 {
107+
"dbgbuild".to_string()
108+
} else {
109+
format!("{:08x}", commit)
110+
}
111+
}
93112
},
94113
self.feature_set,
95114
)

0 commit comments

Comments
 (0)