mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
9ee0e1c78e
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36471 The previous native web socket API, `RCTSRWebSocket`, appears to be an older version of the one provided as part of [SocketRocket](https://github.com/facebookincubator/SocketRocket). The latter has several improvements, such as the ability to respect proxy settings, which has been requested by a user of a React Native app. Everything translates over pretty easily, and considering that SocketRocket is already a dependency of Flipper, there doesn't seem to be much additional cost to swapping out the libraries. If we wanted to make things even slimmer, it may even be possible to make the WebSocket library be optional for release builds. ## Changelog [IOS] [CHANGED] - Use SocketRocket for web socket library Pull Request resolved: https://github.com/facebook/react-native/pull/36347 Test Plan: Validated the following: * The WebSocket test page in RNTester * Live reloading Reviewed By: cortinico Differential Revision: D43768835 Pulled By: javache fbshipit-source-id: 11e1ac2700bc92991897c594622e6687339bfcbf
144 lines
5.8 KiB
Ruby
144 lines
5.8 KiB
Ruby
# 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'
|
||
socket_rocket_version = '0.6.0'
|
||
boost_compiler_flags = '-Wno-documentation'
|
||
|
||
use_hermes = ENV['USE_HERMES'] == '1'
|
||
use_frameworks = ENV['USE_FRAMEWORKS'] != nil
|
||
|
||
header_subspecs = {
|
||
'CoreModulesHeaders' => 'React/CoreModules/**/*.h',
|
||
'RCTActionSheetHeaders' => 'Libraries/ActionSheetIOS/*.h',
|
||
'RCTAnimationHeaders' => 'Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h}',
|
||
'RCTBlobHeaders' => 'Libraries/Blob/{RCTBlobManager,RCTFileReaderModule}.h',
|
||
'RCTImageHeaders' => 'Libraries/Image/*.h',
|
||
'RCTLinkingHeaders' => 'Libraries/LinkingIOS/*.h',
|
||
'RCTNetworkHeaders' => 'Libraries/Network/*.h',
|
||
'RCTPushNotificationHeaders' => 'Libraries/PushNotificationIOS/*.h',
|
||
'RCTSettingsHeaders' => 'Libraries/Settings/*.h',
|
||
'RCTTextHeaders' => 'Libraries/Text/**/*.h',
|
||
'RCTVibrationHeaders' => 'Libraries/Vibration/*.h',
|
||
}
|
||
|
||
frameworks_search_paths = []
|
||
frameworks_search_paths << "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-hermes\"" if use_hermes
|
||
frameworks_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon\"" if use_frameworks
|
||
frameworks_search_paths << "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric\"" if use_frameworks
|
||
|
||
header_search_paths = [
|
||
"$(PODS_TARGET_SRCROOT)/ReactCommon",
|
||
"$(PODS_ROOT)/boost",
|
||
"$(PODS_ROOT)/DoubleConversion",
|
||
"$(PODS_ROOT)/RCT-Folly",
|
||
"${PODS_ROOT}/Headers/Public/FlipperKit",
|
||
"$(PODS_ROOT)/Headers/Public/ReactCommon",
|
||
"$(PODS_ROOT)/Headers/Public/React-RCTFabric"
|
||
].concat(use_hermes ? [
|
||
"$(PODS_ROOT)/Headers/Public/React-hermes",
|
||
"$(PODS_ROOT)/Headers/Public/hermes-engine"
|
||
] : []).concat(use_frameworks ? [
|
||
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers",
|
||
"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core",
|
||
"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers"
|
||
] : []).map{|p| "\"#{p}\""}.join(" ")
|
||
|
||
Pod::Spec.new do |s|
|
||
s.name = "React-Core"
|
||
s.version = version
|
||
s.summary = "The core of React Native."
|
||
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.resource_bundle = { "AccessibilityResources" => ["React/AccessibilityResources/*.lproj"]}
|
||
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
||
s.header_dir = "React"
|
||
s.framework = "JavaScriptCore"
|
||
s.pod_target_xcconfig = {
|
||
"HEADER_SEARCH_PATHS" => header_search_paths,
|
||
"DEFINES_MODULE" => "YES",
|
||
"GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}",
|
||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
||
"FRAMEWORK_SEARCH_PATHS" => frameworks_search_paths.join(" ")
|
||
}
|
||
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
|
||
s.default_subspec = "Default"
|
||
|
||
s.subspec "Default" do |ss|
|
||
ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
|
||
exclude_files = [
|
||
"React/CoreModules/**/*",
|
||
"React/DevSupport/**/*",
|
||
"React/Fabric/**/*",
|
||
"React/FBReactNativeSpec/**/*",
|
||
"React/Tests/**/*",
|
||
"React/Inspector/**/*"
|
||
]
|
||
# If we are using Hermes (the default is use hermes, so USE_HERMES can be nil), we don't have jsc installed
|
||
# So we have to exclude the JSCExecutorFactory
|
||
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
|
||
exclude_files = exclude_files.append("React/CxxBridge/JSCExecutorFactory.{h,mm}")
|
||
end
|
||
ss.exclude_files = exclude_files
|
||
ss.private_header_files = "React/Cxx*/*.h"
|
||
end
|
||
|
||
s.subspec "DevSupport" do |ss|
|
||
ss.source_files = "React/DevSupport/*.{h,mm,m}",
|
||
"React/Inspector/*.{h,mm,m}"
|
||
|
||
ss.dependency "React-Core/Default", version
|
||
ss.dependency "React-Core/RCTWebSocket", version
|
||
ss.dependency "React-jsinspector", version
|
||
end
|
||
|
||
s.subspec "RCTWebSocket" do |ss|
|
||
ss.source_files = "Libraries/WebSocket/*.{h,m}"
|
||
ss.dependency "React-Core/Default", version
|
||
end
|
||
|
||
# Add a subspec containing just the headers for each
|
||
# pod that should live under <React/*.h>
|
||
header_subspecs.each do |name, headers|
|
||
s.subspec name do |ss|
|
||
ss.source_files = headers
|
||
ss.dependency "React-Core/Default"
|
||
end
|
||
end
|
||
|
||
s.dependency "RCT-Folly", folly_version
|
||
s.dependency "React-cxxreact", version
|
||
s.dependency "React-perflogger", version
|
||
s.dependency "React-jsi", version
|
||
s.dependency "React-jsiexecutor", version
|
||
s.dependency "SocketRocket", socket_rocket_version
|
||
s.dependency "Yoga"
|
||
s.dependency "glog"
|
||
|
||
if ENV['USE_HERMES'] == "0"
|
||
s.dependency 'React-jsc'
|
||
else
|
||
s.dependency 'React-hermes'
|
||
s.dependency 'hermes-engine'
|
||
end
|
||
end
|