Entirely control Flipper being enabled through Podfile (#1086)

Summary:
Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

Finally, this PR also includes a commit [to fix the current builds](https://github.com/facebook/flipper/pull/1086/files#r418526812).

## Changelog

> Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/flipper/pull/1086

Test Plan: I have built and ran the Sample application, as well as used this version of Flipper with a new RN app built from `master`.

Reviewed By: passy

Differential Revision: D21381828

Pulled By: priteshrnandgaonkar

fbshipit-source-id: edf6dae28eb02336a49e8230654d6186360ea8d6
This commit is contained in:
Eloy Durán
2020-05-05 03:09:54 -07:00
committed by Facebook GitHub Bot
parent 63a512a910
commit c393ee9421
7 changed files with 65 additions and 317 deletions

View File

@@ -85,6 +85,7 @@ Pod::Spec.new do |spec|
"ONLY_ACTIVE_ARCH": "YES", "ONLY_ACTIVE_ARCH": "YES",
"DEFINES_MODULE" => "YES", "DEFINES_MODULE" => "YES",
"HEADER_SEARCH_PATHS" => header_search_paths } "HEADER_SEARCH_PATHS" => header_search_paths }
ss.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "FB_SONARKIT_ENABLED=1", "OTHER_SWIFT_FLAGS" => "-Xcc -DFB_SONARKIT_ENABLED=1" }
end end
spec.subspec 'FlipperKitHighlightOverlay' do |ss| spec.subspec 'FlipperKitHighlightOverlay' do |ss|
@@ -128,7 +129,8 @@ Pod::Spec.new do |spec|
spec.subspec "FlipperKitLayoutComponentKitSupport" do |ss| spec.subspec "FlipperKitLayoutComponentKitSupport" do |ss|
ss.header_dir = "FlipperKitLayoutComponentKitSupport" ss.header_dir = "FlipperKitLayoutComponentKitSupport"
ss.dependency 'FlipperKit/Core' ss.dependency 'FlipperKit/Core'
ss.dependency 'ComponentKit', '~> 0.0' ss.dependency 'ComponentKit', '~> 0.30'
ss.dependency 'RenderCore', '~> 0.30'
ss.dependency 'FlipperKit/FlipperKitLayoutPlugin' ss.dependency 'FlipperKit/FlipperKitLayoutPlugin'
ss.dependency 'FlipperKit/FlipperKitLayoutTextSearchable' ss.dependency 'FlipperKit/FlipperKitLayoutTextSearchable'
ss.dependency 'FlipperKit/FlipperKitHighlightOverlay' ss.dependency 'FlipperKit/FlipperKitHighlightOverlay'

View File

@@ -10,26 +10,43 @@ We support both Swift and Objective-C for Flipper with CocoaPods as build and di
The following configuration assumed CocoaPods 1.9+. The following configuration assumed CocoaPods 1.9+.
<!--DOCUSAURUS_CODE_TABS-->
<!--Objective-C-->
```ruby ```ruby
project 'MyApp.xcodeproj' project 'MyApp.xcodeproj'
flipperkit_version = '0.40.0' flipperkit_version = '0.40.0'
target 'MyApp' do target 'MyApp' do
platform :ios, '9.0' platform :ios, '9.0'
# use_framework!
pod 'FlipperKit', '~>' + flipperkit_version # It is likely that you'll only want to include Flipper in debug builds,
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version # in which case you add the `:configuration` directive:
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version pod 'FlipperKit', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version, :configuration => 'Debug'
# ...unfortunately at this time that means you'll need to explicitly mark
# transitive dependencies as being for debug build only as well:
pod 'Flipper-DoubleConversion', :configuration => 'Debug'
pod 'Flipper-Folly', :configuration => 'Debug'
pod 'Flipper-Glog', :configuration => 'Debug'
pod 'Flipper-PeerTalk', :configuration => 'Debug'
pod 'CocoaLibEvent', :configuration => 'Debug'
pod 'boost-for-react-native', :configuration => 'Debug'
pod 'OpenSSL-Universal', :configuration => 'Debug'
pod 'CocoaAsyncSocket', :configuration => 'Debug'
# ...except, of course, those transitive dependencies that your
# application itself depends, e.g.:
pod 'ComponentKit', '~> 0.30'
# If you use `use_frameworks!` in your Podfile, # If you use `use_frameworks!` in your Podfile,
# uncomment the below $static_framework array and also # uncomment the below $static_framework array and also
# the pre_install section. This will cause Flipper and # the pre_install section. This will cause Flipper and
# it's dependencies to be built as a static library and all other pods to # it's dependencies to be built as a static library and all other pods to
# be dynamic. # be dynamic.
#
# NOTE Doing this may lead to a broken build if any of these are also
# transitive dependencies of other dependencies and are expected
# to be built as frameworks.
#
# $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
# 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion', # 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
# 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', # 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
@@ -45,108 +62,9 @@ target 'MyApp' do
# end # end
# end # end
# end # end
# This post_install hook adds the -DFB_SONARKIT_ENABLED=1 flag to OTHER_CFLAGS, necessary to expose Flipper classes in the header files
post_install do |installer|
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
cflags << '-DFB_SONARKIT_ENABLED=1'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
app_project.save
end
installer.pods_project.save
end
end end
``` ```
<!--Swift-->
```ruby
project 'MyApp.xcodeproj'
flipperkit_version = '0.40.0'
target 'MyApp' do
platform :ios, '9.0'
pod 'FlipperKit', '~>' + flipperkit_version
# Layout and network plugins are not yet supported for swift projects
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version
# If you use `use_frameworks!` in your Podfile,
# uncomment the below $static_framework array and also
# the pre_install section. This will cause Flipper and
# it's dependencies to be built as a static library and all other pods to
# be dynamic.
# $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
# 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
# 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
# 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']
#
# pre_install do |installer|
# Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
# installer.pod_targets.each do |pod|
# if $static_framework.include?(pod.name)
# def pod.build_type;
# Pod::BuildType.static_library
# end
# end
# end
# end
# This post_install hook adds the -DFB_SONARKIT_ENABLED flag to OTHER_SWIFT_FLAGS, necessary to build swift target
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
if (config.build_settings['OTHER_SWIFT_FLAGS'])
unless config.build_settings['OTHER_SWIFT_FLAGS'].include? '-DFB_SONARKIT_ENABLED'
puts 'Adding -DFB_SONARKIT_ENABLED ...'
swift_flags = config.build_settings['OTHER_SWIFT_FLAGS']
if swift_flags.split.last != '-Xcc'
config.build_settings['OTHER_SWIFT_FLAGS'] << ' -Xcc'
end
config.build_settings['OTHER_SWIFT_FLAGS'] << ' -DFB_SONARKIT_ENABLED'
end
else
puts 'OTHER_SWIFT_FLAGS does not exist thus assigning it to `$(inherited) -Xcc -DFB_SONARKIT_ENABLED`'
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -Xcc -DFB_SONARKIT_ENABLED'
end
app_project.save
end
end
installer.pods_project.save
end
end
```
<!--END_DOCUSAURUS_CODE_TABS-->
You need to compile your project with the `FB_SONARKIT_ENABLED=1` compiler flag. The above `post_install` hook adds this compiler flag to your project settings.
<div class="warning">
On the first run of `pod install`, `FB_SONARKIT_ENABLED=1` may not be added in the "Build Settings" of your project, but in all the subsequent runs of `pod install`, the above `post_install` hook successfully adds the compiler flag. So before running your app, make sure that `FB_SONARKIT_ENABLED=1` is present in `OTHER_CFLAGS` and `OTHER_SWIFT_FLAGS` for Objective-C and Swift projects respectively.
</div>
## For pure Objective-C projects ## For pure Objective-C projects
For pure Objective-C projects, add the following things in your settings: For pure Objective-C projects, add the following things in your settings:
@@ -158,11 +76,11 @@ For pure Objective-C projects, add the following things in your settings:
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
``` ```
3. If after the above two steps there are still error's like `Undefined symbol _swift_getFunctionReplacement` then set `DEAD_CODE_STRIPPING` to `YES`. Reference for this fix is [here](https://forums.swift.org/t/undefined-symbol-swift-getfunctionreplacement/30495/4) 3. If after the above two steps there are still error's like `Undefined symbol _swift_getFunctionReplacement` then set `DEAD_CODE_STRIPPING` to `YES`. Reference for this fix is [here](https://forums.swift.org/t/undefined-symbol-swift-getfunctionreplacement/30495/4)
This is done to overcome a bug with Xcode 11 which fails to compile swift code when bitcode is enabled. Flipper transitively depends on YogaKit which is written in Swift. More about this issue can be found [here](https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21) and [here](https://github.com/Carthage/Carthage/issues/2825). This is done to overcome a bug with Xcode 11 which fails to compile swift code when bitcode is enabled. Flipper transitively depends on YogaKit which is written in Swift. More about this issue can be found [here](https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21) and [here](https://github.com/Carthage/Carthage/issues/2825).
Install the dependencies by running `pod install`. You can now import and initialize Flipper in your Install the dependencies by running `pod install`. You can now import and initialize Flipper in your
AppDelegate. AppDelegate.

View File

@@ -10,7 +10,7 @@
#import <ComponentKit/CKComponentLayout.h> #import <ComponentKit/CKComponentLayout.h>
#import <ComponentKit/CKFlexboxComponent.h> #import <ComponentKit/CKFlexboxComponent.h>
#import <ComponentKit/CKOptional.h> #import <ComponentKit/CKOptional.h>
#import <ComponentKit/CKVariant.h> #import <RenderCore/CKVariant.h>
#import <vector> #import <vector>

View File

@@ -4,50 +4,22 @@ source 'https://github.com/CocoaPods/Specs'
target 'Sample' do target 'Sample' do
platform :ios, '9.0' platform :ios, '9.0'
pod 'FlipperKit', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/SKIOSNetworkPlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitReactPlugin', :path => '../../FlipperKit.podspec'
pod 'Flipper', :path => '../../Flipper.podspec'
# If you use `use_frameworks!` in your Podfile, # See docs/getting-started/ios-native.mdx
# uncomment the below $static_framework array and also pod 'FlipperKit', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# the pre_install section. This will cause Flipper and pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# it's dependencies to be built as a static library and all other pods to pod 'FlipperKit/SKIOSNetworkPlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# be dynamic. pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', pod 'FlipperKit/FlipperKitReactPlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', pod 'Flipper', :path => '../../Flipper.podspec', :configuration => 'Debug'
# 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native'] pod 'Flipper-DoubleConversion', :configuration => 'Debug'
# pod 'Flipper-Folly', :configuration => 'Debug'
# pre_install do |installer| pod 'Flipper-Glog', :configuration => 'Debug'
# Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} pod 'Flipper-PeerTalk', :configuration => 'Debug'
# installer.pod_targets.each do |pod| pod 'CocoaLibEvent', :configuration => 'Debug'
# if $static_framework.include?(pod.name) pod 'boost-for-react-native', :configuration => 'Debug'
# def pod.build_type; pod 'OpenSSL-Universal', :configuration => 'Debug'
# Pod::Target::BuildType.static_library pod 'CocoaAsyncSocket', :configuration => 'Debug'
# end pod 'ComponentKit', '~> 0.30'
# end
# end
# end
# It also adds -DFB_SONARKIT_ENABLED=1 flag to OTHER_CFLAGS, necessary to build expose Flipper classes in the header files
post_install do |installer|
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
cflags << '-DFB_SONARKIT_ENABLED=1'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
app_project.save
end
installer.pods_project.save
end
end end

View File

@@ -331,17 +331,12 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = BDF8FF7C018FDB3437209993 /* Pods-Sample.debug.xcconfig */; baseConfigurationReference = BDF8FF7C018FDB3437209993 /* Pods-Sample.debug.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
GCC_NO_COMMON_BLOCKS = YES; GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
"COCOAPODS=1",
);
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"\"${PODS_ROOT}/Headers/Public\"", "\"${PODS_ROOT}/Headers/Public\"",
@@ -368,41 +363,6 @@
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
); );
OTHER_CFLAGS = (
"$(inherited)",
"-fmodule-map-file=\"${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap\"",
"-fmodule-map-file=\"${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap\"",
"-fmodule-map-file=\"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit/YogaKit.modulemap\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/CocoaAsyncSocket\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/CocoaLibEvent\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/ComponentKit\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/Flipper\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/FlipperKit\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/Folly\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/OpenSSL-Static\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/PeerTalk\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/RSocket\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/Yoga\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/YogaKit\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/glog\"",
"-DFB_SONARKIT_ENABLED=1",
);
OTHER_CPLUSPLUSFLAGS = ( OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)", "$(OTHER_CFLAGS)",
"-Wno-implicit-retain-self", "-Wno-implicit-retain-self",
@@ -435,7 +395,6 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 081A9FC23643CD21C7D61AA1 /* Pods-Sample.release.xcconfig */; baseConfigurationReference = 081A9FC23643CD21C7D61AA1 /* Pods-Sample.release.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
@@ -468,41 +427,6 @@
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
); );
OTHER_CFLAGS = (
"$(inherited)",
"-fmodule-map-file=\"${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap\"",
"-fmodule-map-file=\"${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap\"",
"-fmodule-map-file=\"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit/YogaKit.modulemap\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/CocoaAsyncSocket\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/CocoaLibEvent\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/ComponentKit\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/Flipper\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/FlipperKit\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/Folly\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/OpenSSL-Static\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/PeerTalk\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/RSocket\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/Yoga\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/YogaKit\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/glog\"",
"-DFB_SONARKIT_ENABLED=1",
);
OTHER_CPLUSPLUSFLAGS = ( OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)", "$(OTHER_CFLAGS)",
"-Wno-implicit-retain-self", "-Wno-implicit-retain-self",

View File

@@ -4,55 +4,21 @@ source 'https://github.com/CocoaPods/Specs'
target 'SampleSwift' do target 'SampleSwift' do
platform :ios, '10.0' platform :ios, '10.0'
pod 'Flipper', :path => '../../Flipper.podspec'
pod 'FlipperKit', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/SKIOSNetworkPlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec'
# If you use `use_frameworks!` in your Podfile, # See docs/getting-started/ios-native.mdx
# uncomment the below $static_framework array and also pod 'FlipperKit', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# the pre_install section. This will cause Flipper and pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# it's dependencies to be built as a static library and all other pods to pod 'FlipperKit/SKIOSNetworkPlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# be dynamic. pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec', :configuration => 'Debug'
# 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', pod 'Flipper', :path => '../../Flipper.podspec', :configuration => 'Debug'
# 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', pod 'Flipper-DoubleConversion', :configuration => 'Debug'
# 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native'] pod 'Flipper-Folly', :configuration => 'Debug'
# pod 'Flipper-Glog', :configuration => 'Debug'
# pre_install do |installer| pod 'Flipper-PeerTalk', :configuration => 'Debug'
# Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} pod 'CocoaLibEvent', :configuration => 'Debug'
# installer.pod_targets.each do |pod| pod 'boost-for-react-native', :configuration => 'Debug'
# if $static_framework.include?(pod.name) pod 'OpenSSL-Universal', :configuration => 'Debug'
# def pod.build_type; pod 'CocoaAsyncSocket', :configuration => 'Debug'
# Pod::Target::BuildType.static_library pod 'ComponentKit', '~> 0.30'
# end
# end
# end
# end
post_install do |installer|
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
if (config.build_settings['OTHER_SWIFT_FLAGS'])
unless config.build_settings['OTHER_SWIFT_FLAGS'].include? '-DFB_SONARKIT_ENABLED'
puts 'Adding -DFB_SONARKIT_ENABLED ...'
swift_flags = config.build_settings['OTHER_SWIFT_FLAGS']
if swift_flags.split.last != '-Xcc'
config.build_settings['OTHER_SWIFT_FLAGS'] << ' -Xcc'
end
config.build_settings['OTHER_SWIFT_FLAGS'] << ' -DFB_SONARKIT_ENABLED'
end
else
puts 'OTHER_SWIFT_FLAGS does not exist thus assigning it to `$(inherited) -Xcc -DFB_SONARKIT_ENABLED`'
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -Xcc -DFB_SONARKIT_ENABLED'
end
app_project.save
end
end
installer.pods_project.save
end
end end

View File

@@ -334,22 +334,6 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/Headers/Public\"",
"\"${PODS_ROOT}/Headers/Public/CocoaAsyncSocket\"",
"\"${PODS_ROOT}/Headers/Public/CocoaLibEvent\"",
"\"${PODS_ROOT}/Headers/Public/ComponentKit\"",
"\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
"\"${PODS_ROOT}/Headers/Public/Folly\"",
"\"${PODS_ROOT}/Headers/Public/OpenSSL-Static\"",
"\"${PODS_ROOT}/Headers/Public/PeerTalk\"",
"\"${PODS_ROOT}/Headers/Public/RSocket\"",
"\"${PODS_ROOT}/Headers/Public/Flipper\"",
"\"${PODS_ROOT}/Headers/Public/FlipperKit\"",
"\"${PODS_ROOT}/Headers/Public/Yoga\"",
"\"${PODS_ROOT}/Headers/Public/glog\"",
);
INFOPLIST_FILE = SampleSwift/Info.plist; INFOPLIST_FILE = SampleSwift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@@ -371,7 +355,6 @@
"-framework", "-framework",
"\"Security\"", "\"Security\"",
); );
OTHER_SWIFT_FLAGS = "$(inherited) -Xcc -fmodule-map-file=\"${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap\" -Xcc -DFB_SONARKIT_ENABLED";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper.SampleSwift; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper.SampleSwift;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -388,22 +371,6 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/Headers/Public\"",
"\"${PODS_ROOT}/Headers/Public/CocoaAsyncSocket\"",
"\"${PODS_ROOT}/Headers/Public/CocoaLibEvent\"",
"\"${PODS_ROOT}/Headers/Public/ComponentKit\"",
"\"${PODS_ROOT}/Headers/Public/DoubleConversion\"",
"\"${PODS_ROOT}/Headers/Public/Folly\"",
"\"${PODS_ROOT}/Headers/Public/OpenSSL-Static\"",
"\"${PODS_ROOT}/Headers/Public/PeerTalk\"",
"\"${PODS_ROOT}/Headers/Public/RSocket\"",
"\"${PODS_ROOT}/Headers/Public/Flipper\"",
"\"${PODS_ROOT}/Headers/Public/FlipperKit\"",
"\"${PODS_ROOT}/Headers/Public/Yoga\"",
"\"${PODS_ROOT}/Headers/Public/glog\"",
);
INFOPLIST_FILE = SampleSwift/Info.plist; INFOPLIST_FILE = SampleSwift/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@@ -425,7 +392,6 @@
"-framework", "-framework",
"\"Security\"", "\"Security\"",
); );
OTHER_SWIFT_FLAGS = "$(inherited) -Xcc -fmodule-map-file=\"${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap\" -Xcc -DFB_SONARKIT_ENABLED";
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper.SampleSwift; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper.SampleSwift;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;