Skip to content

Generate one file per XDR type#520

Merged
leighmcculloch merged 9 commits intomainfrom
separate-files
Mar 27, 2026
Merged

Generate one file per XDR type#520
leighmcculloch merged 9 commits intomainfrom
separate-files

Conversation

@leighmcculloch
Copy link
Copy Markdown
Member

@leighmcculloch leighmcculloch commented Mar 25, 2026

What

Change the XDR Rust code generator to output one .rs file per type definition instead of a single generated.rs file.

Why

A single 74k-line generated.rs is unwieldy for navigation, IDE indexing, and incremental compilation. Splitting into per-type files makes it easier to find types, improves compile-time caching when only a subset of types change, and aligns with how hand-written Rust crates organize modules.

There is no issue driving this improvement, however the following changes have really made it easier to make this change now:

@leighmcculloch leighmcculloch marked this pull request as ready for review March 25, 2026 13:45
Copilot AI review requested due to automatic review settings March 25, 2026 13:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the build/cleanup wiring to support splitting XDR-generated Rust output into multiple files (instead of a single large generated.rs), improving formatting coverage and cleanup behavior.

Changes:

  • Run rustfmt over both the legacy target and the new per-type generated .rs files.
  • Extend make clean to remove the generated output directory.
Comments suppressed due to low confidence (1)

Makefile:51

  • xdr-json still depends on src/generated.rs, but the PR description says generation is moving away from a single generated.rs file. This dependency should be updated to depend on the new artifact that represents a completed generation step (e.g., a src/generated/mod.rs entrypoint, or a dedicated stamp file like src/generated/.stamp that the generator touches at the end). Otherwise make xdr-json may not rebuild when per-type outputs change, or may fail if src/generated.rs is no longer produced.
xdr-json: src/generated.rs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile Outdated
@leighmcculloch leighmcculloch requested a review from sisuresh March 25, 2026 14:01
@leighmcculloch leighmcculloch added this pull request to the merge queue Mar 27, 2026
Merged via the queue into main with commit a7d6f1c Mar 27, 2026
15 of 16 checks passed
@leighmcculloch leighmcculloch deleted the separate-files branch March 27, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants