Expand description
Build-time code generator that turns a versioned SBOL validation
rules.toml into Rust rule-catalog source.
The sbol2 and sbol3 crates each call generate from their build.rs,
pointing at their own rules.toml. This keeps one generator, one set of
catalog invariants, and one emitted shape across both data-model versions.
Cold-compile cost on a fresh target/ dir is roughly 30s because of the
toml+serde dep stack. Subsequent builds reuse the cached deps; a caller
re-runs the script only when its rules.toml, build.rs, or policies
directory changes (the caller emits the cargo:rerun-if-changed directives).
Outputs into out_dir:
rule_catalog.rs:VALIDATION_RULE_STATUSESslice literal, sorted by rule id for diff stability.rule_spec_meta.rs: theVALIDATION_RULE_SPEC_*constants sourced from the TOML[meta]block.
Failures (TOML parse error, unknown enum variant, missing required field, missing policy ADR) panic with a message that names the offending rule id and field, so a build failure points straight at the bad entry.
Functionsยง
- generate
- Generates
rule_catalog.rsandrule_spec_meta.rsintoout_dirfrom therules.tomlatrules_toml.