Reference/Podspec

2021-12-09  本文已影响0人  李永开

一.这就是Podspec

Podspec全程 pods specification,即pod的说明文件


图片.png

里面可以描述的很详细

Pod::Spec.new do |spec|
spec.name = 'Reachability'
spec.version = '3.1.0'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/tonymillion/Reachability'
spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
spec.module_name = 'Rich'
spec.swift_version = '4.0'

spec.ios.deployment_target = '9.0'
spec.osx.deployment_target = '10.10'

spec.source_files = 'Reachability/common/.swift'
spec.ios.source_files = 'Reachability/ios/
.swift', 'Reachability/extensions/.swift'
spec.osx.source_files = 'Reachability/osx/
.swift'

spec.framework = 'SystemConfiguration'
spec.ios.framework = 'UIKit'
spec.osx.framework = 'AppKit'

spec.dependency 'SomeOtherPod'
end

二.Root specification vs sub-specifications

具体字段参考https://guides.cocoapods.org/syntax/podspec.html#group_root_specification

三. Build settings

spec.dependency 'AFNetworking', '~> 1.0'
spec.dependency 'AFNetworking', '~> 1.0', :configurations => ['Debug']
spec.dependency 'AFNetworking', '~> 1.0', :configurations => :debug
spec.dependency 'RestKit/CoreData', '~> 0.20.0'
spec.ios.dependency 'MBProgressHUD', '~> 0.5'

spec.info_plist = {
'CFBundleIdentifier' => 'com.myorg.MyLib',
'MY_VAR' => 'SOME_VALUE'
}

spec.ios.framework = 'CFNetwork'
spec.frameworks = 'QuartzCore', 'CoreData'

spec.weak_framework = 'Twitter'
spec.weak_frameworks = 'Twitter', 'SafariServices'

spec.ios.library = 'xml2'
spec.libraries = 'xml2', 'z'

spec.compiler_flags = '-DOS_OBJECT_USE_OBJC=0', '-Wno-format'

spec.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }

spec.user_target_xcconfig = { 'MY_SUBSPEC' => 'YES' }

spec.prefix_header_contents = '#import <UIKit/UIKit.h>'
spec.prefix_header_contents = '#import <UIKit/UIKit.h>', '#import <Foundation/Foundation.h>'

spec.prefix_header_file = 'iphone/include/prefix.pch'
spec.prefix_header_file = false

spec.module_name = 'Three20'

spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' }

spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', :execution_position => :before_compile }

spec.script_phase = { :name => 'Hello World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' }

spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"',
:input_files => ['/path/to/input_file.txt'], :output_files => ['/path/to/output_file.txt']
}

spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"',
:input_file_lists => ['/path/to/input_files.xcfilelist'], :output_file_lists => ['/path/to/output_files.xcfilelist']
}

spec.script_phases = [
{ :name => 'Hello World', :script => 'echo "Hello World"' },
{ :name => 'Hello Ruby World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' },
]

四. File patterns

https://guides.cocoapods.org/syntax/podspec.html#group_file_patterns

五.Subspecs

https://guides.cocoapods.org/syntax/podspec.html#group_subspecs

上一篇 下一篇

猜你喜欢

热点阅读