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 vendored wire version's one file-shaped home, compiled in**
//! (bl-55b1).
//!
//! The repo-root `PROTOCOL` file states the integer this build speaks — one
//! line, nothing else — and this script turns it into the constant
//! `src/channel/hello.rs` includes. The file IS the source: there is no second
//! copy of the number to hold equal to it.
//!
//! **Why a file and not a Rust declaration.** This number is fetched by gates
//! that do not build this crate — yog's release gate reads it off this
//! repository's `main` before it will publish a bump (yog `docs/REMOTE.md`
//! §3), and this repository's own gate reads the engine's the same way — and a
//! Rust path is not a stable address for a fetch. yog split
//! `src/wire/hello.rs` into `src/wire/hello/version.rs` and left the old path
//! re-exporting: invisible to a build, unreadable to a regex, so this
//! repository's gate silently stopped being able to read the engine at all and
//! would have held its own release forever on the bump it was waiting for. A
//! top-level file with no extension is the one path a module split cannot
//! move, and every gate in all four repositories now reads it there.
//!
//! 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`.