Skip to content

Generate RCTAppDependencyProvider for apps #47650

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

Closed
wants to merge 3 commits into from

Conversation

cipolleschi
Copy link
Contributor

Summary:

This Change:

This change generates the RCTAppDependencyProvider for the apps, so that the amount of changes required by the users is minimal.

Context

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

Changelog:

[iOS][Added] - Introduce the RCTAppDependencyProvider to minimize the changes required y the users

Differential Revision: D66074456

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Nov 17, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66074456

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66074456

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 17, 2024
Summary:

## This Change:

This change generates the `RCTAppDependencyProvider` for the apps, so that the amount of changes required by the users is minimal.

## Context

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

## Changelog:
[iOS][Added] - Introduce the RCTAppDependencyProvider to minimize the changes required y the users

Differential Revision: D66074456
Summary:

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

This change introduces the RCTDependencyProvider protocol to invert this dependency.

## Changelog:
[iOS][Added] - Add RCTDependencyProvider protocol

Differential Revision: D66074409
Summary:

## This Change:

This change uses the `RCTDependencyProvider` protocol created before, breaking the dependency between the RCTAppDelegate and codegen.

## Context

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

## Changelog:
[iOS][Breaking] - Use the RCTDependencyProvider in the RCTAppDelegate, breaking the dependency with Codegen

Differential Revision: D66074438
Summary:

## This Change:

This change generates the `RCTAppDependencyProvider` for the apps, so that the amount of changes required by the users is minimal.

## Context

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

## Changelog:
[iOS][Added] - Introduce the RCTAppDependencyProvider to minimize the changes required y the users

Differential Revision: D66074456
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66074456

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Nov 18, 2024
Summary:

## This Change:

This change generates the `RCTAppDependencyProvider` for the apps, so that the amount of changes required by the users is minimal.

## Context

React Native has a last temporal dependency on Codegen in the React-RCTAppDelegate pod.

The RCTAppDelegate has the responsibility to provide various dependencies to react native, like third party components and various modules. ReactCodegen is generated when the user create the project, while React-RCTAppDelegate eists in React Native itself.

This dependency means that we cannot prepare prebuilt for iOS for React Native because when we would have to create prebuilds, we would need the React Codegen, but we can't create a React codegen package that will fit all the apps, because React Codegen can contains App Specific modules and components and apps might have different dependencies.

## Changelog:
[iOS][Added] - Introduce the RCTAppDependencyProvider to minimize the changes required y the users

Differential Revision: D66074456
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66074456

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Nov 18, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 41c2502.

@kraenhansen kraenhansen mentioned this pull request Jan 5, 2025
atlj added a commit to callstack/react-native-builder-bob that referenced this pull request Jan 28, 2025
### Summary

Fixed #755

There is an effort towards shipping React Native in a prebuilt format on
iOS. As a result, some of the codegen-related custom code have to be
generated at the build time. However, these changes also affected the
codegen generated native code for libraries. This PR patches that
behavior on bob level.

Related PRs:
- facebook/react-native#47518
- facebook/react-native#47650
- facebook/react-native#47517

### Test plan

This adds 3 unit test cases to make sure we're able to parse the codegen
paths and delete the necessary files.

#### To test it locally:
1. Build bob
1. Create a new library using `npx create-react-native-library`, and
pick turbo modules
1. Link the local bob by calling `yarn link path/to/bob --all` in the
new library
1. Call `yarn bob build --target codegen`
1. Make sure there is no `.podspec` file or mm files in
`android/generated`
1. Make sure there is no `.podspec` file or any of the following files
in `ios/generated`:
```
  'RCTAppDependencyProvider.h',
  'RCTAppDependencyProvider.mm',
  'RCTModulesConformingToProtocolsProvider.h',
  'RCTModulesConformingToProtocolsProvider.mm',
  'RCTThirdPartyComponentsProvider.h',
  'RCTThirdPartyComponentsProvider.mm',
  'ReactAppDependencyProvider.podspec',
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants