# V2 Reproducible Builds

`V2/ue/Tools/plan-v2-reproducible-builds.py` expands
`V2/ue/Build/Reproducible/v2-reproducible-builds.json` into two build passes for
every release-critical artifact. The contract fixes the timestamp and locale
with `SOURCE_DATE_EPOCH=1781740800`, `TZ=UTC`, `LC_ALL=C.UTF-8`, and
`LANG=C.UTF-8`, disables incremental Rust output with `CARGO_INCREMENTAL=0`, and
remaps host paths with `--remap-path-prefix=$(Workspace)=/workspace`.

Rust commands run with `--locked`, a stable target directory per pass, and
`-Ccodegen-units=1`. Unreal BuildGraph commands receive
`-Set:SourceDateEpoch=1781740800` and `-Set:DeterministicBuild=1`. Generated
plans, such as the shader distribution plan, are treated as artifacts and hashed
like binaries.

Every pass writes a normalized archive command using
`tar --sort=name --mtime=@1781740800 --owner=0 --group=0 --numeric-owner`. The
digest step uses `compare-v2-reproducible-artifacts.py --write-manifest` to emit
a SHA-256 manifest. The comparison step reruns
`compare-v2-reproducible-artifacts.py` against pass A and pass B manifests and
fails if `build.reproducible.digest_mismatch_count` is nonzero.

Required gates:

- `reproducible-build-plan-generated`
- `reproducible-build-digest-match`
- `reproducible-build-target-coverage`
- `reproducible-build-source-date-epoch`

The release evidence path is
`$(ArchiveRoot)/Reproducible/reproducible-build-plan.json`. The CI validator is:

```bash
python3 V2/ue/Tools/check-v2-reproducible-builds.py
```
