Skip to content

Conversation

@hsjoberg
Copy link
Contributor

@hsjoberg hsjoberg commented Feb 17, 2025

Hi. This PR cherry-picks c0be76e (#14331) into 0.78.
It would be to nice include this one as otherwise JSI/Codegen is broken.

Cheers
Hampus

Microsoft Reviewers: Open in CodeFlow

## Description

### Type of Change
- Bug fix (non-breaking change which fixes an issue)

### Why

react-native-windows currently maintains its own forked C++ TurboModule bridging files.
For untouched stuff we copy JSI and TurboModule files from core react-native in `Layout-MSRN-Headers.ps1`.
However, this script misses to copy `Number.h`.

This causes compilation error when trying to import `react/bridging/Bridging.h`, which would be the case for example when using codegen to generate C++ TurboModule (JSI) bindings (note: this is for C++ JSI TurboModules, not react-native-windows's TurboModule system).

```
PS C:\Users\CocoT1\Projects\rn77> yarn example windows
[...]
Time Elapsed 00:00:00.61
✔ Restoring NuGet packages
 ✔ Auto-linking...
Success: No auto-linking changes necessary. (69ms)
 ✔ Found Solution: C:\Users\CocoT1\Projects\rn77\example\windows\rn77Example.sln
 ℹ Build configuration: Debug
 ℹ Build platform: x64
 ✖ Building Solution: Generating Code...
 ✖ Build failed with message 4:7>C:\Users\CocoT1\.nuget\packages\microsoft.reactnative.cxx\0.77.0-fabric\tools\Microsoft.ReactNative.Cxx\ReactCommon\react\bridging\Bridging.h(18,10): error C1083: Cannot open include file: 'react/bridging/Number.h': No such file or directory [C:\Users\CocoT1\Projects\rn77\example\windows\rn77Example\rn77Example.vcxproj]. Check your build configuration.
```

### What

I'm changing the `Layout-MSRN-Headers.ps1` script to also copy `Number.h`.
I think this should be enough for the nuget the contain to file, but I'm no expert here.

## Testing

Monkeypatched by copying over Number.h to the microsoft.reactnative.cxx nuget (`C:\Users\CocoT1\.nuget\packages\microsoft.reactnative.cxx\0.77.0-fabric\tools\Microsoft.ReactNative.Cxx\ReactCommon\react\bridging\`).

Works all good.

I don't know how to run the `Layout-MSRN-Headers.ps1` script locally.


Here's a create-react-native-library project:
https://github.com/hsjoberg/rnw-cxx-turbomodule
Note: it will fail to build unless you copy Number.h over to the nuget cache as explained earlier.
@hsjoberg hsjoberg requested review from a team as code owners February 17, 2025 13:48
@TatianaKapos
Copy link
Contributor

/azp run PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@microsoft microsoft deleted a comment from azure-pipelines bot Feb 19, 2025
@TatianaKapos
Copy link
Contributor

/azp run PR

@microsoft microsoft deleted a comment from azure-pipelines bot Feb 20, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@TatianaKapos
Copy link
Contributor

/azp run PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@TatianaKapos
Copy link
Contributor

/azp run PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@TatianaKapos TatianaKapos enabled auto-merge (squash) February 27, 2025 00:20
@TatianaKapos TatianaKapos merged commit afc4641 into microsoft:0.78-stable Feb 27, 2025
92 checks passed
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