Skip to content

Commit 35192a3

Browse files
committed
fixup: timestamp version
1 parent 0f2881e commit 35192a3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

dfx/src/lib/env.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,25 @@ impl VersionEnv for GlobalEnvironment {
174174

175175
impl GlobalEnvironment {
176176
pub fn from_current_dir() -> DfxResult<GlobalEnvironment> {
177-
let mut version = DFX_VERSION.to_owned();
178-
179177
#[cfg(debug_assertions)]
180178
{
181179
// In debug, add a timestamp of the compilation at the end of version to ensure all
182180
// debug runs are unique (and cached uniquely).
183-
version = version + "-" + env!("DFX_TIMESTAMP_DEBUG_MODE_ONLY");
181+
Ok(GlobalEnvironment {
182+
version: format!(
183+
"{}-{:?}",
184+
DFX_VERSION.to_owned(),
185+
std::env::var_os("DFX_TIMESTAMP_DEBUG_MODE_ONLY")
186+
.unwrap_or_else(|| std::ffi::OsString::from("local-debug"))
187+
),
188+
})
184189
}
185190

186-
Ok(GlobalEnvironment { version })
191+
#[cfg(not(debug_assertions))]
192+
{
193+
Ok(GlobalEnvironment {
194+
version: DFX_VERSION.to_owned(),
195+
})
196+
}
187197
}
188198
}

0 commit comments

Comments
 (0)