Move libmapbufferjni.so inside libreactnative.so (#46003)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46003

Another library going inside libreactnative.so

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

Reviewed By: cipolleschi

Differential Revision: D61211105

fbshipit-source-id: 38fce9ff9025fc6d2cd9eff3ee57303babed8852
This commit is contained in:
Nicola Corti
2024-08-14 05:07:56 -07:00
committed by Facebook GitHub Bot
parent 0caf3e824d
commit 5b761ff15c
5 changed files with 15 additions and 8 deletions
@@ -118,8 +118,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/")),
@@ -239,6 +237,8 @@ val preparePrefab by
listOf(
// glog
Pair(File(buildDir, "third-party-ndk/glog/exported/").absolutePath, ""),
// mapbufferjni
Pair("src/main/jni/react/mapbuffer", "react/mapbuffer/"),
// turbomodulejsijni
Pair("src/main/jni/react/turbomodule", ""),
// react_codegen_rncore
@@ -632,7 +632,6 @@ android {
"rrc_root",
"jsi",
"fabricjni",
"mapbufferjni",
"react_render_mapbuffer",
"react_render_textlayoutmanager",
"yoga",
@@ -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
}
@@ -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)
@@ -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
@@ -153,6 +153,7 @@ add_library(reactnative
OnLoad.cpp
$<TARGET_OBJECTS:jni_lib_merge_glue>
$<TARGET_OBJECTS:logger>
$<TARGET_OBJECTS:mapbufferjni>
$<TARGET_OBJECTS:react_bridging>
$<TARGET_OBJECTS:react_codegen_rncore>
$<TARGET_OBJECTS:react_debug>
@@ -199,12 +200,12 @@ target_link_libraries(reactnative PUBLIC
glog
jsi
log
mapbufferjni
reactnativejni
yoga
)
target_include_directories(reactnative
PUBLIC
$<TARGET_PROPERTY:mapbufferjni,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_bridging,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_codegen_rncore,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:react_debug,INTERFACE_INCLUDE_DIRECTORIES>
@@ -307,6 +308,7 @@ add_executable(reactnative_unittest
hermes-engine::libhermes
hermes_inspector_modern
jsi
mapbufferjni
react_cxxreact
react_codegen_rncore
react_debug
@@ -6,12 +6,14 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake)
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
@@ -20,6 +22,8 @@ target_include_directories(mapbufferjni
${CMAKE_CURRENT_SOURCE_DIR}/react/common/mapbuffer/
)
target_merge_so(mapbufferjni)
target_link_libraries(mapbufferjni
fb
fbjni
@@ -21,16 +21,21 @@ public object MergedSoMapping {
public fun mapLibName(input: String): String =
when (input) {
"react_newarchdefaults" -> "reactnative"
"mapbufferjni" -> "reactnative"
else -> input
}
public fun invokeJniOnload(libraryName: String): Unit {
when (libraryName) {
"react_newarchdefaults" -> libreact_newarchdefaults_so()
"mapbufferjni" -> libmapbufferjni_so()
"reactnative" -> libreactnative_so()
}
}
public external fun libreact_newarchdefaults_so(): Int
public external fun libmapbufferjni_so(): Int
public external fun libreactnative_so(): Int
}