Skip to content

Commit

Permalink
Enable Bridgless for JSC and frameworks
Browse files Browse the repository at this point in the history
Summary:
This change makes bridgeless build with JSC and with all the frameworks settings.

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

Differential Revision: D47025704

fbshipit-source-id: 99c70b665dba0aeb596e042f7e60e856db1876ab
  • Loading branch information
Lulu Wu authored and facebook-github-bot committed Jun 28, 2023
1 parent 1e817d6 commit 799853b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -88,11 +90,13 @@ Pod::Spec.new do |s|

if is_new_arch_enabled
s.dependency "React-BridgelessCore"
s.dependency "React-BridgelessHermes"
s.dependency "React-BridgelessApple"
if use_hermes
s.dependency "React-BridgelessHermes"
end
end

if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
if use_hermes
s.dependency "React-hermes"
else
s.dependency "React-jsc"
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/React/CxxBridge/JSCExecutorFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#pragma once

#ifdef __cplusplus
#include <jsireact/JSIExecutor.h>

namespace facebook::react {
Expand All @@ -25,3 +26,4 @@ class JSCExecutorFactory : public JSExecutorFactory {
};

} // namespace facebook::react
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ Pod::Spec.new do |s|
s.dependency "React-NativeModulesApple"
s.dependency "React-RCTFabric"
s.dependency "React-BridgelessCore"
s.dependency "React-BridgelessHermes"
s.dependency "React-Mapbuffer"
s.dependency "React-jserrorhandler"

if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
s.dependency "hermes-engine"
s.dependency "React-BridgelessHermes"
else
s.dependency "React-jsi"
s.dependency "React-jsc"
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#if __has_include(<reacthermes/HermesExecutorFactory.h>)
#import <UIKit/UIKit.h>

#import <hermes/Public/CrashManager.h>
Expand Down Expand Up @@ -36,3 +36,4 @@ class RCTHermesInstance : public JSEngineInstance {
};
} // namespace react
} // namespace facebook
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#if __has_include(<reacthermes/HermesExecutorFactory.h>)
#import "RCTHermesInstance.h"

namespace facebook {
Expand All @@ -27,3 +27,4 @@
}
} // namespace react
} // namespace facebook
#endif
6 changes: 4 additions & 2 deletions packages/react-native/scripts/cocoapods/bridgeless.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +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"
pod 'React-BridgelessHermes', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
pod 'React-BridgelessApple', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
if use_hermes
pod 'React-BridgelessHermes', :path => "#{react_native_path}/ReactCommon/react/bridgeless"
end
end
2 changes: 1 addition & 1 deletion packages/react-native/scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 799853b

Please sign in to comment.