Update libruntimeexector to be a shared lib rather than a static lib

Summary:
AGP 7.x is changing the path where we can find
the precompiled static libraries. Therefore is getting complicated
to share prebuilt `.a` files. I'm updating `libruntimeexecutor` to be
a shared library instead so this will solve this issue for now.

Changelog:
[Internal] [Changed] - Update libruntimeexector to be a shared lib rather than a static lib

Reviewed By: ShikaSD

Differential Revision: D32646112

fbshipit-source-id: ce42e930076c1d3b5f54f3d8adcca1c38909d0fb
This commit is contained in:
Nicola Corti authored and Facebook GitHub Bot committed 2021-11-24 10:58:54 -08:00
1 parent 272cfe5d13
commit a5469f9d7f
7 files changed
+18 -28

No files matched your search

+7 -9
View File
@@ -3,7 +3,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This configuration provides access to most common React Native prebuilt .so and .a files
# This configuration provides access to most common React Native prebuilt .so files
# to avoid recompiling each of the libraries outside of ReactAndroid NDK compilation.
# Hosting app's/library's Android.mk can include this Android-prebuilt.mk file to
# get access to those libraries to depend on.
@@ -19,7 +19,7 @@ THIRD_PARTY_NDK_DIR := $(REACT_ANDROID_BUILD_DIR)/third-party-ndk
REACT_ANDROID_SRC_DIR := $(REACT_ANDROID_DIR)/src/main
REACT_COMMON_DIR := $(REACT_ANDROID_DIR)/../ReactCommon
REACT_GENERATED_SRC_DIR := $(REACT_ANDROID_BUILD_DIR)/generated/source
# Note: this have both .so and .a files
# Note: this have only .so files
REACT_NDK_EXPORT_DIR := $(PROJECT_BUILD_DIR)/react-ndk/exported
# fb
@@ -197,15 +197,13 @@ LOCAL_EXPORT_C_INCLUDES := \
$(REACT_GENERATED_SRC_DIR)/codegen/jni
include $(PREBUILT_SHARED_LIBRARY)
# fbjni
include $(FIRST_PARTY_NDK_DIR)/fbjni/Android.mk
#### Static Libraries
# runtimeexecutor
include $(CLEAR_VARS)
LOCAL_MODULE := runtimeexecutor
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libruntimeexecutor.a
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libruntimeexecutor.so
LOCAL_C_INCLUDES := $(REACT_COMMON_DIR)/runtimeexecutor
LOCAL_EXPORT_C_INCLUDES := $(REACT_COMMON_DIR)/runtimeexecutor
include $(PREBUILT_STATIC_LIBRARY)
include $(PREBUILT_SHARED_LIBRARY)
# fbjni
include $(FIRST_PARTY_NDK_DIR)/fbjni/Android.mk
-8
View File
@@ -238,10 +238,6 @@ tasks.register("packageReactNdkLibsForBuck") {
tasks.register("packageReactNdkDebugLibsForBuck", Copy) {
dependsOn("mergeDebugNativeLibs")
// Static libraries (.a) are copied from the obj/local folder
from("$buildDir/intermediates/ndkBuild/debug/obj/local/") {
include '**/*.a'
}
// Shared libraries (.so) are copied from the merged_native_libs folder instead
from("$buildDir/intermediates/merged_native_libs/debug/out/lib/")
exclude("**/libjsc.so")
@@ -251,10 +247,6 @@ tasks.register("packageReactNdkDebugLibsForBuck", Copy) {
tasks.register("packageReactNdkReleaseLibsForBuck", Copy) {
dependsOn("mergeReleaseNativeLibs")
// Static libraries (.a) are copied from the obj/local folder
from("$buildDir/intermediates/ndkBuild/debug/obj/local/") {
include '**/*.a'
}
// Shared libraries (.so) are copied from the merged_native_libs folder instead
from("$buildDir/intermediates/merged_native_libs/release/out/lib/")
exclude("**/libjsc.so")
@@ -19,9 +19,9 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
LOCAL_SHARED_LIBRARIES = libfb libfbjni libreactnativeutilsjni
LOCAL_SHARED_LIBRARIES = libfb libfbjni libreactnativeutilsjni libruntimeexecutor
LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni libruntimeexecutor
LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni
# Name of this module.
LOCAL_MODULE := callinvokerholder
@@ -27,10 +27,10 @@ LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
LOCAL_LDLIBS += -landroid
# The dynamic libraries (.so files) that this module depends on.
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libglog_init libyoga libreact_render_runtimescheduler
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libglog_init libyoga libreact_render_runtimescheduler libruntimeexecutor
# The static libraries (.a files) that this module depends on.
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder libruntimeexecutor
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder
# Name of this module.
#
@@ -77,10 +77,10 @@ LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
LOCAL_LDLIBS += -landroid
# The dynamic libraries (.so files) that this module depends on.
LOCAL_SHARED_LIBRARIES := libreactnativeutilsjni libfolly_json libfb libfbjni libglog_init libyoga logger libreact_render_runtimescheduler
LOCAL_SHARED_LIBRARIES := libreactnativeutilsjni libfolly_json libfb libfbjni libglog_init libyoga logger libreact_render_runtimescheduler libruntimeexecutor
# The static libraries (.a files) that this module depends on.
LOCAL_STATIC_LIBRARIES := libreactnative libruntimeexecutor libcallinvokerholder
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder
# Name of this module.
#
+2 -2
View File
@@ -19,8 +19,8 @@ LOCAL_CFLAGS := \
LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
LOCAL_STATIC_LIBRARIES := boost jsi callinvoker reactperflogger runtimeexecutor
LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog logger
LOCAL_STATIC_LIBRARIES := boost jsi callinvoker reactperflogger
LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog logger libruntimeexecutor
include $(BUILD_STATIC_LIBRARY)
+1 -1
View File
@@ -16,4 +16,4 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
@@ -19,8 +19,8 @@ LOCAL_MODULE := rntester_appmodules
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
LOCAL_SHARED_LIBRARIES := libfbjni libglog libfolly_json libfolly_futures libyoga libreact_nativemodule_core libturbomodulejsijni librrc_view libreact_render_core libreact_render_graphics libreact_codegen_rncore libfabricjni libreact_render_componentregistry libreact_debug libreact_render_debug libreact_codegen_rntester
LOCAL_STATIC_LIBRARIES := libsampleturbomodule libruntimeexecutor
LOCAL_SHARED_LIBRARIES := libfbjni libglog libfolly_json libfolly_futures libyoga libreact_nativemodule_core libturbomodulejsijni librrc_view libreact_render_core libreact_render_graphics libreact_codegen_rncore libfabricjni libreact_render_componentregistry libruntimeexecutor libreact_debug libreact_render_debug libreact_codegen_rntester
LOCAL_STATIC_LIBRARIES := libsampleturbomodule
LOCAL_CFLAGS := \
-DLOG_TAG=\"ReactNative\"