Skip to content

Commit

Permalink
Move libmapbufferjni.so inside libreactnative.so
Browse files Browse the repository at this point in the history
Summary:
Moving another library inside libreactnative.so

Changelog:
[Internal] [Changed] - Move libmapbufferjni.so inside libreactnative.so

Reviewed By: javache

Differential Revision: D55799199
  • Loading branch information
cortinico authored and facebook-github-bot committed Jul 24, 2024
1 parent 5a2ed4a commit e410603
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
6 changes: 2 additions & 4 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ val preparePrefab by
PrefabPreprocessingEntry("jsi", Pair("../ReactCommon/jsi/", "")),
PrefabPreprocessingEntry(
"fabricjni", Pair("src/main/jni/react/fabric", "react/fabric/")),
PrefabPreprocessingEntry(
"mapbufferjni", Pair("src/main/jni/react/mapbuffer", "react/mapbuffer/")),
PrefabPreprocessingEntry(
"react_render_mapbuffer",
Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/")),
Expand Down Expand Up @@ -264,6 +262,8 @@ val preparePrefab by
Pair("../ReactCommon/react/renderer/imagemanager/platform/cxx/", ""),
// react_render_mapbuffer
Pair("../ReactCommon/react/renderer/mapbuffer/", "react/renderer/mapbuffer/"),
// mapbufferjni
Pair("src/main/jni/react/mapbuffer", "react/mapbuffer/"),
// react_utils
Pair("../ReactCommon/react/utils/", "react/utils/"),
// rrc_image
Expand Down Expand Up @@ -632,7 +632,6 @@ android {
"rrc_root",
"jsi",
"fabricjni",
"mapbufferjni",
"react_render_mapbuffer",
"react_render_textlayoutmanager",
"yoga",
Expand Down Expand Up @@ -748,7 +747,6 @@ android {
create("rrc_root") { headers = File(prefabHeadersDir, "rrc_root").absolutePath }
create("jsi") { headers = File(prefabHeadersDir, "jsi").absolutePath }
create("fabricjni") { headers = File(prefabHeadersDir, "fabricjni").absolutePath }
create("mapbufferjni") { headers = File(prefabHeadersDir, "mapbufferjni").absolutePath }
create("react_render_mapbuffer") {
headers = File(prefabHeadersDir, "react_render_mapbuffer").absolutePath
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ target_compile_options(${CMAKE_PROJECT_NAME}
find_package(ReactAndroid REQUIRED CONFIG)
add_library(fabricjni ALIAS ReactAndroid::fabricjni)
add_library(jsi ALIAS ReactAndroid::jsi)
add_library(mapbufferjni ALIAS ReactAndroid::mapbufferjni)
add_library(react_render_mapbuffer ALIAS ReactAndroid::react_render_mapbuffer)
add_library(react_render_textlayoutmanager ALIAS ReactAndroid::react_render_textlayoutmanager)
add_library(reactnative ALIAS ReactAndroid::reactnative)
Expand All @@ -78,7 +77,6 @@ add_library(fbjni ALIAS fbjni::fbjni)

target_link_libraries(${CMAKE_PROJECT_NAME}
fabricjni # prefab ready
mapbufferjni # prefab ready
fbjni # via 3rd party prefab
jsi # prefab ready
reactnative # prefab ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package com.facebook.react.common.mapbuffer

import com.facebook.react.bridge.ReactMarker
import com.facebook.react.bridge.ReactMarkerConstants
import com.facebook.react.common.ReactNativeSoLoader
import com.facebook.react.common.annotations.StableReactNativeAPI
import com.facebook.soloader.SoLoader
import com.facebook.systrace.Systrace

@StableReactNativeAPI
Expand All @@ -28,7 +28,7 @@ public object MapBufferSoLoader {
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
"ReadableMapBufferSoLoader.staticInit::load:mapbufferjni")
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_MAPBUFFER_SO_FILE_START)
SoLoader.loadLibrary("mapbufferjni")
ReactNativeSoLoader.loadLibrary("mapbufferjni")
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_MAPBUFFER_SO_FILE_END)
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ add_executable(reactnative_unittest
hermes-engine::libhermes
hermes_inspector_modern
jsi
mapbufferjni
react_cxxreact
react_codegen_rncore
react_debug
Expand Down
6 changes: 4 additions & 2 deletions packages/react-native/ReactAndroid/src/main/jni/OnLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <fbjni/fbjni.h>

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
return facebook::jni::initialize(
vm, [] { facebook::react::OnLoad_react_newarchdefaults(); });
return facebook::jni::initialize(vm, [] {
facebook::react::OnLoad_mapbufferjni();
facebook::react::OnLoad_react_newarchdefaults();
});
}
3 changes: 2 additions & 1 deletion packages/react-native/ReactAndroid/src/main/jni/OnLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
namespace facebook {
namespace react {
JNIEXPORT void OnLoad_react_newarchdefaults();
}
JNIEXPORT void OnLoad_mapbufferjni();
} // namespace react
} // namespace facebook
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_compile_options(-fexceptions -frtti -std=c++20 -Wall -DLOG_TAG=\"Fabric\")
file(GLOB mapbuffer_SRC CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/react/common/mapbuffer/*.cpp)

add_library(mapbufferjni SHARED ${mapbuffer_SRC})
add_library(mapbufferjni OBJECT ${mapbuffer_SRC})

target_include_directories(mapbufferjni
PUBLIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@
#include "JReadableMapBuffer.h"
#include "JWritableMapBuffer.h"

namespace facebook {
namespace react {
JNIEXPORT void OnLoad_mapbufferjni() {
facebook::react::JReadableMapBuffer::registerNatives();
}
} // namespace react
} // namespace facebook

#ifndef REACT_NATIVE_OPEN_SOURCE
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
return facebook::jni::initialize(
vm, [] { facebook::react::JReadableMapBuffer::registerNatives(); });
vm, [] { facebook::react::OnLoad_mapbufferjni(); });
}
#endif

0 comments on commit e410603

Please sign in to comment.