Skip to content

Commit f4c64e2

Browse files
authored
chore: remove unused native_modules files (#2547)
* chore: remove unused native_modules files * add deprecation warnings
1 parent 88f4a61 commit f4c64e2

File tree

8 files changed

+11
-1074
lines changed

8 files changed

+11
-1074
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ build/
1111
.cache
1212
.watchmanconfig
1313
coverage
14-
!packages/cli-platform-ios/src/config/__fixtures__/native_modules/node_modules
1514
*.env
1615
.parcel-cache

docs/autolinking.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Each platform defines its own [`platforms`](./platforms.md) configuration. It in
2929

3030
## Platform iOS
3131

32-
The [react-native/scripts/react_native_pods.rb](https://github.com/facebook/react-native/blob/master/packages/react-native/scripts/react_native_pods.rb) script required by `Podfile` requires the [native_modules.rb](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-ios/native_modules.rb) script, which gets the package metadata from `react-native config` during install phase and:
32+
The [react-native/scripts/react_native_pods.rb](https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb) script required by `Podfile` gets the package metadata from `react-native config` command during install phase and:
3333

3434
1. Adds dependencies via CocoaPods dev pods (using files from a local path).
3535
1. Adds build phase scripts to the App project’s build phase. (see examples below)
@@ -44,11 +44,11 @@ See example usage in React Native template's [Podfile](https://github.com/react-
4444

4545
## Platform Android
4646

47-
The [native_modules.gradle](https://github.com/react-native-community/cli/blob/main/packages/cli-platform-android/native_modules.gradle) script is included in your project's `settings.gradle` and `app/build.gradle` files and:
47+
The [`autolinkLibrariesWithApp`](https://github.com/facebook/react-native/blob/8c50bf0beb17ced7fdafeae7a734edfc03e6e0b2/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162) function from React Native Gradle Plugin (RNGP) must be registered in your project's `settings.gradle` file and called in `app/build.gradle` file and:
4848

4949
1. At build time, before the build script is run:
50-
1. A first Gradle plugin (in `settings.gradle`) runs `applyNativeModulesSettingsGradle` method. It uses the package metadata from `react-native config` to add Android projects.
51-
1. A second Gradle plugin (in `app/build.gradle`) runs `applyNativeModulesAppBuildGradle` method. It creates a list of React Native packages to include in the generated `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java` file.
50+
1. RNGP plugin registered in `settings.gradle` runs `autolinkLibrariesFromCommand()` method. It uses the package metadata from `react-native config` to add Android projects.
51+
1. Then in `app/build.gradle` it runs `autolinkLibrariesWithApp()` method. It creates a list of React Native packages to include in the generated `/android/build/generated/rn/src/main/java/com/facebook/react/PackageList.java` file.
5252
1. When the new architecture is turned on, the `generateNewArchitectureFiles` task is fired, generating `/android/build/generated/rn/src/main/jni` directory with the following files:
5353
- `Android-rncli.cmake` – creates a list of codegen'd libs. Used by the project's `CMakeLists.txt`.
5454
- `rncli.cpp` – registers codegen'd Turbo Modules and Fabric component providers. Used by `MainApplicationModuleProvider.cpp` and `MainComponentsRegistry.cpp`.
@@ -68,7 +68,7 @@ See example usage in React Native template:
6868

6969
You’re already using Gradle, so Android support will work by default.
7070

71-
On the iOS side, you will need to ensure you have a Podspec to the root of your repo. The `react-native-webview` Podspec is a good example of a [`package.json`](https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec)-driven Podspec. Note that CocoaPods does not support having `/`s in the name of a dependency, so if you are using scoped packages - you may need to change the name for the Podspec.
71+
On the iOS side, you will need to ensure you have a Podspec to the root of your repo. The `react-native-webview` Podspec is a good example of a [`package.json`](https://github.com/react-native-community/react-native-webview/blob/main/react-native-webview.podspec)-driven Podspec. Note that CocoaPods does not support having `/`s in the name of a dependency, so if you are using scoped packages - you may need to change the name for the Podspec.
7272

7373
### Pure C++ libraries
7474

@@ -167,13 +167,6 @@ module.exports = {
167167

168168
There is nothing extra you need to do - monorepos are supported by default.
169169

170-
Please note that in certain scenarios, such as when using Yarn workspaces, your packages might be hoisted to the root of the repository. If that is the case, please make sure that the following paths are pointing to the
171-
correct location and update them accordingly:
172-
173-
- path to `native_modules.rb` in your `ios/Podfile` (the right path should be resolved automatically in react-native >0.73)
174-
- path to `native_modules.gradle` in your `android/settings.gradle`
175-
- path to `native_modules.gradle` in your `android/app/build.gradle`
176-
177170
Dependencies are only linked if they are listed in the package.json of the mobile workspace, where "react-native" dependency is defined. For example, with this file structure:
178171

179172
```sh

0 commit comments

Comments
 (0)