set_SOURCE_DATE

Function set_SOURCE_DATE 

Source
pub fn set_SOURCE_DATE() -> Result<(), String>
Expand description

Sets the SOURCE_DATE env variable.

Call this from build.rs. Use env! in your main.rs to use the variable.

Example value: "2021-04-14Z"

Reads the SOURCE_DATE_EPOCH env var if set. Otherwise, runs git to get the value.

ยงErrors

Returns an error when:

  • SOURCE_DATE_EPOCH env var is non-empty and invalid
  • it fails to get the timestamp from git