Skip to content

Use fork-sync and make a local copy of fmt#15919

Open
vmoroz wants to merge 3 commits intomicrosoft:mainfrom
vmoroz:PR/fork-sync-fmt
Open

Use fork-sync and make a local copy of fmt#15919
vmoroz wants to merge 3 commits intomicrosoft:mainfrom
vmoroz:PR/fork-sync-fmt

Conversation

@vmoroz
Copy link
Copy Markdown
Member

@vmoroz vmoroz commented Apr 2, 2026

Description

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

Third-party dependencies in RNW (fmt, Folly, ReactCommon) use a bespoke
MSBuild download-unzip-overlay pipeline that has no conflict detection, no
3-way merge, and duplicates the same concepts per library. This PR begins
adopting @rnx-kit/fork-sync — the same tool used in hermes-windows — to get
Git 3-way merges, AI-assisted conflict resolution, and a unified
manifest-driven workflow.

fmt is the first dependency to migrate because it is the simplest case: a
small library with no active patches.

What

Phase 0 — fork-sync infrastructure:

  • Created @rnw-scripts/fork-sync package — thin wrapper that invokes
    @rnx-kit/fork-sync with -C pointing to the repo root.
  • Added sync-manifest.json at the repo root listing fmt as the first
    managed dependency.
  • Added /.sync/ to .gitignore (fork-sync's working directory).
  • Added fork-sync and fork-sync:status scripts to root package.json.

Phase 1 — migrate fmt to fork-sync:

  • Committed fmt 11.0.2 source into vnext/external/fmt/ with
    sync-config.json, .syncignore, and cgmanifest.json.
  • Added vnext/external/.clang-format (DisableFormat: true) to prevent
    formatting of vendored source files.
  • Moved fmt ClCompile/ClInclude entries into Shared.vcxitems — fmt is
    now compiled inline instead of as a separate static library.
  • Added a shared <ClCompile Update="$(ExternalDir)**"> block in
    Shared.vcxitems so all future external sources automatically get the
    right compiler settings (no PCH, no WinRT, common preprocessor defs).
  • Defined $(ExternalDir) in Directory.Build.props pointing to
    vnext\external\.
  • Updated fmt include paths in React.Cpp.props, Folly.vcxproj, and
    Microsoft.ReactNative.vcxproj from $(FmtDir)include to
    $(ExternalDir)fmt\include.
  • Removed FmtVersion, FmtCommitHash, and FmtDir properties from
    Directory.Build.props.
  • Deleted vnext/fmt/ directory (vcxproj, filters, pch files,
    clang-format, packages.lock.json).
  • Removed fmt project entry and build configurations from 12 .sln files
    and 2 .slnf files.
  • Removed ProjectReference to fmt from Folly.vcxproj.

Screenshots

N/A

Testing

  • Built Microsoft.ReactNative.vcxproj (Debug|x64) — fmt compiles
    correctly as part of Shared.
  • Built Folly.vcxproj (Debug|x64) — finds fmt headers via updated
    include path.
  • Built React.Windows.Desktop.DLL.vcxproj (Debug|x64) — Desktop target
    also works.
  • Verified yarn format no longer reformats vendored fmt source (thanks
    to vnext/external/.clang-format).

Changelog

Should this change be included in the release notes: no

Microsoft Reviewers: Open in CodeFlow

@vmoroz vmoroz requested review from a team as code owners April 2, 2026 19:20
@Saadnajmi
Copy link
Copy Markdown
Contributor

Can we not pull fmt as a package and patch it if need be? Do we need a source copy?

@vmoroz
Copy link
Copy Markdown
Member Author

vmoroz commented Apr 2, 2026

Can we not pull fmt as a package and patch it if need be? Do we need a source copy?

All major OSS projects typically have a local copy of 3rd party code. It makes it easy to support them.
For us having the sources in our repo makes it easy to investigate issues in the crash dumps and do any quick changes.
The new fork-sync tool makes it trivial to support such local forks.

@Saadnajmi
Copy link
Copy Markdown
Contributor

Can we not pull fmt as a package and patch it if need be? Do we need a source copy?

All major OSS projects typically have a local copy of 3rd party code. It makes it easy to support them. For us having the sources in our repo makes it easy to investigate issues in the crash dumps and do any quick changes. The new fork-sync tool makes it trivial to support such local forks.

That's not true? Most OSS projects use a package or dep manager to download them?

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.

2 participants