Class: Pod::Command::Bin::Local
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) ⇒ Local
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/cocoapods-tj/command/bin/local.rb', line 30
def initialize(argv)
@env = argv.option('env') || 'dev'
CBin.config.set_configuration_env(@env)
@make_binary_specs = argv.option('make-binary-specs') || []
@framework_output = argv.flag?('framework-output', false)
@clean = argv.flag?('no-clean', true)
@zip = argv.flag?('zip', true)
@sources = argv.option('sources') || []
@platform = Platform.new(:ios)
@target_name = CBin::Config::Builder.instance.target_name
@local_build_dir_name = CBin::Config::Builder.instance.xcode_build_name
@local_build_dir = CBin::Config::Builder.instance.xcode_build_dir
@framework_path
super
end
|
Class Method Details
.options ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/cocoapods-tj/command/bin/local.rb', line 20
def self.options
[
['--no-clean', '保留构建中间产物'],
['--framework-output', '输出framework文件'],
['--no-zip', '不压缩静态 framework 为 zip'],
['--make-binary-specs', '需要制作spec集合'],
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
].concat(Pod::Command::Gen.options).concat(super).uniq
end
|
Instance Method Details
#build(make_binary_specs) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
|
# File 'lib/cocoapods-tj/command/bin/local.rb', line 65
def build(make_binary_specs)
sources_sepc = []
make_binary_specs.uniq.each do |spec|
next if spec.name.include?('/')
next if spec.name == @target_name
next if CBin::Config::Builder.instance.white_pod_list.include?(spec.name)
if spec.source[:git] && spec.source[:git]
spec_git = spec.source[:git]
spec_git_res = false
CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
spec_git_res = spec_git.include?(ignore_git)
break if spec_git_res
end
next if spec_git_res
end
UI.warn "#{spec.name}.podspec 带有 vendored_frameworks 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_frameworks']
next if spec.attributes_hash['vendored_frameworks'] && @target_name != spec.name next if (spec.attributes_hash['ios'] && spec.attributes_hash['ios']['vendored_frameworks'])
next unless library_exist(spec)
sources_sepc << spec
end
fail_build_specs = []
sources_sepc.uniq.each do |spec|
begin
builder = CBin::LocalBuild::Helper.new(spec,
@platform,
@framework_output,
@zip,
@clean,
@target_name,
@local_build_dir_name,
@local_build_dir)
builder.build
CBin::Upload::Helper.new(spec, @code_dependencies, @sources).upload
rescue StandardError
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
success_specs = sources_sepc - fail_build_specs
if success_specs.any?
success_specs.uniq.each do |spec|
UI.warn " =======【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!!"
end
end
UI.section("\nUpdating Spec Repositories\n".yellow) do
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
end
end
|
#run ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/cocoapods-tj/command/bin/local.rb', line 50
def run
sources_spec = []
Dir.chdir(CBin::Config::Builder.instance.local_psec_dir) do
spec_files = Dir.glob(%w[*.json *.podspec])
spec_files.each do |file|
spec = Pod::Specification.from_file(file)
sources_spec << spec
end
end
build(sources_spec)
end
|