Skip to content

Commit

Permalink
Remove unused variable NODE_MODULES_DIR from build.gradle in app …
Browse files Browse the repository at this point in the history
…template (#34459)

Summary:
This PR removes unused variable `NODE_MODULES_DIR` passed from `build.gradle` to `CMakeLists.txt` which causes the following CMake warnings to appear in the logs:

```
> Task :app:configureCMakeDebug[arm64-v8a]
C/C++: debug|arm64-v8a :CMake Warning:
C/C++: debug|arm64-v8a :  Manually-specified variables were not used by the project:
C/C++: debug|arm64-v8a :    NODE_MODULES_DIR
```

First I changed the value of `NODE_MODULES_DIR` to some non-existent path (i.e. `-DNODE_MODULES_DIR=/foo/bar`) to confirm that the variable is indeed unused. Then I completely removed it from `arguments` and the CMake warning disappeared.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Fixed] - Removed unused variable `NODE_MODULES_DIR` from `build.gradle` in app template

Pull Request resolved: #34459

Test Plan:
1. Create a new RN 0.70.0-rc.3 app from template with `npx react-native@next init RN070RC3 --version 0.70.0-rc.3`
2. Set `newArchEnabled=true` in `settings.gradle`
3. Open `android` directory in Android Studio
4. Run Gradle Sync
5. Build the app
6. Search for `NODE_MODULES_DIR` in the logs
7. Notice the CMake warning
8. Remove the line from this PR
9. Build the app again
10. Search for `NODE_MODULES_DIR` in the logs
11. Confirm there are no occurrences

Reviewed By: neildhar

Differential Revision: D38864127

Pulled By: cortinico

fbshipit-source-id: b41440edcdba63945e3b08cef897a250686c13ba
  • Loading branch information
tomekzaw authored and facebook-github-bot committed Aug 19, 2022
1 parent e142de0 commit 50b1270
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ android {
arguments "-DPROJECT_BUILD_DIR=$buildDir",
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
"-DTARGET_NAME=$dynamicLibraryName",
"-DANDROID_STL=c++_shared"
}
Expand Down

0 comments on commit 50b1270

Please sign in to comment.