build-info

Collect compile-time build information about your Rust crate and expose it at runtime.

Library
Cargo
v0.0.46
24stars

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
48/100Fair
Development Activity72
Maintenance32
Community16
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture82
Code Quality80
Innovation74
Learning Curve70

build-info collects build-time information about a Rust crate — version, git commit, compiler version, build timestamp, and dependency data — and makes it available at runtime through macros. A companion build-info-build crate gathers the data in build.rs, keeping heavy compile-only dependencies like git2 out of the final binary, while the build_info! and format! macros surface the results.

What You Get

  • A build_info! macro that generates a function returning version data at runtime
  • A compile-time format! macro for embedding build strings directly
  • Git, compiler, timestamp, and dependency-tree metadata collection
  • Optional serde support and no_std-friendly usage

Common Use Cases

  • Embedding a rich —version string with git commit and build date
  • Reporting the exact compiler and dependency versions in bug reports
  • Surfacing build provenance in logs or an application’s about screen

Under The Hood

Architecture

The workspace separates concerns across crates: build-info-build runs in build.rs (using git2, rustc_version, and cargo_metadata) to gather data, serializes it compactly with ciborium and z85, and stores it; build-info-proc provides the proc-macros; build-info-common holds shared types; and build-info exposes the build_info! and format! macros that decode and surface the collected information at runtime.

Tech Stack

Rust (edition 2024, MSRV 1.88) organized as a Cargo workspace. Collection relies on git2, rustc_version, cargo_metadata, chrono, and serde_json; encoding uses ciborium, z85, and zstd; and the macros are built with syn, quote, proc-macro2, and manyhow.

Code Quality

The multi-crate layout cleanly isolates compile-only dependencies from the runtime crate, and the code uses pretty_assertions in tests and compact binary encodings. It is actively maintained with frequent releases, and a sample crate in the workspace demonstrates both macro paths end to end.

API Design

Setup requires two dependency entries plus one build_script() call, after which the build_info! and format! macros provide an ergonomic read path. The dollar-sign field syntax in format! is powerful but adds a small learning curve compared with a single-function API.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search