Skip to content

windows-metadata winrt metadata roundtrip validation#4704

Merged
kennykerr merged 6 commits into
masterfrom
winrt-roundtrip
Jul 16, 2026
Merged

windows-metadata winrt metadata roundtrip validation#4704
kennykerr merged 6 commits into
masterfrom
winrt-roundtrip

Conversation

@kennykerr

Copy link
Copy Markdown
Collaborator

Makes RDL the reviewable source of truth for all three metadata families (WinRT, Win32, WDK), with git diff enforcing lossless RDL ↔ winmd round-trips in CI.

What changed

  • tool_windowstool_winrt: WinRT's generator now inserts an RDL step so it's structurally identical to tool_win32 / tool_wdk:
    SDK Contracts winmds ──merge──▶ merged winmd (target/)
                         ──writer, split by namespace──▶ metadata/winrt/*.rdl   (committed)
                         ──reader──▶ crates/libs/bindgen/default/Windows.winmd  (committed, derived)
    
  • New metadata/winrt/ (343 per-namespace .rdl files): the committed, human-reviewable WinRT source of truth, mirroring metadata/win32 and metadata/wdk.
  • New tool_roundtrip: a fast, SDK-free validator (depends only on windows-rdl — no libclang, no NuGet) that re-derives every committed RDL corpus from its committed winmd and relies on git diff.
  • Removed tool_rdl_roundtrip: bitrotted, superseded by tool_roundtrip.
  • CI: added winrt and roundtrip to the .github/workflows/gen.yml matrix.
  • Docs: docs/crates/windows-rdl.md (design + study) and crates/libs/bindgen/default/readme.md.

One-time regen (expected)

  • Windows.winmd re-bases to its RDL-rebuilt form (semantically identical — decompiling old vs new winmd yields byte-identical RDL).
  • The RDL accessor shorthand doesn't record accessor parameter names, so the reader synthesizes canonical names. This normalizes generated params in the windows crate (value for property setters, handler/token for event add/remove) — cosmetic only: ABI, signatures, types, and vtable order are unchanged. windows-sys is untouched.
  • Stable thereafter: re-running tool_winrttool_package produces zero drift.

Validation

  • tool_winrt / tool_package idempotent (no drift on re-run).
  • tool_roundtrip: WinRT/Win32/WDK reproduce with clean git diff.
  • cargo clippy -p tool_winrt -p tool_roundtrip --all-targets clean; fmt clean.

@kennykerr kennykerr merged commit f0a52dd into master Jul 16, 2026
34 checks passed
@kennykerr kennykerr deleted the winrt-roundtrip branch July 16, 2026 21:27
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.

1 participant