Skip to content

Commit

Permalink
Do not store .cpp/.h files inside src/main/java - reactnativeblob (#3…
Browse files Browse the repository at this point in the history
…4421)

Summary:
Pull Request resolved: #34421

Currently we expose native code (.h, .cpp) inside the src/main/java folder.
This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for reactnativeblob

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - reactnativeblob

Reviewed By: cipolleschi

Differential Revision: D38703092

fbshipit-source-id: 3d4391d8ee5587b199efa4001f68c6d4ed3ce2c2
  • Loading branch information
cortinico authored and facebook-github-bot committed Aug 16, 2022
1 parent f96d593 commit d35aab4
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rn_android_library(
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/common:common"),
react_native_target("java/com/facebook/react/module/annotations:annotations"),
react_native_target("java/com/facebook/react/modules/blob/jni:jni"),
react_native_target("jni/react/reactnativeblob:jni"),
react_native_target("java/com/facebook/react/modules/network:network"),
react_native_target("java/com/facebook/react/modules/websocket:websocket"),
],
Expand Down
3 changes: 2 additions & 1 deletion ReactAndroid/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ add_react_android_subdir(src/main/jni/react/jscexecutor)
add_react_android_subdir(src/main/java/com/facebook/react/turbomodule/core/jni)
add_react_android_subdir(src/main/jni/react/uimanager)
add_react_android_subdir(src/main/jni/react/mapbuffer)
add_react_android_subdir(src/main/jni/react/reactnativeblob)
add_react_android_subdir(src/main/java/com/facebook/react/fabric/jni)
add_react_android_subdir(src/main/java/com/facebook/react/modules/blob/jni)
add_react_android_subdir(src/main/jni/react/hermes/reactexecutor)
add_react_android_subdir(src/main/jni/react/hermes/instrumentation/)

0 comments on commit d35aab4

Please sign in to comment.