Profile 详解
0x00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| //限制最低版本,不限制的话可能会报错 platform :ios, '9.0'
//不提示第三方库的警告,如果有组件的 inhibit_all_warnings!
//使用静态库 use_modular_headers! //动态库 use_frameworks!
//支持的swift版本 supports_swift_versions '>= 5.0'
//声明使用的安装方法和选项,install! 函数只能调用一次 install! //目前只允许通过 cocoapods 安装 install! 'cocoapods',
支持的key ,显示的是默认值
//清理pod没有使用的所有文件 :clean => true
//是否复制pod的target :deduplicate_targets => true
//是否生成uuid :deterministic_uuids => true
//是否将安装的pods集成到项目中 //如果设置为false, Pods将被下载并安装到Pods/目录中,但不会集成到项目中 :integrate_targets => true
//锁定pods的源文件 :lock_pod_sources => true
//多个源包含相同名称和版本的Pod时发出警告 :warn_for_multiple_pod_sources => true
// :share_schemes_for_development_pods => false
//禁用CocoaPods脚本阶段的输入和输出路径(复制框架和复制资源) //可以解决修改了私有库代码后,无法立即生效的问题 :disable_input_output_paths => false
//是否保留所有pod的文件结构,包括外部pod源。 //默认情况下,Pod源的文件结构仅为开发Pod保留。 //设置:preserve_pod_file_structure为true将始终保存文件结构。 :preserve_pod_file_structure => false
//是否为每个pod目标生成一个项目,而不是创建一个Pods.xcodeproj,此选项将为嵌套在Pods.xcodeproj下的每个pod目标生成一个项目。 //使用此选项可以加快编译速度 :generate_multiple_pod_projects => false
//是否仅启用自上次安装以来已更改的重新生成目标及其关联项目。 :incremental_installation => false
//是否跳过生成Pods.xcodeproj,只执行依赖项解析和下载。 :skip_pods_project_generation
|
0x01 关键字
pod
指定项目的依赖项。依赖项需求由Pod的名称和版本需求列表(可选)定义。
1 2 3 4 5 6 7 8 9
| pod 'Objection', '0.9' // = 0.1,版本0.1。 > 0.1,任何高于0.1的版本。 >= 0.1,版本0.1和任何更高版本。 < 0.1,任何低于0.1的版本。 <= 0.1,版本0.1和任何较低版本。 ~> 0.1.2,版本0.1.2及以上到版本0.2,不含0.2。该操作符基于你在版本需求中指定的最后一个组件工作。这个例子等于>= 0.1.2与< 0.2.0相结合,并且总是匹配与你的需求相匹配的最新已知版本。 ~ > 0.1.3-beta.0,Beta版和release发行版本为0.1.3,发行版本为0.2(不包括0.2)。用破折号(-)分隔的组件将不考虑版本要求。
|
configurations
1 2
| pod 'PonyDebugger', :configurations => ['Debug', 'Beta'] pod 'PonyDebugger', :configuration => 'Debug'
|
模块化,当你使用 use_modular_headers! 属性时,可以从模块头中排除特定的Pod
1
| pod 'SSZipArchive', :modular_headers => false
|
source path
源,默认情况下,在全局级别指定的源按照指定依赖项匹配的顺序进行搜索。这种行为可以通过指定依赖项的来源来改变特定的依赖项
1 2 3 4 5 6
| pod 'PonyDebugger', :source => 'https://github.com/CocoaPods/Specs.git' pod 'AFNetworking', :path => '~/Documents/AFNetworking' pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'dev' pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0' pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af' pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'
|
Subspecs
当通过它的名字安装Pod时,它将安装podspec中定义的所有默认的子规范。
1 2
| pod 'QueryKit/Attribute' pod 'QueryKit', :subspecs => ['Attribute', 'QuerySet']
|
testspecs
1 2
| pod 'AFNetworking', :testspecs => ['UnitTests', 'SomeOtherTests']
|
abstract_target
定义一个新的抽象目标,可用于方便的目标依赖项继承。
1 2 3 4 5 6 7 8 9 10 11 12
| abstract_target 'Networking' do pod 'AlamoFire' target 'ShowsiOS' do pod 'ShowWebAuth' end target 'ShowsTV' do pod 'ShowTVAuth' end end
|
def
预定义模块
1 2 3 4
| def debug_pods pod 'LookinServer', :configurations => ['Debug'] pod 'MLeaksFinder', :configurations => ['Debug'] end
|