Follow-up from a review comment on #2032 by @NickeZ:
We could make make bootstrap also install rustup and these tools and get rid of the versions in the Dockerfile. I think long term it would be good to have a make bootstrap that completely bootstraps the dev environment. Very good for short lived AI boxes.
(#2032 (comment))
Problem
The host toolchain versions live only in the Dockerfile:
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | CARGO_HOME=/opt/cargo sh -s -- --default-toolchain $(grep -oP '(?<=channel = ")[^"]+' rust-toolchain.toml) -y
RUN CARGO_HOME=/opt/cargo cargo install cbindgen --version 0.29.2 --locked
RUN CARGO_HOME=/opt/cargo cargo install bindgen-cli --version 0.72.1 --locked
RUN CARGO_HOME=/opt/cargo cargo install --path prost-build-proto --locked
Anyone building natively (macOS, or a fresh Linux box) has to replicate those by hand. #2032 documents them in BUILD.md, which helps, but now the versions are duplicated in two places and will drift.
Today make bootstrap only does:
bootstrap:
git submodule update --init --recursive
./scripts/bootstrap-cargo-config
Proposal
Make make bootstrap fully bootstrap a dev environment:
- Install/verify rustup and the toolchain pinned by
src/rust/rust-toolchain.toml.
- Install
cbindgen, bindgen-cli, and prost-build-proto at pinned versions.
- Keep the existing submodule + cargo-config steps.
- Single source of truth for the versions (e.g. a small file or variables in the Makefile) consumed by both
make bootstrap and the Dockerfile, so the container and native builds cannot drift.
- Be idempotent and skip work when the right versions are already installed.
- Trim the corresponding manual steps from
BUILD.md once this lands.
Open questions
- Should
make bootstrap install rustup itself (network + shell pipe), or detect it and instruct the user to install it?
- Does this need to work on both macOS and Linux, and how do the brew-installed dependencies (arm-gcc, etc.) fit in?
- Should there be a separate
make bootstrap-check for CI to assert no drift?
Follow-up from a review comment on #2032 by @NickeZ:
(#2032 (comment))
Problem
The host toolchain versions live only in the
Dockerfile:Anyone building natively (macOS, or a fresh Linux box) has to replicate those by hand. #2032 documents them in
BUILD.md, which helps, but now the versions are duplicated in two places and will drift.Today
make bootstraponly does:bootstrap: git submodule update --init --recursive ./scripts/bootstrap-cargo-configProposal
Make
make bootstrapfully bootstrap a dev environment:src/rust/rust-toolchain.toml.cbindgen,bindgen-cli, andprost-build-protoat pinned versions.make bootstrapand theDockerfile, so the container and native builds cannot drift.BUILD.mdonce this lands.Open questions
make bootstrapinstall rustup itself (network + shell pipe), or detect it and instruct the user to install it?make bootstrap-checkfor CI to assert no drift?