-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Exclude selectively disabled libraries from codegen generation #51078
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
Conversation
Hi @ismarbesic! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
packages/react-native/scripts/codegen/generate-artifacts-executor/index.js
Show resolved
Hide resolved
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.
The code looks good to me. Thanks for fixing this issue!
packages/react-native/scripts/codegen/generate-artifacts-executor/index.js
Show resolved
Hide resolved
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi merged this pull request in be8595b. |
This pull request was successfully merged by @ismarbesic in be8595b When will my fix make it into a release? | How to file a pick request? |
Summary: Selectively disabling autolinking of a native dependency with components registered in the codegen configuration in react-native.config.js causes builds to crash upon launch on iOS. This is because the generated `RCTThirdPartyComponentsProvider.mm` file contains references to the excluded library using `NSClassFromString` causing the returned NSDictionary from `+[RCTThirdPartyComponentsProvider thirdPartyFabricComponents]` to be populated with nil values and therefore crashing the app. This has been confirmed in 0.78.2 and 0.79.2 but probably exists in 0.77.x as well. The issue has been further described in #51077. ## Changelog: [IOS][FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js Pull Request resolved: #51078 Test Plan: 1. Install a library that has the componentProvider field set in the codegen config (see reproducer) and install the iOS pods. 2. Build the app. 3. App should run successfully without any crashes. Reviewed By: cortinico Differential Revision: D74248371 Pulled By: cipolleschi fbshipit-source-id: 1ff7b477ed3d94ca45616ae243d3d2d30bd897db
This pull request was successfully merged by @ismarbesic in 7ce8f12 When will my fix make it into a release? | How to file a pick request? |
…ion (#51838) Summary: PR #51078 Implemented finding disabled libraries but the code (below) didn't actually filter any libraries out because destructured name is `undefined`. This pr adds the name to codegenEnabledLibraries so filtering would work. ```js const libraries = codegenEnabledLibraries.filter( ({name}) => !disabledLibraries.includes(name), ); ``` ## Changelog: [IOS] [FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js Pull Request resolved: #51838 Test Plan: 1. Install a library that has the componentProvider field set in the codegen config (for example: react-native-safe-area-context and react-native-screens or see [reproducer](https://github.com/aattola/rn-codegen-exclude)) 2. Exclude library with react-native.config.js 3. install pods / run codegen 4. Check that codegen actually excluded the specified dependencies from: `ios/build/generated/ios/RCTThirdPartyComponentsProvider.mm` Rollback Plan: Reviewed By: cortinico Differential Revision: D76044622 Pulled By: cipolleschi fbshipit-source-id: 9e70c2a263c750edb1ea95305c9e5e178e2ce8d8
…ion (#51838) Summary: PR #51078 Implemented finding disabled libraries but the code (below) didn't actually filter any libraries out because destructured name is `undefined`. This pr adds the name to codegenEnabledLibraries so filtering would work. ```js const libraries = codegenEnabledLibraries.filter( ({name}) => !disabledLibraries.includes(name), ); ``` ## Changelog: [IOS] [FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js Pull Request resolved: #51838 Test Plan: 1. Install a library that has the componentProvider field set in the codegen config (for example: react-native-safe-area-context and react-native-screens or see [reproducer](https://github.com/aattola/rn-codegen-exclude)) 2. Exclude library with react-native.config.js 3. install pods / run codegen 4. Check that codegen actually excluded the specified dependencies from: `ios/build/generated/ios/RCTThirdPartyComponentsProvider.mm` Rollback Plan: Reviewed By: cortinico Differential Revision: D76044622 Pulled By: cipolleschi fbshipit-source-id: 9e70c2a263c750edb1ea95305c9e5e178e2ce8d8
Summary: Selectively disabling autolinking of a native dependency with components registered in the codegen configuration in react-native.config.js causes builds to crash upon launch on iOS. This is because the generated `RCTThirdPartyComponentsProvider.mm` file contains references to the excluded library using `NSClassFromString` causing the returned NSDictionary from `+[RCTThirdPartyComponentsProvider thirdPartyFabricComponents]` to be populated with nil values and therefore crashing the app. This has been confirmed in 0.78.2 and 0.79.2 but probably exists in 0.77.x as well. The issue has been further described in #51077. [IOS][FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js Pull Request resolved: #51078 Test Plan: 1. Install a library that has the componentProvider field set in the codegen config (see reproducer) and install the iOS pods. 2. Build the app. 3. App should run successfully without any crashes. Reviewed By: cortinico Differential Revision: D74248371 Pulled By: cipolleschi fbshipit-source-id: 1ff7b477ed3d94ca45616ae243d3d2d30bd897db
Summary:
Selectively disabling autolinking of a native dependency with components registered in the codegen configuration in react-native.config.js causes builds to crash upon launch on iOS. This is because the generated
RCTThirdPartyComponentsProvider.mm
file contains references to the excluded library usingNSClassFromString
causing the returned NSDictionary from+[RCTThirdPartyComponentsProvider thirdPartyFabricComponents]
to be populated with nil values and therefore crashing the app. This has been confirmed in 0.78.2 and 0.79.2 but probably exists in 0.77.x as well.The issue has been further described in #51077.
Changelog:
[IOS][FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js
Test Plan: