From 7916f7e12014c42b2bc9bfcfe053e37358fc39a4 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 16 Aug 2024 05:42:46 -0700 Subject: [PATCH] Merge libuimanagerjni.so inside libreactnative.so (#46056) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46056 This merges another library inside libreactnative.so Changelog: [Android] [Changed] - Merge libuimanagerjni.so inside libreactnative.so Reviewed By: cipolleschi Differential Revision: D61376498 fbshipit-source-id: db646721a5a4b56f2cf098d5087a3e45d2076743 --- packages/react-native/ReactAndroid/build.gradle.kts | 1 - .../react-native/ReactAndroid/src/main/jni/CMakeLists.txt | 6 ++++++ .../src/main/jni/react/uimanager/CMakeLists.txt | 5 ++++- .../react/renderer/componentregistry/native/CMakeLists.txt | 2 +- .../react/runtime/nativeviewconfig/CMakeLists.txt | 2 +- .../src/main/java/com/facebook/soloader/MergedSoMapping.kt | 4 ++++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index c7bd133b046cf4..3ba674d63bfa4f 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -572,7 +572,6 @@ android { "bridgeless", "rninstance", "hermesinstancejni", - "uimanagerjni", "jscinstance", "react_devsupportjni", // prefab targets diff --git a/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt b/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt index 6d3ab7d037fb39..672e4b1886e65e 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt +++ b/packages/react-native/ReactAndroid/src/main/jni/CMakeLists.txt @@ -152,6 +152,7 @@ add_library(reactnative SHARED OnLoad.cpp $ + $ $ $ $ @@ -197,6 +198,7 @@ add_library(reactnative $ $ $ + $ $ $ $ @@ -206,6 +208,7 @@ add_library(reactnative $ $ $ + $ $ ) target_merge_so(reactnative) @@ -224,6 +227,7 @@ target_link_libraries(reactnative PUBLIC target_include_directories(reactnative PUBLIC $ + $ $ $ $ @@ -268,6 +272,7 @@ target_include_directories(reactnative $ $ $ + $ $ $ $ @@ -277,6 +282,7 @@ target_include_directories(reactnative $ $ $ + $ $ ) diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/CMakeLists.txt b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/CMakeLists.txt index 638a71976b516b..574415132a7cdf 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/CMakeLists.txt +++ b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/CMakeLists.txt @@ -8,14 +8,17 @@ set(CMAKE_VERBOSE_MAKEFILE on) add_compile_options(-fexceptions -frtti -std=c++20 -Wall -DLOG_TAG=\"ReactNative\") +include(${REACT_ANDROID_DIR}/src/main/jni/first-party/jni-lib-merge/SoMerging-utils.cmake) + file(GLOB uimanagerjni_SRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_library(uimanagerjni - SHARED + OBJECT ${uimanagerjni_SRC} $ $ $ ) +target_merge_so(uimanagerjni) target_include_directories(uimanagerjni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/native/CMakeLists.txt b/packages/react-native/ReactCommon/react/renderer/componentregistry/native/CMakeLists.txt index f5a38f9707c962..54a70c545c07db 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/native/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/native/CMakeLists.txt @@ -15,7 +15,7 @@ add_compile_options( -DLOG_TAG=\"Fabric\") file(GLOB rrc_native_SRC CONFIGURE_DEPENDS *.cpp) -add_library(rrc_native STATIC ${rrc_native_SRC}) +add_library(rrc_native OBJECT ${rrc_native_SRC}) target_include_directories(rrc_native PUBLIC ${REACT_COMMON_DIR}) diff --git a/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/CMakeLists.txt b/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/CMakeLists.txt index 351b5cb4e3a755..9c4269733f2754 100644 --- a/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/CMakeLists.txt @@ -11,7 +11,7 @@ add_compile_options(-std=c++20) file(GLOB_RECURSE bridgeless_nativeviewconfig_SRC CONFIGURE_DEPENDS *.cpp) add_library( bridgelessnativeviewconfig - STATIC + OBJECT ${bridgeless_nativeviewconfig_SRC} ) target_include_directories(bridgelessnativeviewconfig PUBLIC .) diff --git a/packages/react-native/sdks/ossonly-soloader/src/main/java/com/facebook/soloader/MergedSoMapping.kt b/packages/react-native/sdks/ossonly-soloader/src/main/java/com/facebook/soloader/MergedSoMapping.kt index cdef4e532917d0..5ef3b9dfb3779b 100644 --- a/packages/react-native/sdks/ossonly-soloader/src/main/java/com/facebook/soloader/MergedSoMapping.kt +++ b/packages/react-native/sdks/ossonly-soloader/src/main/java/com/facebook/soloader/MergedSoMapping.kt @@ -27,6 +27,7 @@ public object MergedSoMapping { "react_newarchdefaults" -> "reactnative" "rninstance" -> "reactnative" "turbomodulejsijni" -> "reactnative" + "uimanagerjni" -> "reactnative" "yoga" -> "reactnative" else -> input } @@ -41,6 +42,7 @@ public object MergedSoMapping { "reactnative" -> libreactnative_so() "rninstance" -> librninstance_so() "turbomodulejsijni" -> libturbomodulejsijni_so() + "uimanagerjni" -> libuimanagerjni_so() "yoga" -> libyoga_so() } } @@ -61,5 +63,7 @@ public object MergedSoMapping { public external fun libturbomodulejsijni_so(): Int + public external fun libuimanagerjni_so(): Int + public external fun libyoga_so(): Int }