Add JSC for Bridgless (#38107)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38107

This change makes bridgeless build with JSC and with all the frameworks settings.

## Changelog:
[iOS][Added] Support bridgeless with JSC and frameworks

Reviewed By: philIip

Differential Revision: D47025704

fbshipit-source-id: 5779d3ffd9ed037e6f6dee6c64cc65835f370a5b
This commit is contained in:
Lulu Wu
2023-07-24 08:13:07 -07:00
committed by Facebook GitHub Bot
parent 42d67452eb
commit 3965158a2d
9 changed files with 152 additions and 196 deletions
@@ -75,6 +75,8 @@ Pod::Spec.new do |s|
}
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
s.dependency "React-Core"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
@@ -88,13 +90,13 @@ Pod::Spec.new do |s|
if is_new_arch_enabled
s.dependency "React-BridgelessCore"
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
s.dependency "React-BridgelessApple"
if use_hermes
s.dependency "React-BridgelessHermes"
end
s.dependency "React-BridgelessApple"
end
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
if use_hermes
s.dependency "React-hermes"
else
s.dependency "React-jsc"
@@ -61,8 +61,9 @@ Pod::Spec.new do |s|
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
s.dependency "hermes-engine"
s.dependency "React-BridgelessHermes"
s.exclude_files = "platform/ios/JSC/*.{mm,h}"
else
s.exclude_files = "platform/ios/Hermes/*.{mm,h}"
s.dependency "React-jsc"
s.exclude_files = "platform/ios/hermes/*.{mm,h}"
end
end
@@ -52,5 +52,6 @@ Pod::Spec.new do |s|
s.dependency "hermes-engine"
else
s.dependency "React-jsc"
s.exclude_files = "hermes/*.{cpp,h}"
end
end
@@ -7,7 +7,6 @@
#import "RCTJSThreadManager.h"
// #import <PikaOptimizationsMacros/PikaOptimizationsMacros.h>
#import <React/RCTAssert.h>
#import <React/RCTCxxUtils.h>
@@ -0,0 +1,23 @@
/*
* 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.
*/
#import <jsi/jsi.h>
#import <react/bridgeless/JSEngineInstance.h>
namespace facebook {
namespace react {
class RCTJscInstance : public JSEngineInstance {
public:
RCTJscInstance();
std::unique_ptr<jsi::Runtime> createJSRuntime() noexcept override;
~RCTJscInstance(){};
};
} // namespace react
} // namespace facebook
@@ -0,0 +1,22 @@
/*
* 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.
*/
#import "RCTJscInstance.h"
#include <jsc/JSCRuntime.h>
namespace facebook {
namespace react {
RCTJscInstance::RCTJscInstance() {}
std::unique_ptr<jsi::Runtime> RCTJscInstance::createJSRuntime() noexcept
{
return jsc::makeJSCRuntime();
}
} // namespace react
} // namespace facebook
@@ -7,12 +7,12 @@
# Set up Bridgeless dependencies
#
# @parameter react_native_path: relative path to react-native
def setup_bridgeless!(react_native_path: "../node_modules/react-native")
def setup_bridgeless!(react_native_path: "../node_modules/react-native", use_hermes: true)
pod "React-jsitracing", :path => "#{react_native_path}/ReactCommon/hermes/executor/"
pod "React-runtimescheduler", :path => "#{react_native_path}/ReactCommon/react/renderer/runtimescheduler"
pod 'React-BridgelessCore', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
pod 'React-BridgelessApple', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
if use_hermes
pod 'React-BridgelessHermes', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
end
pod 'React-BridgelessApple', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
end
@@ -171,7 +171,7 @@ def use_react_native! (
end
if new_arch_enabled
setup_bridgeless!(:react_native_path => prefix)
setup_bridgeless!(:react_native_path => prefix, :use_hermes => hermes_enabled)
end
# Flipper now build in Release mode but it is not linked to the Release binary (as specified by the Configuration option)
File diff suppressed because it is too large Load Diff