+ **`SharedCorpusContext` lets a workspace that generates one crate per proto package pay the corpus-wide codegen analysis once** (#401, closes #400). `generate()` re-derives which oneof variants are unboxed, which message fields are stored inline, and the per-symbol comment map from the whole `FileDescriptorSet` on every call, although none of that depends on the per-package `extern_paths`; a ~2900-package workspace paid that walk 2900 times. Build a `SharedCorpusContext::new(&files, &config)` once and set `CodeGenConfig::shared_corpus_context` on each per-package config; the output is byte-identical, and a context built from a different corpus or different oneof/pointer-repr rules is refused with `CodeGenError::SharedCorpusContextMismatch` rather than silently resolving against the wrong one. The corpus comparison is structural, not by file name, so a regenerated `FileDescriptorSet` with edited content is refused too; it costs `O(corpus)` per call, measured at roughly a quarter of the name-only comparison's saving on that workspace and still well ahead of not sharing. Off by default.
0 commit comments