Skip to content

Commit a5469f9

Browse files
cortinicofacebook-github-bot
authored andcommitted
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
1 parent 272cfe5 commit a5469f9

File tree

7 files changed

+18
-28
lines changed

7 files changed

+18
-28
lines changed

ReactAndroid/Android-prebuilt.mk

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
55

6-
# This configuration provides access to most common React Native prebuilt .so and .a files
6+
# This configuration provides access to most common React Native prebuilt .so files
77
# to avoid recompiling each of the libraries outside of ReactAndroid NDK compilation.
88
# Hosting app's/library's Android.mk can include this Android-prebuilt.mk file to
99
# get access to those libraries to depend on.
@@ -19,7 +19,7 @@ THIRD_PARTY_NDK_DIR := $(REACT_ANDROID_BUILD_DIR)/third-party-ndk
1919
REACT_ANDROID_SRC_DIR := $(REACT_ANDROID_DIR)/src/main
2020
REACT_COMMON_DIR := $(REACT_ANDROID_DIR)/../ReactCommon
2121
REACT_GENERATED_SRC_DIR := $(REACT_ANDROID_BUILD_DIR)/generated/source
22-
# Note: this have both .so and .a files
22+
# Note: this have only .so files
2323
REACT_NDK_EXPORT_DIR := $(PROJECT_BUILD_DIR)/react-ndk/exported
2424

2525
# fb
@@ -197,15 +197,13 @@ LOCAL_EXPORT_C_INCLUDES := \
197197
$(REACT_GENERATED_SRC_DIR)/codegen/jni
198198
include $(PREBUILT_SHARED_LIBRARY)
199199

200-
# fbjni
201-
include $(FIRST_PARTY_NDK_DIR)/fbjni/Android.mk
202-
203-
#### Static Libraries
204-
205200
# runtimeexecutor
206201
include $(CLEAR_VARS)
207202
LOCAL_MODULE := runtimeexecutor
208-
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libruntimeexecutor.a
203+
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libruntimeexecutor.so
209204
LOCAL_C_INCLUDES := $(REACT_COMMON_DIR)/runtimeexecutor
210205
LOCAL_EXPORT_C_INCLUDES := $(REACT_COMMON_DIR)/runtimeexecutor
211-
include $(PREBUILT_STATIC_LIBRARY)
206+
include $(PREBUILT_SHARED_LIBRARY)
207+
208+
# fbjni
209+
include $(FIRST_PARTY_NDK_DIR)/fbjni/Android.mk

ReactAndroid/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ tasks.register("packageReactNdkLibsForBuck") {
238238

239239
tasks.register("packageReactNdkDebugLibsForBuck", Copy) {
240240
dependsOn("mergeDebugNativeLibs")
241-
// Static libraries (.a) are copied from the obj/local folder
242-
from("$buildDir/intermediates/ndkBuild/debug/obj/local/") {
243-
include '**/*.a'
244-
}
245241
// Shared libraries (.so) are copied from the merged_native_libs folder instead
246242
from("$buildDir/intermediates/merged_native_libs/debug/out/lib/")
247243
exclude("**/libjsc.so")
@@ -251,10 +247,6 @@ tasks.register("packageReactNdkDebugLibsForBuck", Copy) {
251247

252248
tasks.register("packageReactNdkReleaseLibsForBuck", Copy) {
253249
dependsOn("mergeReleaseNativeLibs")
254-
// Static libraries (.a) are copied from the obj/local folder
255-
from("$buildDir/intermediates/ndkBuild/debug/obj/local/") {
256-
include '**/*.a'
257-
}
258250
// Shared libraries (.so) are copied from the merged_native_libs folder instead
259251
from("$buildDir/intermediates/merged_native_libs/release/out/lib/")
260252
exclude("**/libjsc.so")

ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
1919

2020
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
2121

22-
LOCAL_SHARED_LIBRARIES = libfb libfbjni libreactnativeutilsjni
22+
LOCAL_SHARED_LIBRARIES = libfb libfbjni libreactnativeutilsjni libruntimeexecutor
2323

24-
LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni libruntimeexecutor
24+
LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni
2525

2626
# Name of this module.
2727
LOCAL_MODULE := callinvokerholder

ReactAndroid/src/main/jni/react/jni/Android.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
2727
LOCAL_LDLIBS += -landroid
2828

2929
# The dynamic libraries (.so files) that this module depends on.
30-
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libglog_init libyoga libreact_render_runtimescheduler
30+
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libglog_init libyoga libreact_render_runtimescheduler libruntimeexecutor
3131

3232
# The static libraries (.a files) that this module depends on.
33-
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder libruntimeexecutor
33+
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder
3434

3535
# Name of this module.
3636
#
@@ -77,10 +77,10 @@ LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
7777
LOCAL_LDLIBS += -landroid
7878

7979
# The dynamic libraries (.so files) that this module depends on.
80-
LOCAL_SHARED_LIBRARIES := libreactnativeutilsjni libfolly_json libfb libfbjni libglog_init libyoga logger libreact_render_runtimescheduler
80+
LOCAL_SHARED_LIBRARIES := libreactnativeutilsjni libfolly_json libfb libfbjni libglog_init libyoga logger libreact_render_runtimescheduler libruntimeexecutor
8181

8282
# The static libraries (.a files) that this module depends on.
83-
LOCAL_STATIC_LIBRARIES := libreactnative libruntimeexecutor libcallinvokerholder
83+
LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder
8484

8585
# Name of this module.
8686
#

ReactCommon/cxxreact/Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ LOCAL_CFLAGS := \
1919

2020
LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
2121

22-
LOCAL_STATIC_LIBRARIES := boost jsi callinvoker reactperflogger runtimeexecutor
23-
LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog logger
22+
LOCAL_STATIC_LIBRARIES := boost jsi callinvoker reactperflogger
23+
LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog logger libruntimeexecutor
2424

2525
include $(BUILD_STATIC_LIBRARY)
2626

ReactCommon/runtimeexecutor/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
1616

1717
LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall
1818

19-
include $(BUILD_STATIC_LIBRARY)
19+
include $(BUILD_SHARED_LIBRARY)

packages/rn-tester/android/app/src/main/jni/Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ LOCAL_MODULE := rntester_appmodules
1919
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
2020
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
2121
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(GENERATED_SRC_DIR)/codegen/jni
22-
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
23-
LOCAL_STATIC_LIBRARIES := libsampleturbomodule libruntimeexecutor
22+
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
23+
LOCAL_STATIC_LIBRARIES := libsampleturbomodule
2424

2525
LOCAL_CFLAGS := \
2626
-DLOG_TAG=\"ReactNative\"

0 commit comments

Comments
 (0)