build-data-0.1.0 has been yanked.
build-data
Include build data in your program.
Features
- Saves build-time data:
- Git commit, branch, and dirtiness
- Date & time
- Epoch time
- Hostname
- Rustc version
- Does all of its work in your
build.rs. - No macros
- Depends only on
core::alloc forbid(unsafe_code)- 100% test coverage
Alternatives
build-info- Mature & popular
- Confusing API
- Uses procedural macros
Example
// Cargo.toml
[]
= "0"
[]
= "0"
Add a build.rs
file next to your Cargo.toml.
Call build_data_writer::write
to collect data and write it to the file.
// build.rs
use env;
use Path;
When you run cargo build, Cargo compiles and runs your build.rs which
writes the file:
// target/build-data.txt
GIT_BRANCH:release
GIT_COMMIT:a5547bfb1edb9712588f0f85d3e2c8ba618ac51f
GIT_DIRTY:false
HOSTNAME:builder2
RUSTC_VERSION:rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
TIME:2021-04-14T06:25:59+00:00
TIME_SECONDS:1618381559
Include and parse the file in your program.
See include_str!,
concat!,
env!, and
build_data::BuildData::new.
// src/bin/main.rs
Cargo Geiger Safety Report
Metric output format: x/y
x = unsafe code used by the build
y = total unsafe code found in the crate
Symbols:
🔒 = No `unsafe` usage found, declares #![forbid(unsafe_code)]
❓ = No `unsafe` usage found, missing #![forbid(unsafe_code)]
☢️ = `unsafe` usage found
Functions Expressions Impls Traits Methods Dependency
0/0 0/0 0/0 0/0 0/0 🔒 build-data 0.1.0
0/0 0/0 0/0 0/0 0/0
Changelog
- v0.1.0 - Initial version
Happy Contributors 🙂
Fixing bugs and adding features is easy and fast. Send us a pull request and we intend to:
- Always respond within 24 hours
- Provide clear & concrete feedback
- Immediately make a new release for your accepted change
License: Apache-2.0