-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add separateDataFiles
to @rnw/cli and @rnw/codegen
#11990
Conversation
Can we split the two files into separate generators, which would align with core where there are separate generators for the cpp vs h files? |
Both file needs the input (in the intermediate format) to be compiled again to identify anonymous custom types before generating it, they shared many complex logic. I think it is good to just keep them in one generator. |
5ea8cb2
to
8dcc50a
Compare
f44cead
to
69f918a
Compare
allInOne
to @rnw/cli and @rnw/codegen787e00b
to
322793d
Compare
641525b
to
7bed9f6
Compare
7bed9f6
to
8d3ba52
Compare
8d3ba52
to
1491b37
Compare
separateDataFiles
to @rnw/cli and @rnw/codegen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Add `allInOne` to `createNM2Generator` * Add `allInOne` to @rnw/cli and @rnw/codegen * ... * ... * ... * Update sample-apps * Change files * Fix code review comment * Remove `allInOne` option and make it always happen * Update generated files * Update #include * Fix build break * Suppress clang-format on some include order
* Add `allInOne` to `createNM2Generator` * Add `allInOne` to @rnw/cli and @rnw/codegen * ... * ... * ... * Update sample-apps * Change files * Fix code review comment * Remove `allInOne` option and make it always happen * Update generated files * Update #include * Fix build break * Suppress clang-format on some include order
* @rnw/codegen generates GetStructInfo instead of REACT_STRUCT (#11982) * #include <NativeModules.h> * Separate custom types and reflection in template * Generate GetStructInfo function instead of REACT_STRUCT * ... * Update generated files * Change files * ... * Generate types and spec in two files for turbo module (#11990) * Add `allInOne` to `createNM2Generator` * Add `allInOne` to @rnw/cli and @rnw/codegen * ... * ... * ... * Update sample-apps * Change files * Fix code review comment * Remove `allInOne` option and make it always happen * Update generated files * Update #include * Fix build break * Suppress clang-format on some include order * ... * Change files * Update packages.lock.json
* @rnw/codegen generates GetStructInfo instead of REACT_STRUCT (#11982) * #include <NativeModules.h> * Separate custom types and reflection in template * Generate GetStructInfo function instead of REACT_STRUCT * ... * Update generated files * Change files * ... * Generate types and spec in two files for turbo module (#11990) * Add `allInOne` to `createNM2Generator` * Add `allInOne` to @rnw/cli and @rnw/codegen * ... * ... * ... * Update sample-apps * Change files * Fix code review comment * Remove `allInOne` option and make it always happen * Update generated files * Update #include * Fix build break * Suppress clang-format on some include order * ... * Change files * Update packages.lock.json
Description
Type of Change
Why
In devmain there are already requirements that, types involved in a turbo module needs to be part of the API.
Such project structure would be:
When a feature needs to be available to both C++ and JS, it is possible that the API and the turbo module will share some data structures. If by semantic they are always exactly the same, why not just publish generated types?
What
In order to complete the story, the turbo module C++ codegen needs to generate a clean header files for custom types if required. Setting
codegenConfig.windows.separateDataTypes
does this.Testing
Tested in
sample-apps
Changelog
Should this change be included in the release notes: yes
npx react-native codegen-windows
will generate two files if there is any custom type to generate. The additional fileNativeXXXDataTypes.g.h
contains all generated custom types.Microsoft Reviewers: codeflow:open?pullrequest=https://github.com/microsoft/react-native-windows/pull/11990&drop=dogfoodAlpha