oxdock-buildtime-helpers

Crates.iooxdock-buildtime-helpers
lib.rsoxdock-buildtime-helpers
version0.6.0-alpha
created_at2025-12-20 16:22:08.164113+00
updated_at2025-12-25 17:46:10.819895+00
descriptionBuild script helpers for OxDock.
homepage
repositoryhttps://github.com/jzombie/oxdock-rs
max_upload_size
id1996677
size13,997
Jeremy Harris (jzombie)

documentation

README

oxdock-buildtime-helpers

Build-script helpers for forwarding Cargo feature/cfg information to OxDock's proc-macro execution environment.

This crate is intended to be called from a build.rs build script. It is not meant to run at application runtime.

Why this exists

Proc-macro processes do not receive CARGO_FEATURE_* or CARGO_CFG_* by default. Build scripts do. These helpers re-emit those values as cargo:rustc-env=... so proc-macros can read them and pass them into the OxDock environment (via BuiltinEnv).

Usage (build.rs)

fn main() {
    oxdock_buildtime_helpers::emit_feature_and_cfg_envs()
        .expect("failed to emit feature/cfg envs");
}

Functions

  • emit_feature_envs(): forward CARGO_FEATURE_* and CARGO_CFG_FEATURE
  • emit_cfg_envs(): forward CARGO_CFG_* derived from rustc --print cfg
  • emit_feature_and_cfg_envs(): calls both

When This Helper Is Needed

Item Helper Necessary?
FOO=1 cargo build No
CLI args sent to cargo run -- ... TBD
Available cargo features / cfgs Yes
All other environment variables No

License

Licensed under the Apache-2.0 License.

Commit count: 0

cargo fmt