Skip to content

Commit

Permalink
build: justify hardcoded build.rs RUSTLS_CRATE_VERSION
Browse files Browse the repository at this point in the history
This commit adds some commentary to the `build.rs`
`RUSTLS_CRATE_VERSION` const, justifying why we keep it in-sync
manually.

Initially I was thinking about deducing the `RUSTLS_CRATE_VERSION` in
the `build.rs` script automatically by parsing `Cargo.toml`, but after
thinking through the sensitivity of `build.rs`, and realizing the
parsing would require a new _non-development_ dependency, I abandoned
the idea.

The recently added integration test will catch anyone forgetting to sync
the const and avoids extra deps or complexity in the build script.
  • Loading branch information
cpu committed Jun 12, 2024
1 parent 8a745e3 commit 7418eeb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ use std::io::Write;
use std::{env, fs, path::PathBuf};

// Keep in sync with Cargo.toml.
//
// We don't populate this automatically from the Cargo.toml at build time
// because doing so would require a heavy-weight deserialization lib dependency
// (and it couldn't be a _dev_ dep for use in a build script) or doing brittle
// by-hand parsing.
const RUSTLS_CRATE_VERSION: &str = "0.23.4";

fn main() {
Expand Down

0 comments on commit 7418eeb

Please sign in to comment.