Skip to content

Commit

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

Summary:
Pull Request resolved: facebook#34435

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 fabricjni

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

Reviewed By: cipolleschi

Differential Revision: D38741130

fbshipit-source-id: f9e3e4514d3ae0ddeac65256928d71d5134d08f8
  • Loading branch information
cortinico authored and roryabraham committed Aug 17, 2022
1 parent 771dda0 commit 83662e9
Show file tree
Hide file tree
Showing 34 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ReactAndroid/cmake-utils/Android-prebuilt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ set_target_properties(fabricjni
PROPERTIES
IMPORTED_LOCATION
${REACT_NDK_EXPORT_DIR}/${ANDROID_ABI}/libfabricjni.so)
target_include_directories(fabricjni INTERFACE ${REACT_ANDROID_SRC_DIR}/java/com/facebook/react/fabric/jni)
target_include_directories(fabricjni INTERFACE ${REACT_ANDROID_SRC_DIR}/jni/react/fabric)

## react_render_componentregistry
add_library(react_render_componentregistry SHARED IMPORTED GLOBAL)
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ rn_android_library(
react_native_target("java/com/facebook/debug/holder:holder"),
react_native_target("java/com/facebook/react/bridge:bridge"),
react_native_target("java/com/facebook/react/config:config"),
react_native_target("java/com/facebook/react/fabric/jni:jni"),
react_native_target("java/com/facebook/react/module/annotations:annotations"),
react_native_target("java/com/facebook/react/modules/core:core"),
react_native_target("java/com/facebook/react/modules/i18nmanager:i18nmanager"),
Expand All @@ -52,5 +51,6 @@ rn_android_library(
react_native_target("java/com/facebook/react/views/view:view"),
react_native_target("java/com/facebook/react/views/text:text"),
react_native_target("java/com/facebook/react/touch:touch"),
react_native_target("jni/react/fabric:jni"),
] + KOTLIN_STDLIB_DEPS,
)
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public <T extends View> int addRootView(
* @return a {@link ReadableMap} that contains metadata associated to the React Component that
* rendered the Android View received as a parameter. For more details about the keys stored
* in the {@link ReadableMap} refer to the "getInspectorDataForInstance" method from
* com/facebook/react/fabric/jni/Binding.cpp file.
* jni/react/fabric/Binding.cpp file.
*/
@UiThread
@ThreadConfined(UI)
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ 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/jni/react/fabric)
add_react_android_subdir(src/main/jni/react/hermes/reactexecutor)
add_react_android_subdir(src/main/jni/react/hermes/instrumentation/)

File renamed without changes.

0 comments on commit 83662e9

Please sign in to comment.