react-native/packages/react-native-gradle-plugin
Dmitry Rykun dae4a11e90 Introduce "headerPrefix" codegen option (#41956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41956

By default, generated Cxx sources for components all end up in same directory. However the include declarations in them look like this:
```
#include <react/renderer/components/${libraryName}/ShadowNodes.h>
```
And not like this:
```
#include "ShadowNodes.h"
```
This works fine with Buck because it supports header prefixes.
To get this working with CocoaPods we define additional `HEADER_SEARCH_PATHS` for our `React-Codegen` pod.
This approach will not work if we want to generate code at the library level and check in the artifacts. That's because we don't have control over the Podspec there, and can't inject those additional `HEADER_SEARCH_PATHS`.

This diff adds the `headerPrefix` argument to the codegen entry point. It is `react/renderer/components/${libraryName}` by default, but can become empty if we want to generate code at the library level, and don't want to deal with this nested header structure.

*Note:* `RNCodegen` runs all the generators [in a loop](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/generators/RNCodegen.js#L263-L275), assuming that the all have same function signature So I had to add the `headerPrefix` argument to all the generators, even to the ones that don't really need it.

Changelog: [General][Added] - Introduce "headerPrefix" codegen option.

Reviewed By: zeyap

Differential Revision: D51811596

fbshipit-source-id: c5c3e1e571c7c4ea2f5354eb9a7b0df6b917fc0c
2023-12-20 09:25:05 -08:00
..
gradle AGP to 8.2.0 (#41747) 2023-12-01 08:41:02 -08:00
src Introduce "headerPrefix" codegen option (#41956) 2023-12-20 09:25:05 -08:00
build.gradle.kts Fix projects being broken on dependencies starting with a.. (#41621) 2023-11-23 06:59:18 -08:00
gradle.properties
gradlew Bump Gradle to 8.4 (#39960) 2023-10-06 11:38:59 -07:00
gradlew.bat
package.json Bump package versions for next major (#39764) 2023-10-11 08:36:23 -07:00
README.md
settings.gradle.kts

@react-native/gradle-plugin

Version

A Gradle Plugin used to support development of React Native applications for Android.

Installation

yarn add @react-native/gradle-plugin

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like

Testing

To run the tests in this package, run the following commands from the React Native root folder:

  1. yarn to install the dependencies. You just need to run this once
  2. yarn jest packages/react-native-gradle-plugin.