diff --git a/Libraries/Blob/React-RCTBlob.podspec b/Libraries/Blob/React-RCTBlob.podspec index ee488e04aa142a..a4606fe2f06ee6 100644 --- a/Libraries/Blob/React-RCTBlob.podspec +++ b/Libraries/Blob/React-RCTBlob.podspec @@ -42,8 +42,8 @@ Pod::Spec.new do |s| s.dependency "React-Codegen", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-Core/RCTBlobHeaders", version s.dependency "React-Core/RCTWebSocket", version s.dependency "React-RCTNetwork", version - s.dependency "React-jsi", version end diff --git a/Libraries/Image/React-RCTImage.podspec b/Libraries/Image/React-RCTImage.podspec index 614245a225300d..283f0994d5a36c 100644 --- a/Libraries/Image/React-RCTImage.podspec +++ b/Libraries/Image/React-RCTImage.podspec @@ -44,6 +44,7 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-Core/RCTImageHeaders", version s.dependency "React-RCTNetwork", version end diff --git a/Libraries/LinkingIOS/React-RCTLinking.podspec b/Libraries/LinkingIOS/React-RCTLinking.podspec index 1def01915d53d2..d81a27204a1b12 100644 --- a/Libraries/LinkingIOS/React-RCTLinking.podspec +++ b/Libraries/LinkingIOS/React-RCTLinking.podspec @@ -43,4 +43,5 @@ Pod::Spec.new do |s| s.dependency "React-Core/RCTLinkingHeaders", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/Libraries/NativeAnimation/React-RCTAnimation.podspec b/Libraries/NativeAnimation/React-RCTAnimation.podspec index 2a15aed44359b7..b8122e7844b1c6 100644 --- a/Libraries/NativeAnimation/React-RCTAnimation.podspec +++ b/Libraries/NativeAnimation/React-RCTAnimation.podspec @@ -43,5 +43,6 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-Core/RCTAnimationHeaders", version end diff --git a/Libraries/Network/React-RCTNetwork.podspec b/Libraries/Network/React-RCTNetwork.podspec index c0bd78a8cfb8e3..b1618e3c487788 100644 --- a/Libraries/Network/React-RCTNetwork.podspec +++ b/Libraries/Network/React-RCTNetwork.podspec @@ -44,5 +44,6 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-Core/RCTNetworkHeaders", version end diff --git a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec index 4d410d7fdc5176..01f9a21b8bce8d 100644 --- a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +++ b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec @@ -45,4 +45,5 @@ Pod::Spec.new do |s| s.dependency "React-Core/RCTPushNotificationHeaders", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/Libraries/Settings/React-RCTSettings.podspec b/Libraries/Settings/React-RCTSettings.podspec index 11770ad527e999..bc5f3bd3ff8456 100644 --- a/Libraries/Settings/React-RCTSettings.podspec +++ b/Libraries/Settings/React-RCTSettings.podspec @@ -44,5 +44,6 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-Core/RCTSettingsHeaders", version end diff --git a/Libraries/Vibration/React-RCTVibration.podspec b/Libraries/Vibration/React-RCTVibration.podspec index 28dcce4487b89a..577d03e4ad7465 100644 --- a/Libraries/Vibration/React-RCTVibration.podspec +++ b/Libraries/Vibration/React-RCTVibration.podspec @@ -44,5 +44,6 @@ Pod::Spec.new do |s| s.dependency "React-Codegen", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-Core/RCTVibrationHeaders", version end diff --git a/React-Core.podspec b/React-Core.podspec index 229846ec38751d..5f8304882b6790 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -95,6 +95,7 @@ Pod::Spec.new do |s| s.dependency "React-cxxreact", version s.dependency "React-perflogger", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-jsiexecutor", version s.dependency "Yoga" s.dependency "glog" diff --git a/React/CoreModules/React-CoreModules.podspec b/React/CoreModules/React-CoreModules.podspec index a4a605aaf01257..e4b5a32085426f 100644 --- a/React/CoreModules/React-CoreModules.podspec +++ b/React/CoreModules/React-CoreModules.podspec @@ -44,4 +44,5 @@ Pod::Spec.new do |s| s.dependency "React-RCTImage", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/React/FBReactNativeSpec/FBReactNativeSpec.podspec b/React/FBReactNativeSpec/FBReactNativeSpec.podspec index 37f2a17d8dffb5..26a2aafcab63c3 100644 --- a/React/FBReactNativeSpec/FBReactNativeSpec.podspec +++ b/React/FBReactNativeSpec/FBReactNativeSpec.podspec @@ -47,6 +47,7 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety", version s.dependency "React-Core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "ReactCommon/turbomodule/core", version use_react_native_codegen!(s, { diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index c28eee60d06fbe..e89485ac991abd 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -42,6 +42,7 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.subspec "animations" do |ss| ss.dependency folly_dep_name, folly_version diff --git a/ReactCommon/React-bridging.podspec b/ReactCommon/React-bridging.podspec index 660d0efdd9deb5..13d9bec09ffcfb 100644 --- a/ReactCommon/React-bridging.podspec +++ b/ReactCommon/React-bridging.podspec @@ -40,4 +40,5 @@ Pod::Spec.new do |s| s.dependency "RCT-Folly", folly_version s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/ReactCommon/ReactCommon.podspec b/ReactCommon/ReactCommon.podspec index 4cd4f04e59c31a..538fc077f62004 100644 --- a/ReactCommon/ReactCommon.podspec +++ b/ReactCommon/ReactCommon.podspec @@ -46,6 +46,7 @@ Pod::Spec.new do |s| ss.dependency "React-Core", version ss.dependency "React-cxxreact", version ss.dependency "React-jsi", version + ss.dependency "React-jsc", version ss.dependency "RCT-Folly", folly_version s.dependency "React-logger", version ss.dependency "DoubleConversion" diff --git a/ReactCommon/cxxreact/React-cxxreact.podspec b/ReactCommon/cxxreact/React-cxxreact.podspec index c4498e9d3f1f80..d54906d0e1e512 100644 --- a/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/ReactCommon/cxxreact/React-cxxreact.podspec @@ -45,5 +45,6 @@ Pod::Spec.new do |s| s.dependency "React-runtimeexecutor", version s.dependency "React-perflogger", version s.dependency "React-jsi", version + s.dependency "React-jsc", version s.dependency "React-logger", version end diff --git a/ReactCommon/hermes/React-hermes.podspec b/ReactCommon/hermes/React-hermes.podspec index 83d64d3a81978f..51d717b2655135 100644 --- a/ReactCommon/hermes/React-hermes.podspec +++ b/ReactCommon/hermes/React-hermes.podspec @@ -27,7 +27,7 @@ boost_compiler_flags = '-Wno-documentation' Pod::Spec.new do |s| s.name = "React-hermes" s.version = version - s.summary = "-" # TODO + s.summary = "Hermes engine for React Native" s.homepage = "https://reactnative.dev/" s.license = package['license'] s.author = "Facebook, Inc. and its affiliates" diff --git a/ReactCommon/jsi/React-jsc.podspec b/ReactCommon/jsi/React-jsc.podspec new file mode 100644 index 00000000000000..ed6e923bfae6c7 --- /dev/null +++ b/ReactCommon/jsi/React-jsc.podspec @@ -0,0 +1,42 @@ +# 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 + +Pod::Spec.new do |s| + s.name = "React-jsc" + s.version = version + s.summary = "JavaScriptCore engine for React Native" + s.homepage = "https://reactnative.dev/" + s.license = package["license"] + s.author = "Facebook, Inc. and its affiliates" + s.platforms = { :ios => "12.4" } + s.source = source + s.source_files = "JSCRuntime.{cpp,h}" + s.exclude_files = "**/test/*" + s.framework = "JavaScriptCore" + s.dependency "React-jsi", version + + s.default_subspec = "Default" + + s.subspec "Default" do + # no-op + end + + s.subspec "Fabric" do |ss| + ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" } + end +end diff --git a/ReactCommon/jsi/React-jsi.podspec b/ReactCommon/jsi/React-jsi.podspec index 8f0c3cdcaa32d4..96465cfa4d205e 100644 --- a/ReactCommon/jsi/React-jsi.podspec +++ b/ReactCommon/jsi/React-jsi.podspec @@ -16,41 +16,21 @@ 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 - s.summary = "-" # TODO + s.summary = "JavaScript Interface layer for React Native" s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" s.platforms = { :ios => "12.4" } s.source = source - s.source_files = "**/*.{cpp,h}" + s.source_files = "jsi/*.{cpp,h}" s.exclude_files = [ "jsi/JSIDynamic.{h,cpp}", - "jsi/jsilib-*.{h,cpp}", + "jsi/jsilib-posix.cpp", + "jsi/jsilib-windows.cpp", "**/test/*" ] - s.framework = "JavaScriptCore" - 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.default_subspec = "Default" - - s.dependency "boost", "1.76.0" - s.dependency "DoubleConversion" - s.dependency "RCT-Folly", folly_version - s.dependency "glog" - - s.subspec "Default" do - # no-op - end - - s.subspec "Fabric" do |ss| - ss.pod_target_xcconfig = { "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" } - end end diff --git a/ReactCommon/jsi/React-jsidynamic.podspec b/ReactCommon/jsi/React-jsidynamic.podspec index 831c6b010fc461..7e43baacfc7a6e 100644 --- a/ReactCommon/jsi/React-jsidynamic.podspec +++ b/ReactCommon/jsi/React-jsidynamic.podspec @@ -39,4 +39,5 @@ Pod::Spec.new do |s| s.dependency "RCT-Folly", folly_version s.dependency "glog" s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec index 5cbadf30d531fe..09781b7d5a7e09 100644 --- a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +++ b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec @@ -33,4 +33,5 @@ Pod::Spec.new do |s| s.header_dir = "ReactCommon" s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/packages/rn-tester/RCTTest/React-RCTTest.podspec b/packages/rn-tester/RCTTest/React-RCTTest.podspec index f6836ca2fa1e2d..377754901b2cbf 100644 --- a/packages/rn-tester/RCTTest/React-RCTTest.podspec +++ b/packages/rn-tester/RCTTest/React-RCTTest.podspec @@ -44,4 +44,5 @@ Pod::Spec.new do |s| s.dependency "React-CoreModules", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version + s.dependency "React-jsc", version end diff --git a/scripts/cocoapods/__tests__/codegen_utils-test.rb b/scripts/cocoapods/__tests__/codegen_utils-test.rb index 258875ebf9a650..606020bd9b0e7b 100644 --- a/scripts/cocoapods/__tests__/codegen_utils-test.rb +++ b/scripts/cocoapods/__tests__/codegen_utils-test.rb @@ -463,6 +463,7 @@ def get_podspec_no_fabric_no_script "RCTTypeSafety": ["99.98.97"], "React-Core": ["99.98.97"], "React-jsi": ["99.98.97"], + "React-jsc": ["99.98.97"], "ReactCommon/turbomodule/core": ["99.98.97"] } } diff --git a/scripts/cocoapods/__tests__/fabric-test.rb b/scripts/cocoapods/__tests__/fabric-test.rb index 0cb0a6316161cb..5076c70e7085b1 100644 --- a/scripts/cocoapods/__tests__/fabric-test.rb +++ b/scripts/cocoapods/__tests__/fabric-test.rb @@ -5,6 +5,7 @@ require "test/unit" require_relative "../fabric.rb" +require_relative "../utils.rb" require_relative "./test_utils/podSpy.rb" class FabricTest < Test::Unit::TestCase @@ -13,6 +14,13 @@ def setup podSpy_cleanUp() end + def teardown + podSpy_cleanUp() + end + + # ================== # + # TEST - setupFabric # + # ================== # def test_setupFabric_installsPods # Arrange prefix = "../.." @@ -30,7 +38,7 @@ def check_installed_pods(prefix) check_pod("React-Fabric", :path => "#{prefix}/ReactCommon") check_pod("React-rncore", :path => "#{prefix}/ReactCommon") check_pod("React-graphics", :path => "#{prefix}/ReactCommon/react/renderer/graphics") - check_pod("React-jsi/Fabric", :path => "#{prefix}/ReactCommon/jsi") + check_pod("React-jsc/Fabric", :path => "#{prefix}/ReactCommon/jsi") check_pod("React-RCTFabric", :path => "#{prefix}/React", :modular_headers => true) check_pod("RCT-Folly/Fabric", :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec") end @@ -45,5 +53,4 @@ def check_pod(name, path: nil, modular_headers: nil, podspec: nil) assert_equal(params, expected_params) end - end diff --git a/scripts/cocoapods/codegen_utils.rb b/scripts/cocoapods/codegen_utils.rb index 1d2e89bcc55197..c1548f90bfdeb4 100644 --- a/scripts/cocoapods/codegen_utils.rb +++ b/scripts/cocoapods/codegen_utils.rb @@ -104,6 +104,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa "RCTTypeSafety": [version], "React-Core": [version], "React-jsi": [version], + "React-jsc": [version], "ReactCommon/turbomodule/core": [version] } } diff --git a/scripts/cocoapods/fabric.rb b/scripts/cocoapods/fabric.rb index c27bf7975ed84c..bcdb2960df58e8 100644 --- a/scripts/cocoapods/fabric.rb +++ b/scripts/cocoapods/fabric.rb @@ -4,16 +4,14 @@ # LICENSE file in the root directory of this source tree. -# It sets up the faric dependencies. +# It sets up the Fabric dependencies. # -# @parameter prefix: prefix to use to reach react-native -# @parameter new_arch_enabled: whether the new arch is enabled or not -# @parameter codegen_output_dir: the directory where the code is generated -def setup_fabric!(prefix) - pod 'React-Fabric', :path => "#{prefix}/ReactCommon" - pod 'React-rncore', :path => "#{prefix}/ReactCommon" - pod 'React-graphics', :path => "#{prefix}/ReactCommon/react/renderer/graphics" - pod 'React-jsi/Fabric', :path => "#{prefix}/ReactCommon/jsi" - pod 'React-RCTFabric', :path => "#{prefix}/React", :modular_headers => true - pod 'RCT-Folly/Fabric', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec" +# @parameter react_native_path: relative path to react-native +def setup_fabric!(react_native_path) + pod 'React-Fabric', :path => "#{react_native_path}/ReactCommon" + pod 'React-rncore', :path => "#{react_native_path}/ReactCommon" + pod 'React-graphics', :path => "#{react_native_path}/ReactCommon/react/renderer/graphics" + pod 'React-jsc/Fabric', :path => "#{react_native_path}/ReactCommon/jsi" + pod 'React-RCTFabric', :path => "#{react_native_path}/React", :modular_headers => true + pod 'RCT-Folly/Fabric', :podspec => "#{react_native_path}/third-party-podspecs/RCT-Folly.podspec" end diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 3363dfced09df1..3157a42e0bec62 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -95,6 +95,7 @@ def use_react_native! ( pod 'React-bridging', :path => "#{prefix}/ReactCommon" pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact" pod 'React-jsi', :path => "#{prefix}/ReactCommon/jsi" + pod 'React-jsc', :path => "#{prefix}/ReactCommon/jsi" pod 'React-jsidynamic', :path => "#{prefix}/ReactCommon/jsi" pod 'React-jsiexecutor', :path => "#{prefix}/ReactCommon/jsiexecutor" pod 'React-jsinspector', :path => "#{prefix}/ReactCommon/jsinspector"