From 3d7b53d456f909029d4d470342419c191565b3e1 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 29 Nov 2022 08:53:50 -0800 Subject: [PATCH] Bring back JSIDynamic and JSI together Summary: In 0.71.0-RC.2, we had a regression in `use_frameworks!`. This brings back JSIDynamic and JSI together because the current setup is not compatible with iOS frameworks ## Changelog [iOS][Added] - Bring back JSIDynamic and JSI Reviewed By: cortinico Differential Revision: D41557823 fbshipit-source-id: 95eb2fe7df69992861396e41d11cd5182193e1a3 --- ReactCommon/React-Fabric.podspec | 2 - ReactCommon/ReactCommon.podspec | 1 - ReactCommon/hermes/React-hermes.podspec | 1 - ReactCommon/jsi/React-jsi.podspec | 19 +++++++-- ReactCommon/jsi/React-jsidynamic.podspec | 42 ------------------- .../jsiexecutor/React-jsiexecutor.podspec | 1 - scripts/react_native_pods.rb | 2 +- 7 files changed, 17 insertions(+), 51 deletions(-) delete mode 100644 ReactCommon/jsi/React-jsidynamic.podspec diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index 03db45f21fa..5234803090e 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -78,7 +78,6 @@ Pod::Spec.new do |s| s.subspec "core" do |ss| ss.dependency folly_dep_name, folly_version - ss.dependency "React-jsidynamic", version ss.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags ss.source_files = "react/renderer/core/**/*.{m,mm,cpp,h}" ss.exclude_files = "react/renderer/core/tests" @@ -303,7 +302,6 @@ Pod::Spec.new do |s| s.subspec "uimanager" do |ss| ss.dependency folly_dep_name, folly_version - ss.dependency "React-jsidynamic", version ss.compiler_flags = folly_compiler_flags ss.source_files = "react/renderer/uimanager/**/*.{m,mm,cpp,h}" ss.exclude_files = "react/renderer/uimanager/tests" diff --git a/ReactCommon/ReactCommon.podspec b/ReactCommon/ReactCommon.podspec index e859a81f289..ba4947b7a9a 100644 --- a/ReactCommon/ReactCommon.podspec +++ b/ReactCommon/ReactCommon.podspec @@ -61,7 +61,6 @@ Pod::Spec.new do |s| ss.subspec "core" do |sss| sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}", "react/nativemodule/core/platform/ios/**/*.{mm,cpp,h}" - sss.dependency "React-jsidynamic", version sss.exclude_files = "react/nativemodule/core/ReactCommon/{LongLivedObject,CallbackWrapper}.h" end diff --git a/ReactCommon/hermes/React-hermes.podspec b/ReactCommon/hermes/React-hermes.podspec index dc1036c0bb3..96bb1d0e152 100644 --- a/ReactCommon/hermes/React-hermes.podspec +++ b/ReactCommon/hermes/React-hermes.podspec @@ -45,7 +45,6 @@ Pod::Spec.new do |s| }.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {}) s.header_dir = "reacthermes" s.dependency "React-cxxreact", version - s.dependency "React-jsidynamic", version s.dependency "React-jsiexecutor", version s.dependency "React-jsinspector", version s.dependency "React-perflogger", version diff --git a/ReactCommon/jsi/React-jsi.podspec b/ReactCommon/jsi/React-jsi.podspec index f73127ffc96..e7c49d2f133 100644 --- a/ReactCommon/jsi/React-jsi.podspec +++ b/ReactCommon/jsi/React-jsi.podspec @@ -20,6 +20,10 @@ else source[:tag] = "v#{version}" end +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' +folly_version = '2021.07.22.00' +boost_compiler_flags = '-Wno-documentation' + Pod::Spec.new do |s| s.name = "React-jsi" s.version = version @@ -30,18 +34,27 @@ Pod::Spec.new do |s| s.platforms = { :ios => "12.4" } s.source = source + s.header_dir = "jsi" + s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" } + + s.dependency "boost", "1.76.0" + s.dependency "DoubleConversion" + s.dependency "RCT-Folly", folly_version + s.dependency "glog" + if js_engine == :jsc s.source_files = "**/*.{cpp,h}" s.exclude_files = [ - "jsi/JSIDynamic.{h,cpp}", "jsi/jsilib-posix.cpp", "jsi/jsilib-windows.cpp", "**/test/*" ] - s.header_dir = "jsi" + elsif js_engine == :hermes # JSI is provided by hermes-engine when Hermes is enabled - s.source_files = "" + # Just need to provide JSIDynamic in this case. + s.source_files = "jsi/JSIDynamic.{cpp,h}" s.dependency "hermes-engine" end end diff --git a/ReactCommon/jsi/React-jsidynamic.podspec b/ReactCommon/jsi/React-jsidynamic.podspec deleted file mode 100644 index b528de568c2..00000000000 --- a/ReactCommon/jsi/React-jsidynamic.podspec +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -folly_version = '2021.07.22.00' -boost_compiler_flags = '-Wno-documentation' - -Pod::Spec.new do |s| - s.name = "React-jsidynamic" - s.version = version - s.summary = "Provides support for converting between folly::dynamic and jsi::value" - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Meta Platforms, Inc. and its affiliates" - s.platforms = { :ios => "12.4" } - s.source = source - s.source_files = "jsi/JSIDynamic.{cpp,h}" - s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" } - s.header_dir = 'jsi' - - s.dependency "boost", "1.76.0" - s.dependency "DoubleConversion" - s.dependency "RCT-Folly", folly_version - s.dependency "glog" - s.dependency "React-jsi", version -end diff --git a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec index cedebb9e647..23a29b9ff45 100644 --- a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +++ b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec @@ -37,7 +37,6 @@ Pod::Spec.new do |s| s.dependency "React-cxxreact", version s.dependency "React-jsi", version - s.dependency "React-jsidynamic", version s.dependency "React-perflogger", version s.dependency "RCT-Folly", folly_version s.dependency "DoubleConversion" diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 3838eaecd5c..a5c9ba576f6 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -100,7 +100,7 @@ def use_react_native! ( else setup_jsc!(:react_native_path => prefix, :fabric_enabled => fabric_enabled) end - pod 'React-jsidynamic', :path => "#{prefix}/ReactCommon/jsi" + pod 'React-jsiexecutor', :path => "#{prefix}/ReactCommon/jsiexecutor" pod 'React-jsinspector', :path => "#{prefix}/ReactCommon/jsinspector"