Class: Pod::Command::Util::Package
- Inherits:
-
Pod::Command::Util
- Object
- Pod::Command
- Pod::Command::Util
- Pod::Command::Util::Package
- Defined in:
- lib/cocoapods-util/command/package/package.rb,
lib/cocoapods-util/command/package/helper/pod_utils.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Package
constructor
A new instance of Package.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Package
Returns a new instance of Package.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cocoapods-util/command/package/package.rb', line 39 def initialize(argv) @framework = argv.flag?('framework') @xcframework = argv.flag?('xcframework') @library = argv.flag?('library') @local = argv.flag?('local', false) @package_type = if @xcframework :static_xcframework elsif @framework :static_framework elsif @library :static_library else :static_library end @force = argv.flag?('force') @exclude_sim = argv.flag?('exclude-sim', false) @use_modular_headers = argv.flag?('use-modular-headers', false) @name = argv.shift_argument @source = argv.shift_argument @spec_sources = argv.option('spec-sources', 'https://github.com/CocoaPods/Specs.git').split(',') subspecs = argv.option('subspecs') @subspecs = subspecs.split(',') unless subspecs.nil? @framework_contains_resources = argv.flag?('contains-resources', false) @platforms = argv.option('platforms', 'all') @build_settings = JSON.parse(argv.option('build-settings', '{}')) dependency_config = argv.option('dependency-config', '{}') @dependency_config = JSON.parse(dependency_config) @config = argv.option('configuration', 'Release') @source_dir = Dir.pwd @is_spec_from_path = false @spec = spec_with_path(@name) @is_spec_from_path = true if @spec @spec ||= spec_with_name(@name) super end |
Class Method Details
.options ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cocoapods-util/command/package/package.rb', line 19 def self. [ ['--force', 'Overwrite existing files.'], ['--library', 'Generate static library.'], ['--framework', 'Generate static framework.'], ['--xcframework', 'Generate static xcframework.'], ['--local', 'Use local state rather than published versions.'], ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'], ['--subspecs', 'Only include the given subspecs'], ['--spec-sources=private,https://github.com/CocoaPods/Specs.git', 'The sources to pull dependent ' \ 'pods from (defaults to https://github.com/CocoaPods/Specs.git)'], ['--exclude-sim', '排除模拟器架构,仅编译真机对应的架构。'], ['--use-modular-headers', '开启use_modular_headers!'], ['--dependency-config={}', '依赖的pod文件配置,为一个json dictionary,可以配置branch、tag、source源等。配置方式:{"PodA":{"git":"xxx","branch":"xxx"},"PodB":{"source":"xxx"}}'], ['--contains-resources', '生成的framework中是否包含bundle文件,默认不把bundle文件放到framework中。'], ['--platforms=ios,osx,watchos,tvos,all', '选择编译的平台架构,默认`all`,编译全部平台。'], ['--build-settings={}', 'xcode build_settings。{"EXCLUDED_ARCHS[sdk=iphonesimulator*]":"arm64"}'] ] end |
Instance Method Details
#run ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cocoapods-util/command/package/package.rb', line 87 def run if @spec.nil? help! 'Unable to find a podspec with path or name.' return end target_dir, work_dir = create_working_directory return if target_dir.nil? build_package `mv "#{work_dir}" "#{target_dir}"` Dir.chdir(@source_dir) end |
#validate! ⇒ Object
80 81 82 83 84 85 |
# File 'lib/cocoapods-util/command/package/package.rb', line 80 def validate! super help! 'A podspec name or path is required.' unless @spec help! '--local option can only be used when a local `.podspec` path is given.' if @local && !@is_spec_from_path help! '编译静态库.a不允许设置包含resources' if !(@framework || @xcframework) && @framework_contains_resources end |