Update installation instruction for CP 1.7+ (#522)

Summary:
This PR updates the installation instruction for Cocoapods 1.7+ as the previous installation instruction was broken for the latest Cocoapods version

Solves https://github.com/facebook/flipper/issues/478 and https://github.com/facebook/flipper/issues/495

## Changelog

- Updated the Documentation
- Updated the sample app
Pull Request resolved: https://github.com/facebook/flipper/pull/522

Test Plan:
- Travis CI
- Also tested locally by building sample app.

Reviewed By: jknoxville

Differential Revision: D16902023

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 19cc01c842f93ab3565c302f8258ca88dbdecfb2
This commit is contained in:
Pritesh Nandgaonkar
2019-08-20 07:01:06 -07:00
committed by Facebook Github Bot
parent a2a288182d
commit 6056e85f5d
5 changed files with 114 additions and 18 deletions

View File

@@ -44,6 +44,8 @@ matrix:
cache: cocoapods cache: cocoapods
before_install: before_install:
- gem install cocoapods
- pod --version
- rm -rf iOS/Sample/Pods - rm -rf iOS/Sample/Pods
- rm -f iOS/Sample/Podfile.lock - rm -f iOS/Sample/Podfile.lock
- rm -f iOS/Sample/build.log - rm -f iOS/Sample/build.log
@@ -64,6 +66,8 @@ matrix:
- language: objective-c - language: objective-c
before_install: before_install:
- gem install cocoapods
- pod --version
- rm -rf iOS/SampleSwift/Pods - rm -rf iOS/SampleSwift/Pods
- rm -f iOS/SampleSwift/Podfile.lock - rm -f iOS/SampleSwift/Podfile.lock
- rm -f iOS/SampleSwift/build.log - rm -f iOS/SampleSwift/build.log

View File

@@ -99,7 +99,7 @@ dependencies {
## Setup your iOS app ## Setup your iOS app
We support both Swift and Objective-C for Flipper with CocoaPods as build and distribution mechanism. We support both Swift and Objective-C for Flipper with CocoaPods as build and distribution mechanism. For CocoaPods 1.7+ following is the configuration.
### CocoaPods ### CocoaPods
@@ -107,18 +107,46 @@ We support both Swift and Objective-C for Flipper with CocoaPods as build and di
<!--Objective-C--> <!--Objective-C-->
```ruby ```ruby
project 'MyApp.xcodeproj' project 'MyApp.xcodeproj'
swift_version = "4.1"
flipperkit_version = '0.23.4' flipperkit_version = '0.23.4'
target 'MyApp' do target 'MyApp' do
platform :ios, '9.0' platform :ios, '9.0'
# use_framework!
pod 'FlipperKit', '~>' + flipperkit_version pod 'FlipperKit', '~>' + flipperkit_version
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
# 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', 'DoubleConversion',
# 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
# 'CocoaLibEvent', 'openssl-ios-bitcode', '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::Target::BuildType.static_library
# 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 # 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| 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] file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name) app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target| app_project.native_targets.each do |target|
@@ -139,7 +167,6 @@ end
<!--Swift--> <!--Swift-->
```ruby ```ruby
project 'MyApp.xcodeproj' project 'MyApp.xcodeproj'
swift_version = "4.1"
flipperkit_version = '0.23.4' flipperkit_version = '0.23.4'
target 'MyApp' do target 'MyApp' do
@@ -154,26 +181,34 @@ target 'MyApp' do
# 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 static and all other pods to # it's dependencies to be built as a static library and all other pods to
# be dynamic. # be dynamic.
# $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
# 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', # 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
# 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', # 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
# 'CocoaLibEvent', 'OpenSSL-Static', 'boost-for-react-native'] # 'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native']
# #
# pre_install do |installer| # pre_install do |installer|
# Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} # Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
# installer.pod_targets.each do |pod| # installer.pod_targets.each do |pod|
# if $static_framework.include?(pod.name) # if $static_framework.include?(pod.name)
# pod.instance_variable_set(:@host_requires_frameworks, false) # def pod.build_type;
# Pod::Target::BuildType.static_library
# end
# end
# end # end
# end
# end # end
# This post_install hook adds the -DFB_SONARKIT_ENABLED flag to OTHER_SWIFT_FLAGS, necessary to build swift target # This post_install hook adds the -DFB_SONARKIT_ENABLED flag to OTHER_SWIFT_FLAGS, necessary to build swift target
post_install do |installer| 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] file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name) app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target| app_project.native_targets.each do |target|

View File

@@ -1,7 +1,6 @@
project 'Sample.xcodeproj' project 'Sample.xcodeproj'
source 'https://github.com/facebook/Sonar.git' source 'https://github.com/facebook/Sonar.git'
source 'https://github.com/CocoaPods/Specs' source 'https://github.com/CocoaPods/Specs'
swift_version = "4.1"
target 'Sample' do target 'Sample' do
platform :ios, '9.0' platform :ios, '9.0'
@@ -11,8 +10,37 @@ 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'
# 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', 'DoubleConversion',
# 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
# 'CocoaLibEvent', 'openssl-ios-bitcode', '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::Target::BuildType.static_library
# end
# end
# end
# end
# It also adds -DFB_SONARKIT_ENABLED=1 flag to OTHER_CFLAGS, necessary to build expose Flipper classes in the header files # 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|
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] file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name) app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target| app_project.native_targets.each do |target|

View File

@@ -1,7 +1,6 @@
project 'SampleSwift.xcodeproj' project 'SampleSwift.xcodeproj'
source 'https://github.com/facebook/Sonar.git' source 'https://github.com/facebook/Sonar.git'
source 'https://github.com/CocoaPods/Specs' source 'https://github.com/CocoaPods/Specs'
swift_version = "4.1"
target 'SampleSwift' do target 'SampleSwift' do
platform :ios, '9.0' platform :ios, '9.0'
@@ -11,7 +10,36 @@ 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'
# 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', 'DoubleConversion',
# 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
# 'CocoaLibEvent', 'openssl-ios-bitcode', '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::Target::BuildType.static_library
# end
# end
# end
# end
post_install do |installer| 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] file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name) app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target| app_project.native_targets.each do |target|

View File

@@ -1,6 +1,6 @@
project 'Tutorial.xcodeproj' project 'Tutorial.xcodeproj'
swift_version = "4.1" swift_version = "4.1"
flipperkit_version = '0.20.0' flipperkit_version = '0.23.4'
use_frameworks! use_frameworks!
target 'Tutorial' do target 'Tutorial' do
@@ -17,19 +17,20 @@ target 'Tutorial' do
# the pre_install section. This will cause Flipper and # the pre_install section. This will cause Flipper and
# it's dependencies to be static and all other pods to # it's dependencies to be static and all other pods to
# be dynamic. # be dynamic.
$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion', 'CocoaAsyncSocket', 'ComponentKit', 'DoubleConversion',
'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', 'glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
'CocoaLibEvent', 'OpenSSL-Static', 'boost-for-react-native'] 'CocoaLibEvent', 'openssl-ios-bitcode', 'boost-for-react-native']
pre_install do |installer| pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod| installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name) if $static_framework.include?(pod.name)
pod.instance_variable_set(:@host_requires_frameworks, false) def pod.build_type;
Pod::Target::BuildType.static_library
end
end
end end
end
end end