Class: Pod::Command::Swordfish::Archive
Constant Summary
collapse
- @@missing_binary_specs =
[]
Class Method Summary
collapse
Instance Method Summary
collapse
#validate!
#binary_spec, #binary_spec_files, #binary_template_spec, #binary_template_spec_file, #binary_template_spec_files, #clear_binary_spec_file_if_needed, #code_spec, #code_spec_files, #create_binary_spec_file, #find_spec_file, #spec_files
#binary_source, #code_source, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(argv) ⇒ Archive
Returns a new instance of Archive.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/swordfish/command/archive.rb', line 36
def initialize(argv)
@env = argv.option('env') || 'dev'
Ocean.config.set_configuration_env(@env)
UI.warn "====== cocoapods-swordfish #{Ocean::VERSION} 版本 ======== "
UI.warn "====== #{@env} 环境 ======== "
@code_dependencies = argv.flag?('code-dependencies')
@framework_output = argv.flag?('framework-output', false )
@all_make = argv.flag?('all-make', false )
@sources = argv.option('sources') || []
@platform = Platform.new(:ios)
@config = argv.option('configuration', 'Release')
super
@additional_args = argv.remainder!
@build_finshed = false
end
|
Class Method Details
.missing_binary_specs(missing_binary_specs) ⇒ Object
138
139
140
|
# File 'lib/swordfish/command/archive.rb', line 138
def self.missing_binary_specs(missing_binary_specs)
@@missing_binary_specs = missing_binary_specs unless @build_finshed
end
|
.options ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/swordfish/command/archive.rb', line 22
def self.options
[
['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
['--sources', '私有源地址,多个用分号区分'],
['--framework-output', '输出framework文件'],
['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
].concat(Pod::Command::Gen.options).concat(super).uniq
end
|
Instance Method Details
#build_dependencies ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/swordfish/command/archive.rb', line 86
def build_dependencies
@build_finshed = true
source_specs = []
@@missing_binary_specs.uniq.each do |spec|
next if spec.name.include?('/')
next if spec.name == @spec.name
next if Ocean::Config::Builder.instance.white_pod_list.include?(spec.name)
UI.warn "#{spec.name}.podspec 带有 vendored_frameworks 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_frameworks']
next if spec.attributes_hash['vendored_frameworks'] && @spec.name != spec.name next if spec.attributes_hash['ios.vendored_frameworks'] && @spec.name != spec.name source_specs << spec
end
fail_build_specs = []
source_specs.uniq.each do |spec|
begin
builder = Ocean::Build::Helper.new(spec,
@platform,
@framework_output,
@zip,
@spec,
false ,
@config)
builder.build
rescue Object => exception
UI.puts exception
fail_build_specs << spec
end
end
if fail_build_specs.any?
fail_build_specs.uniq.each do |spec|
UI.warn "【#{spec.name} | #{spec.version}】组件二进制版本编译失败 ."
end
end
source_specs - fail_build_specs
end
|
#build_root_spec ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/swordfish/command/archive.rb', line 70
def build_root_spec
source_specs = []
builder = Ocean::Build::Helper.new(@spec,
@platform,
@framework_output,
@zip,
@spec,
Ocean::Config::Builder.instance.white_pod_list.include?(@spec.name),
@config)
builder.build
builder.clean_workspace if @clean && !@all_make
source_specs << @spec unless Ocean::Config::Builder.instance.white_pod_list.include?(@spec.name)
source_specs
end
|
#run ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/swordfish/command/archive.rb', line 55
def run
zip_dir = Ocean::Config::Builder.instance.zip_dir
FileUtils.rm_rf(zip_dir) if File.exist?(zip_dir)
@spec = Specification.from_file(spec_file)
generate_project
source_specs = []
source_specs.concat(build_root_spec)
source_specs.concat(build_dependencies) if @all_make
source_specs
end
|