Do not store .cpp/.h files inside src/main/java - mapbuffer

Summary:
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 mapbuffer

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

Reviewed By: cipolleschi

Differential Revision: D38699253

fbshipit-source-id: c1c8f8693b6da4e3428f8f280e1ca4d5c5d0f853
This commit is contained in:
Nicola Corti 2022-08-16 03:20:16 -07:00 коммит произвёл Facebook GitHub Bot
Родитель be8fe7a9c1
Коммит 3d2185203b
12 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -22,7 +22,7 @@ rn_android_library(
deps = [ deps = [
FBJNI_TARGET, FBJNI_TARGET,
react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"), react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
react_native_target("java/com/facebook/react/common/mapbuffer/jni:jni"), react_native_target("jni/react/mapbuffer:jni"),
react_native_dep("libraries/fbjni:java"), react_native_dep("libraries/fbjni:java"),
react_native_dep("third-party/android/androidx:annotation"), react_native_dep("third-party/android/androidx:annotation"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/java/infer-annotations:infer-annotations"),

Просмотреть файл

@ -17,7 +17,7 @@ import javax.annotation.concurrent.NotThreadSafe
/** /**
* Read-only implementation of the [MapBuffer], imported from C++ environment. Use * Read-only implementation of the [MapBuffer], imported from C++ environment. Use
* `<react/common/mapbuffer/jni/JReadableMapBuffer.h> to create it. * `<react/common/mapbuffer/JReadableMapBuffer.h> to create it.
* *
* See [MapBuffer] documentation for more details * See [MapBuffer] documentation for more details
*/ */

Просмотреть файл

@ -98,7 +98,7 @@ add_react_android_subdir(src/main/jni/react/reactperflogger)
add_react_android_subdir(src/main/jni/react/jscexecutor) 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/java/com/facebook/react/turbomodule/core/jni)
add_react_android_subdir(src/main/jni/react/uimanager) add_react_android_subdir(src/main/jni/react/uimanager)
add_react_android_subdir(src/main/java/com/facebook/react/common/mapbuffer/jni) add_react_android_subdir(src/main/jni/react/mapbuffer)
add_react_android_subdir(src/main/java/com/facebook/react/fabric/jni) 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/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/reactexecutor)

Просмотреть файл

@ -36,7 +36,7 @@ rn_xplat_cxx_library(
), ),
compiler_flags_pedantic = True, compiler_flags_pedantic = True,
fbandroid_deps = [ fbandroid_deps = [
react_native_target("java/com/facebook/react/common/mapbuffer/jni:jni"), react_native_target("jni/react/mapbuffer:jni"),
react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"), react_native_xplat_target("react/renderer/mapbuffer:mapbuffer"),
], ],
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,