build_info.rs 659 B

1234567891011121314151617181920212223
  1. //! Build-time identity of this binary.
  2. //!
  3. //! The version comes from `SM121_VERSION` at compile time: the add-on CI passes
  4. //! it as a Docker build arg, the builder stage exports it, and `build.rs` writes
  5. //! it into `OUT_DIR/build_version.rs` (so a warm cargo cache cannot keep the old
  6. //! literal). A plain `cargo build` reports `dev`.
  7. include!(concat!(env!("OUT_DIR"), "/build_version.rs"));
  8. /// The version baked in at build time (`dev` for a local build).
  9. pub fn version() -> &'static str {
  10. VERSION
  11. }
  12. #[cfg(test)]
  13. mod tests {
  14. use super::version;
  15. #[test]
  16. fn version_is_never_empty() {
  17. assert!(!version().is_empty());
  18. }
  19. }