Skip to content

refactor: generate codegen in the app instead of shipping it - #1121

Open
hryhoriiK97 wants to merge 1 commit into
mainfrom
refactor/stop-shipping-codegen
Open

hryhoriiK97 wants to merge 1 commit into
mainfrom
refactor/stop-shipping-codegen

Conversation

@hryhoriiK97

Copy link
Copy Markdown
Collaborator

What/Why?

Follow-up to #1119, which is a temporary fix.

The package shipped codegen output (includesGeneratedCode: true), generated with the RN version it was published
with. Newer RN can change what that code calls: the 0.89 nightly deprecated the invokeJavaMethod overload our
shipped Java TurboModule glue used (facebook/react-native#59619),
which broke the Android nightly build. With this change the app generates the code with its own RN version, so
codegen changes in RN can no longer break the shipped code.

  • package.json: drop includesGeneratedCode, outputDir and the bob codegen target.
  • Android: both CMakeLists read the RN Gradle plugin's build/generated/source/codegen/jni; the plugin adds the
    generated Java sources itself, so generated/* comes out of build.gradle. Removes the temporary
    -Wno-error=deprecated-declarations flag from fix(android): build against RN nightly's deprecated invokeJavaMethod overload #1119.
  • iOS: generated headers are imported from the app's ReactCodegen pod
    (react/renderer/components/EnrichedMarkdownTextSpec/...) instead of our own pod. The podspec drops the
    ios/generated/ReactCodegen header path and excludes any leftover ios/generated.

Consumers don't need to do anything: the app's build already runs codegen for libraries that don't ship it.

Testing

  • Example app :app:assembleDebug on RN 0.88
  • Example app iOS simulator build on RN 0.88 (ReactCodegen contains EnrichedMarkdownTextSpec)
  • Android build on react-native@nightly
  • Example app runs on iOS and Android (rendering, block slots / EnrichedMarkdownParser)
  • macOS example (RN 0.81)
  • use_frameworks! / Expo prebuild

Unrelated: plain assembleDebug fails in :display-benchmark on main too (BlockSlotMeasureSession.h not on its
include path since #1027).

PR Checklist

  • Code compiles and runs on iOS
  • Code compiles and runs on Android
  • Updated documentation/README if applicable
  • Ran example app to verify changes
  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

The package shipped codegen output generated with the RN version it was
published with (includesGeneratedCode). Newer RN can change what that code
calls, as the 0.89 nightly did by deprecating the invokeJavaMethod overload
the shipped Java TurboModule glue used, so the code now comes from the app's
own codegen run, matching its RN version.

- package.json: drop includesGeneratedCode, outputDir and the bob codegen
  target.
- Android: CMake reads the RN Gradle plugin's build/generated/source/codegen
  output; the plugin adds the generated Java sources itself. Removes the
  temporary -Wno-error=deprecated-declarations flag.
- iOS: import generated headers from the app's ReactCodegen pod
  (react/renderer/components/EnrichedMarkdownTextSpec/...), drop the
  ios/generated header path and exclude any leftover ios/generated.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hryhoriiK97
hryhoriiK97 marked this pull request as ready for review November 2, 2026 11:06
@hryhoriiK97
hryhoriiK97 requested a review from jnowakow November 2, 2026 11:06

This branch has not been deployed

No deployments
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