Handle autolinking for pure C++ turbo modules without includesGeneratedCode#56938
Closed
satya164 wants to merge 5 commits into
Closed
Handle autolinking for pure C++ turbo modules without includesGeneratedCode#56938satya164 wants to merge 5 commits into
includesGeneratedCode#56938satya164 wants to merge 5 commits into
Conversation
…tedCode` Currently, pure C++ modules require `includesGeneratedCode: true`, and the library to be shipping codegen files to work. This is inconsistent with regular turbo modules that work with both setups. The issue is in 2 places: 1. CLI returns hardcoded default for C++ modules 2. Autolinking logic doesn't run codegen for C++ modules PR removing hardcoded default from CLI: react-native-community/cli#2799 This change updates the autolinking logic to detect pure C++ libraries without `includesGeneratedCode: true`, run codegen for them and use correct path for CMakeLists based on the codegen output.
3 tasks
|
@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D106094034. |
cortinico
requested changes
May 22, 2026
Comment on lines
+366
to
+372
| private fun configurePureCxxDependenciesCodegen( | ||
| project: Project, | ||
| extension: ReactExtension, | ||
| rootExtension: PrivateReactExtension, | ||
| generatedPureCxxSourceDir: Provider<Directory>, | ||
| dependencies: List<ModelAutolinkingDependenciesJson>, | ||
| ): List<TaskProvider<GenerateCodegenArtifactsTask>> { |
Contributor
There was a problem hiding this comment.
Here there is a bunch of duplicated code.
Can you extract the common logic from configureCodegen into a reusable helper, then call it here for pure C++ deps instead?
Contributor
Author
There was a problem hiding this comment.
@cortinico extracted duplicated task registration code to registerCodegenTasks
cortinico
approved these changes
May 28, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Code looks good but let's add a couple of tests for the 2 functions I suggested
Collaborator
|
This pull request was successfully merged by @satya164 in c789880 When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Currently, pure C++ modules require
includesGeneratedCode: true, and the library to be shipping codegen files to work. This is inconsistent with regular turbo modules that work with both setups.The issue is in 2 places:
PR removing hardcoded default from CLI: react-native-community/cli#2799
This change updates the autolinking logic to detect pure C++ libraries without
includesGeneratedCode: true, run codegen for them and use correct path for CMakeLists based on the codegen output.Changelog:
[ANDROID] [FIXED] - Fix pure C++ turbo modules not working without
includesGeneratedCode: trueTest Plan:
npx create-react-native-library@latest awesome-library --yes --description "my library" --type turbo-module --languages cppyarn example androidand notice that the build worksincludesGeneratedCode: true:yarn example androidand notice that the build failscmakeListsPathfor pure c++ modules react-native-community/cli#2799 and notice that the module works correctlyscreenshot from the test library: