1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! **The wire version's one file-shaped home, compiled in** (bl-3e57).
//!
//! The repo-root `PROTOCOL` file states the integer this build speaks — one
//! line, nothing else — and this script turns it into the constant
//! `src/wire/hello/version.rs` includes. The file IS the source: there is no
//! second copy of the number anywhere in the tree, so there is nothing to hold
//! equal to it and nothing that can go stale against it.
//!
//! **Why a file and not a Rust declaration.** Four repositories gate on this
//! number — yog's release-ordering gate reads the three consumers' mains, and
//! each consumer's own gate reads yog's newest published tag (REMOTE §3) — and
//! every one of those reads is a fetch of one path out of a tree the reader
//! does not build. A Rust path is not a stable address for that: bl-94a5 split
//! `src/wire/hello.rs` into `src/wire/hello/version.rs` and left the old file
//! re-exporting, which is invisible to a build and fatal to a regex, so every
//! consumer's gate silently stopped being able to read the engine's number and
//! would have held its release forever on a bump that had already landed
//! (thrall bl-c618). A repo-root file with no extension is the one address a
//! module split cannot move.
//!
//! Errors here fail the build, which is the correct loudness: a `PROTOCOL`
//! file that is missing or is not one integer means nothing downstream can be
//! trusted to have read it either.
use env;
use Error;
use fs;
use PathBuf;
/// Read the root `PROTOCOL` file and write the constant into `OUT_DIR`.