From cf4269ab33294aa5d49edce25b3d0871e3bbef6d Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 28 Nov 2022 04:13:55 -0800 Subject: [PATCH] Expose `jscruntime` to be consumed via Prefab Summary: This is the last library that we should expose via Prefab. Thanks to cipolleschi 's work here moving the file to `/ReactCommon/jsc` folder we can easily expose it to be consumed by third parties. Changelog: [Internal] [Changed] - Expose `jscruntime` to be consumed via Prefab Reviewed By: cipolleschi Differential Revision: D41534564 fbshipit-source-id: fb4b2d801def8caf71638dcb74eb87f8230984d4 --- ReactAndroid/build.gradle | 10 ++++++++-- ReactAndroid/src/main/jni/CMakeLists.txt | 1 + ReactCommon/jsc/CMakeLists.txt | 9 +++++++-- ReactCommon/jsi/CMakeLists.txt | 16 ---------------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 041f546c668..3f285029101 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -178,13 +178,19 @@ final def preparePrefab = tasks.register("preparePrefab", PreparePrefabHeadersTa "rrc_image", new Pair("../ReactCommon/react/renderer/components/image/", "react/renderer/components/image/") ), - // This prefab target is used by Expo & Reanimated to load a new instance of Hermes + // These prefab targets are used by Expo & Reanimated new PrefabPreprocessingEntry( "hermes-executor", - // "hermes-executor" is statically linking agaisnt "hermes-executor-common" + // "hermes-executor" is statically linking against "hermes-executor-common" // and "hermes-inspector". Here we expose only the headers that we know are needed. new Pair("../ReactCommon/hermes/inspector/", "hermes/inspector/") ), + new PrefabPreprocessingEntry( + "jscexecutor", + // "jscexecutor" is statically linking against "jscruntime" + // Here we expose only the headers that we know are needed. + new Pair("../ReactCommon/jsc/", "jsc/") + ), new PrefabPreprocessingEntry( "react_render_uimanager", new Pair("../ReactCommon/react/renderer/uimanager/", "react/renderer/uimanager/"), diff --git a/ReactAndroid/src/main/jni/CMakeLists.txt b/ReactAndroid/src/main/jni/CMakeLists.txt index bd13fa34b5e..8dd054c16df 100644 --- a/ReactAndroid/src/main/jni/CMakeLists.txt +++ b/ReactAndroid/src/main/jni/CMakeLists.txt @@ -56,6 +56,7 @@ add_react_common_subdir(reactperflogger) add_react_common_subdir(logger) add_react_common_subdir(jsiexecutor) add_react_common_subdir(cxxreact) +add_react_common_subdir(jsc) add_react_common_subdir(jsi) add_react_common_subdir(butter) add_react_common_subdir(callinvoker) diff --git a/ReactCommon/jsc/CMakeLists.txt b/ReactCommon/jsc/CMakeLists.txt index 52188407ea5..2f387fa996f 100644 --- a/ReactCommon/jsc/CMakeLists.txt +++ b/ReactCommon/jsc/CMakeLists.txt @@ -17,13 +17,18 @@ add_compile_options( -Wno-unused-lambda-capture -DLOG_TAG=\"ReactNative\") -add_library(jscruntime STATIC +add_library(jscruntime + STATIC JSCRuntime.h JSCRuntime.cpp) target_include_directories(jscruntime PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(jscruntime folly_runtime jsc glog) +target_link_libraries(jscruntime + folly_runtime + jsc + jsi + glog) # TODO: Remove this flag when ready. # Android has this enabled by default, but the flag is still needed for iOS. diff --git a/ReactCommon/jsi/CMakeLists.txt b/ReactCommon/jsi/CMakeLists.txt index 3f2a8c15d3f..0967a7d7ee6 100644 --- a/ReactCommon/jsi/CMakeLists.txt +++ b/ReactCommon/jsi/CMakeLists.txt @@ -25,19 +25,3 @@ target_include_directories(jsi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(jsi folly_runtime glog) - -################## -### jscruntime ### -################## - -add_library(jscruntime STATIC - JSCRuntime.h - JSCRuntime.cpp) - -target_include_directories(jscruntime PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -target_link_libraries(jscruntime folly_runtime jsc glog) - -# TODO: Remove this flag when ready. -# Android has this enabled by default, but the flag is still needed for iOS. -target_compile_options(jscruntime PRIVATE -DRN_FABRIC_ENABLED)