From bcb733a2a64df1a7dc019be5545c44c31a4860b0 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Wed, 12 Jun 2024 16:38:09 -0400 Subject: [PATCH] build: justify hardcoded build.rs RUSTLS_CRATE_VERSION 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. --- build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.rs b/build.rs index f04125c9..5e4c14ee 100644 --- a/build.rs +++ b/build.rs @@ -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() {