mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
0486640571
Summary: ## Description This diff introduces `NativeModulePerfLogger`, its BUCK, Cocoapod, android-ndk targets. This diff also wires up those targets into the React Native bridge and TurboModules targets, so that we get signal on if the code compiles. This diff also introduces `TurboModulePerfLogger`, which is a namespace that holds the `NativeModulePerfLogger` that'll do perf-logging for TurboModules. ## How will perflogging work on iOS? 1. Each application will, during React Native initialization, create a NativeModule perf logger. 2. If TurboModules are enabled, we'll call `TurboModulePerfLogger::setInstance(perfLogger)`. If TurboModules are disabled, we'll call `NativeModulePerfLogger::setInstance(perfLogger)`. 3. TurboModules, when they're created and used, will log events via `TurboModulePerfLogger::getInstance()`. NativeModules (i.e: bridge modules), when they're created and used, will log events via the `NativeModulePerfLogger::getInstance()`. > **Note:** The NativeModule system will log events for non-TurboModules as well. Maybe we should log events for only NativeModules that conform to the `TurboModule` interface, when TurboModules are disabled. This'll ensure a fair comparison between the two systems. ## How will perflogging work on Android? Please see the subsequent diff. allow-large-files Changelog: [Both][Added] - Introduce `NativeModulePerfLogger` Reviewed By: PeteTheHeat Differential Revision: D21318053 fbshipit-source-id: 6ddf5b5a80bdc4076d2dd6588067e2b0ec8c2c6b
103 lines
4.3 KiB
Ruby
103 lines
4.3 KiB
Ruby
# Copyright (c) Facebook, Inc. and its 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
|
||
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 = '2020.01.13.00'
|
||
boost_compiler_flags = '-Wno-documentation'
|
||
|
||
header_subspecs = {
|
||
'ARTHeaders' => 'Libraries/ART/**/*.h',
|
||
'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',
|
||
}
|
||
|
||
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 = "Facebook, Inc. and its affiliates"
|
||
s.platforms = { :ios => "10.0", :tvos => "10.0" }
|
||
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.library = "stdc++"
|
||
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Folly\"" }
|
||
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}"
|
||
ss.exclude_files = "React/CoreModules/**/*",
|
||
"React/DevSupport/**/*",
|
||
"React/Fabric/**/*",
|
||
"React/Inspector/**/*"
|
||
ss.ios.exclude_files = "React/**/RCTTV*.*"
|
||
ss.tvos.exclude_files = "React/Modules/RCTClipboard*",
|
||
"React/Views/RCTDatePicker*",
|
||
"React/Views/RCTPicker*",
|
||
"React/Views/RCTRefreshControl*",
|
||
"React/Views/RCTSlider*",
|
||
"React/Views/RCTSwitch*",
|
||
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 "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 "Yoga"
|
||
s.dependency "glog"
|
||
end
|