Docs with an updated install instruction (#343)

Summary:
This PR updates the installation instruction. It missed few crucial information and thus the projects installing flipper as a dependency were facing issues. It addresses the issue #341. It also brings the sample application at par with the documentation.
Pull Request resolved: https://github.com/facebook/flipper/pull/343

Reviewed By: danielbuechele

Differential Revision: D13507298

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 5a4b23d79930cb7eeb491e359b616d3558e260fb
This commit is contained in:
Pritesh Nandgaonkar
2018-12-21 07:38:35 -08:00
committed by Facebook Github Bot
parent 470c770e97
commit da37ab78bd
6 changed files with 232 additions and 53 deletions

View File

@@ -87,7 +87,11 @@ dependencies {
### Setup your iOS app ### Setup your iOS app
To integrate with an iOS app, you can use [CocoaPods](https://cocoapods.org). Add the mobile Flipper SDK and its dependencies to your `Podfile`: To integrate with an iOS app, you can use [CocoaPods](https://cocoapods.org). Add the mobile Flipper SDK and its dependencies to your `Podfile`
### Objective-c
Podfile for Objective-C projects will look like the following
```ruby ```ruby
project 'MyApp.xcodeproj' project 'MyApp.xcodeproj'
@@ -103,8 +107,8 @@ target 'MyApp' do
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>' + flipperkit_version
pod 'FlipperKit/FlipperKitCrashReporterPlugin', '~>' + flipperkit_version # This post_install script adds swift version to yogakit's pod target.
# 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| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
if ['YogaKit'].include? target.name if ['YogaKit'].include? target.name
@@ -113,32 +117,123 @@ target 'MyApp' do
end end
end 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_CFLAGS'])
if !(config.build_settings['OTHER_CFLAGS'].include? '-DFB_SONARKIT_ENABLED=1')
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
config.build_settings['OTHER_CFLAGS'] << '-DFB_SONARKIT_ENABLED=1'
end
else
puts 'OTHER_CFLAGS does not exist, assigining it to `$(inherited), -DFB_SONARKIT_ENABLED=1` '
config.build_settings['OTHER_CFLAGS'] = '$(inherited) -DFB_SONARKIT_ENABLED=1 '
end
app_project.save
end
end
end end
end end
``` ```
and install the dependencies by running `pod install`. When you open the Xcode workspace file for your app, you now can import and initialize Flipper in your AppDelegate. Install the dependencies by running `pod install`.When you open the Xcode workspace file for your app, you now can import and initialize Flipper in your AppDelegate. Before running your app, make sure that the flag `-DFB_SONARKIT_ENABLED=1` is present in the `OTHER_CFLAGS` in your application's build settings.
```objective-c ```objective-c
#import <FlipperKit/FlipperClient.h> #import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitLayoutComponentKitSupport/FlipperKitLayoutComponentKitSupport.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h> #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
@implementation AppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ {
#if DEBUG
FlipperClient *client = [FlipperClient sharedClient]; FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode: application [FlipperKitLayoutComponentKitSupport setUpWithDescriptorMapper: layoutDescriptorMapper];
[client addPlugin: [[FlipperKitLayoutPlugin alloc] initWithRootNode: application
withDescriptorMapper: layoutDescriptorMapper]]; withDescriptorMapper: layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client start];
[client addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start]; [client start];
#endif
... ...
} }
@end @end
```
### Swift
Podfile for the swift projects will look like the following:
```ruby
project 'MyApp.xcodeproj'
source 'https://github.com/facebook/flipper.git'
source 'https://github.com/CocoaPods/Specs'
swift_version = "4.1"
flipperkit_version = '0.13.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
# This post_install script adds -DFB_SONARKIT_ENABLED flag to OTHER_SWIFT_FLAGS, necessary to build swift target
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'])
if !(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
end
end
```
Install the dependencies by running `pod install`.When you open the Xcode workspace file for your app, you now can import and initialize Flipper in your AppDelegate by following the below mentioned example. Before running your app, make sure that the flag `-Xcc -DFB_SONARKIT_ENABLED` is present in the `OTHER_SWIFT_FLAGS` in your application's build settings.
```swift
import UIKit
import FlipperKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let client = FlipperClient.shared()
let layoutDescriptorMapper = SKDescriptorMapper(defaults: ())
FlipperKitLayoutComponentKitSupport.setUpWith(layoutDescriptorMapper)
client?.add(FlipperKitLayoutPlugin(rootNode: application, with: layoutDescriptorMapper!))
client?.start()
return true
}
}
``` ```
<div class="warning"> <div class="warning">

View File

@@ -11,8 +11,9 @@ target 'Sample' do
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec'
pod 'Flipper', :path => '../../Flipper.podspec' pod 'Flipper', :path => '../../Flipper.podspec'
# This post_install script adds swift version to yogakit's pod target.
# 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| post_install do |installer|
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
if ['YogaKit'].include? target.name if ['YogaKit'].include? target.name
target.build_configurations.each do |config| target.build_configurations.each do |config|
@@ -20,6 +21,21 @@ target 'Sample' do
end end
end 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_CFLAGS'])
if !(config.build_settings['OTHER_CFLAGS'].include? '-DFB_SONARKIT_ENABLED=1')
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
config.build_settings['OTHER_CFLAGS'] << '-DFB_SONARKIT_ENABLED=1'
end
else
puts 'OTHER_CFLAGS does not exist, assigining it to `$(inherited), -DFB_SONARKIT_ENABLED=1` '
config.build_settings['OTHER_CFLAGS'] = '$(inherited) -DFB_SONARKIT_ENABLED=1 '
end
app_project.save
end
end
end end
end end

View File

@@ -11,7 +11,7 @@
4E102341216AD7B400160734 /* UserDefaultsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E102340216AD7B400160734 /* UserDefaultsViewController.m */; }; 4E102341216AD7B400160734 /* UserDefaultsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E102340216AD7B400160734 /* UserDefaultsViewController.m */; };
53B4A36B217E2B6200B36A53 /* CommunicationDemoViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53B4A36A217E2B6200B36A53 /* CommunicationDemoViewController.mm */; }; 53B4A36B217E2B6200B36A53 /* CommunicationDemoViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53B4A36A217E2B6200B36A53 /* CommunicationDemoViewController.mm */; };
53D59DB320ABA18400207065 /* NetworkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAA20ABA18300207065 /* NetworkViewController.m */; }; 53D59DB320ABA18400207065 /* NetworkViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAA20ABA18300207065 /* NetworkViewController.m */; };
53D59DB420ABA18400207065 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAB20ABA18300207065 /* AppDelegate.mm */; }; 53D59DB420ABA18400207065 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAB20ABA18300207065 /* AppDelegate.m */; };
53D59DB520ABA18400207065 /* MainViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAD20ABA18300207065 /* MainViewController.mm */; }; 53D59DB520ABA18400207065 /* MainViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAD20ABA18300207065 /* MainViewController.mm */; };
53D59DB620ABA18400207065 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAF20ABA18300207065 /* RootViewController.mm */; }; 53D59DB620ABA18400207065 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 53D59DAF20ABA18300207065 /* RootViewController.mm */; };
53D59DB720ABA18400207065 /* MainStoryBoard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 53D59DB020ABA18400207065 /* MainStoryBoard.storyboard */; }; 53D59DB720ABA18400207065 /* MainStoryBoard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 53D59DB020ABA18400207065 /* MainStoryBoard.storyboard */; };
@@ -26,7 +26,7 @@
534252A9217DECCD0092D02B /* CommunicationDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommunicationDemoViewController.h; sourceTree = "<group>"; }; 534252A9217DECCD0092D02B /* CommunicationDemoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommunicationDemoViewController.h; sourceTree = "<group>"; };
53B4A36A217E2B6200B36A53 /* CommunicationDemoViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CommunicationDemoViewController.mm; sourceTree = "<group>"; }; 53B4A36A217E2B6200B36A53 /* CommunicationDemoViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CommunicationDemoViewController.mm; sourceTree = "<group>"; };
53D59DAA20ABA18300207065 /* NetworkViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkViewController.m; sourceTree = SOURCE_ROOT; }; 53D59DAA20ABA18300207065 /* NetworkViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkViewController.m; sourceTree = SOURCE_ROOT; };
53D59DAB20ABA18300207065 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = SOURCE_ROOT; }; 53D59DAB20ABA18300207065 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = SOURCE_ROOT; };
53D59DAC20ABA18300207065 /* NetworkViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkViewController.h; sourceTree = SOURCE_ROOT; }; 53D59DAC20ABA18300207065 /* NetworkViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkViewController.h; sourceTree = SOURCE_ROOT; };
53D59DAD20ABA18300207065 /* MainViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainViewController.mm; sourceTree = SOURCE_ROOT; }; 53D59DAD20ABA18300207065 /* MainViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainViewController.mm; sourceTree = SOURCE_ROOT; };
53D59DAE20ABA18300207065 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = SOURCE_ROOT; }; 53D59DAE20ABA18300207065 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = SOURCE_ROOT; };
@@ -59,7 +59,7 @@
children = ( children = (
53B4A36A217E2B6200B36A53 /* CommunicationDemoViewController.mm */, 53B4A36A217E2B6200B36A53 /* CommunicationDemoViewController.mm */,
53D59DBA20ABA20300207065 /* AppDelegate.h */, 53D59DBA20ABA20300207065 /* AppDelegate.h */,
53D59DAB20ABA18300207065 /* AppDelegate.mm */, 53D59DAB20ABA18300207065 /* AppDelegate.m */,
53D59DB120ABA18400207065 /* Icons.xcassets */, 53D59DB120ABA18400207065 /* Icons.xcassets */,
53D59DB020ABA18400207065 /* MainStoryBoard.storyboard */, 53D59DB020ABA18400207065 /* MainStoryBoard.storyboard */,
53D59DB220ABA18400207065 /* MainViewController.h */, 53D59DB220ABA18400207065 /* MainViewController.h */,
@@ -206,7 +206,7 @@
53E0DE5420ABA0E4005682E1 /* main.m in Sources */, 53E0DE5420ABA0E4005682E1 /* main.m in Sources */,
4E102341216AD7B400160734 /* UserDefaultsViewController.m in Sources */, 4E102341216AD7B400160734 /* UserDefaultsViewController.m in Sources */,
53D59DB320ABA18400207065 /* NetworkViewController.m in Sources */, 53D59DB320ABA18400207065 /* NetworkViewController.m in Sources */,
53D59DB420ABA18400207065 /* AppDelegate.mm in Sources */, 53D59DB420ABA18400207065 /* AppDelegate.m in Sources */,
53B4A36B217E2B6200B36A53 /* CommunicationDemoViewController.mm in Sources */, 53B4A36B217E2B6200B36A53 /* CommunicationDemoViewController.mm in Sources */,
53D59DB520ABA18400207065 /* MainViewController.mm in Sources */, 53D59DB520ABA18400207065 /* MainViewController.mm in Sources */,
53D59DB620ABA18400207065 /* RootViewController.mm in Sources */, 53D59DB620ABA18400207065 /* RootViewController.mm in Sources */,
@@ -337,7 +337,6 @@
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)", "$(inherited)",
"COCOAPODS=1", "COCOAPODS=1",
"FB_SONARKIT_ENABLED=1",
); );
HEADER_SEARCH_PATHS = ( HEADER_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@@ -359,9 +358,43 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
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)",
"-DFB_SONARKIT_ENABLED=1",
"-Wno-implicit-retain-self", "-Wno-implicit-retain-self",
"-Wno-global-constructors", "-Wno-global-constructors",
); );
@@ -387,7 +420,6 @@
"\"Security\"", "\"Security\"",
"-framework", "-framework",
"\"UIKit\"", "\"UIKit\"",
"-DFB_SONARKIT_ENABLED=1",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -423,9 +455,43 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
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)",
"-DFB_SONARKIT_ENABLED=1",
"-Wno-implicit-retain-self", "-Wno-implicit-retain-self",
"-Wno-global-constructors", "-Wno-global-constructors",
); );
@@ -451,7 +517,6 @@
"\"Security\"", "\"Security\"",
"-framework", "-framework",
"\"UIKit\"", "\"UIKit\"",
"-DFB_SONARKIT_ENABLED=1",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.flipper;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -11,15 +11,26 @@ target 'SampleSwift' do
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitUserDefaultsPlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitExamplePlugin', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec' pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec'
post_install do |installer| post_install do |installer|
installer.pods_project.targets.each do |target| file_name = Dir.glob("*.xcodeproj")[0]
if ['YogaKit'].include? target.name app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config| target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = swift_version if (config.build_settings['OTHER_SWIFT_FLAGS'])
if !(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
end end
end end
end
end end

View File

@@ -353,10 +353,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
OTHER_CPLUSPLUSFLAGS = ( OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
"$(OTHER_CFLAGS)",
"-DFB_SONARKIT_ENABLED=1",
);
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
@@ -379,7 +376,6 @@
"\"CFNetwork\"", "\"CFNetwork\"",
"-framework", "-framework",
"\"Security\"", "\"Security\"",
"-DFB_SONARKIT_ENABLED=1",
); );
OTHER_SWIFT_FLAGS = "$(inherited) -Xcc -fmodule-map-file=\"${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap\" -Xcc -DFB_SONARKIT_ENABLED"; 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;
@@ -417,10 +413,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
OTHER_CPLUSPLUSFLAGS = ( OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
"$(OTHER_CFLAGS)",
"-DFB_SONARKIT_ENABLED=1",
);
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
@@ -443,7 +436,6 @@
"\"CFNetwork\"", "\"CFNetwork\"",
"-framework", "-framework",
"\"Security\"", "\"Security\"",
"-DFB_SONARKIT_ENABLED=1",
); );
OTHER_SWIFT_FLAGS = "$(inherited) -Xcc -fmodule-map-file=\"${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap\" -Xcc -DFB_SONARKIT_ENABLED"; 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;