Skip to content

Commit acdd633

Browse files
authored
fix(windows): workaround for MSB4006 circular dependency in CppWinRT (#2803)
1 parent 488d840 commit acdd633

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

.github/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
- packages/app/scripts/init.mjs
6565
- packages/app/scripts/template.mjs
6666
- packages/app/scripts/build/xcodebuild.sh
67+
- packages/example-macos/**/*
6768
"platform: visionOS":
6869
- changed-files:
6970
- any-glob-to-any-file:
@@ -103,3 +104,4 @@
103104
- packages/app/scripts/init.mjs
104105
- packages/app/scripts/template.mjs
105106
- packages/app/windows/**/*
107+
- packages/example-windows/**/*

.yarn/plugins/undo-bin-sorting.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = {
2424
// @ts-expect-error Yarn internal package
2525
const { npath } = require("@yarnpkg/fslib");
2626
const fs = require("node:fs");
27+
const { EOL } = require("node:os");
2728

2829
const asText = /** @type {const} */ ({ encoding: "utf-8" });
2930

@@ -67,10 +68,9 @@ module.exports = {
6768
for (let i = 0; i < length; ++i) {
6869
if (bin[i] !== orig_bin[i]) {
6970
manifest.bin = orig_manifest.bin;
70-
const fd = fs.openSync(manifestPath, "w", 0o644);
71-
fs.writeSync(fd, JSON.stringify(manifest, undefined, 2));
72-
fs.writeSync(fd, "\n");
73-
fs.closeSync(fd);
71+
const serialized = JSON.stringify(manifest, undefined, 2);
72+
const reverted = serialized.replace(/\r?\n/g, EOL) + EOL;
73+
fs.writeFileSync(manifestPath, reverted, asText);
7474
break;
7575
}
7676
}

packages/app/windows/Win32/ReactApp.Package.wapproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<BackgroundTaskDebugEngines>NativeOnly</BackgroundTaskDebugEngines>
1111
</PropertyGroup>
1212
<PropertyGroup Label="ReactNativeWindowsProps">
13-
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)'==''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
13+
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)'==''">$([MSBuild]::GetDirectoryNameOfFileAbove($(SolutionDir), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
1414
</PropertyGroup>
1515
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.WindowsSdk.Default.props" />
1616
<PropertyGroup>

packages/app/windows/Win32/ReactApp.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<Import Project="$(SolutionDir)\ExperimentalFeatures.props" Condition="Exists('$(SolutionDir)\ExperimentalFeatures.props')" />
44
<PropertyGroup Label="Globals">
55
<CppWinRTOptimized>true</CppWinRTOptimized>
6+
<!-- Prevent MSB4006 circular dependency in CppWinRT during parallel builds (https://github.com/microsoft/cppwinrt/issues/950) -->
7+
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
68
<MinimalCoreWin>true</MinimalCoreWin>
79
<ProjectGuid>{B44CEAD7-FBFF-4A17-95EA-FF5434BBD79D}</ProjectGuid>
810
<ProjectName>ReactApp</ProjectName>

0 commit comments

Comments
 (0)