cocoapods-imy-bin 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +541 -0
- data/lib/cocoapods-imy-bin.rb +2 -0
- data/lib/cocoapods-imy-bin/command.rb +2 -0
- data/lib/cocoapods-imy-bin/command/bin.rb +60 -0
- data/lib/cocoapods-imy-bin/command/bin/archive.rb +184 -0
- data/lib/cocoapods-imy-bin/command/bin/auto.rb +188 -0
- data/lib/cocoapods-imy-bin/command/bin/code.rb +237 -0
- data/lib/cocoapods-imy-bin/command/bin/imy.rb +46 -0
- data/lib/cocoapods-imy-bin/command/bin/init.rb +69 -0
- data/lib/cocoapods-imy-bin/command/bin/initHotKey.rb +70 -0
- data/lib/cocoapods-imy-bin/command/bin/install.rb +44 -0
- data/lib/cocoapods-imy-bin/command/bin/lib/lint.rb +69 -0
- data/lib/cocoapods-imy-bin/command/bin/local.rb +156 -0
- data/lib/cocoapods-imy-bin/command/bin/repo/update.rb +43 -0
- data/lib/cocoapods-imy-bin/command/bin/spec/create.rb +73 -0
- data/lib/cocoapods-imy-bin/command/bin/spec/push.rb +114 -0
- data/lib/cocoapods-imy-bin/command/bin/update.rb +148 -0
- data/lib/cocoapods-imy-bin/config/config.rb +137 -0
- data/lib/cocoapods-imy-bin/config/config_asker.rb +57 -0
- data/lib/cocoapods-imy-bin/config/config_builder.rb +179 -0
- data/lib/cocoapods-imy-bin/config/config_hot_key.rb +103 -0
- data/lib/cocoapods-imy-bin/config/config_hot_key_asker.rb +57 -0
- data/lib/cocoapods-imy-bin/gem_version.rb +10 -0
- data/lib/cocoapods-imy-bin/helpers.rb +4 -0
- data/lib/cocoapods-imy-bin/helpers/build_helper.rb +150 -0
- data/lib/cocoapods-imy-bin/helpers/framework.rb +62 -0
- data/lib/cocoapods-imy-bin/helpers/framework_builder.rb +307 -0
- data/lib/cocoapods-imy-bin/helpers/library.rb +54 -0
- data/lib/cocoapods-imy-bin/helpers/library_builder.rb +90 -0
- data/lib/cocoapods-imy-bin/helpers/local/loca_llibrary.rb +57 -0
- data/lib/cocoapods-imy-bin/helpers/local/local_build_helper.rb +146 -0
- data/lib/cocoapods-imy-bin/helpers/local/local_framework.rb +65 -0
- data/lib/cocoapods-imy-bin/helpers/local/local_framework_builder.rb +174 -0
- data/lib/cocoapods-imy-bin/helpers/local/local_library_builder.rb +92 -0
- data/lib/cocoapods-imy-bin/helpers/sources_helper.rb +33 -0
- data/lib/cocoapods-imy-bin/helpers/spec_creator.rb +170 -0
- data/lib/cocoapods-imy-bin/helpers/spec_files_helper.rb +77 -0
- data/lib/cocoapods-imy-bin/helpers/spec_source_creator.rb +171 -0
- data/lib/cocoapods-imy-bin/helpers/upload_helper.rb +84 -0
- data/lib/cocoapods-imy-bin/native.rb +19 -0
- data/lib/cocoapods-imy-bin/native/acknowledgements.rb +27 -0
- data/lib/cocoapods-imy-bin/native/analyzer.rb +53 -0
- data/lib/cocoapods-imy-bin/native/installation_options.rb +25 -0
- data/lib/cocoapods-imy-bin/native/installer.rb +115 -0
- data/lib/cocoapods-imy-bin/native/linter.rb +26 -0
- data/lib/cocoapods-imy-bin/native/path_source.rb +33 -0
- data/lib/cocoapods-imy-bin/native/pod_source_installer.rb +19 -0
- data/lib/cocoapods-imy-bin/native/podfile.rb +91 -0
- data/lib/cocoapods-imy-bin/native/podfile_env.rb +37 -0
- data/lib/cocoapods-imy-bin/native/podfile_generator.rb +190 -0
- data/lib/cocoapods-imy-bin/native/podspec_finder.rb +25 -0
- data/lib/cocoapods-imy-bin/native/resolver.rb +230 -0
- data/lib/cocoapods-imy-bin/native/sandbox_analyzer.rb +34 -0
- data/lib/cocoapods-imy-bin/native/source.rb +35 -0
- data/lib/cocoapods-imy-bin/native/sources_manager.rb +20 -0
- data/lib/cocoapods-imy-bin/native/specification.rb +31 -0
- data/lib/cocoapods-imy-bin/native/validator.rb +77 -0
- data/lib/cocoapods-imy-bin/source_provider_hook.rb +54 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +180 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'cocoapods-imy-bin/config/config'
|
3
|
+
|
4
|
+
module CBin
|
5
|
+
class Config
|
6
|
+
class Asker
|
7
|
+
def show_prompt
|
8
|
+
print ' > '.green
|
9
|
+
end
|
10
|
+
|
11
|
+
def ask_with_answer(question, pre_answer, selection)
|
12
|
+
print "\n#{question}\n"
|
13
|
+
|
14
|
+
print_selection_info = lambda {
|
15
|
+
print "可选值:[ #{selection.join(' / ')} ]\n" if selection
|
16
|
+
}
|
17
|
+
print_selection_info.call
|
18
|
+
print "旧值:#{pre_answer}\n" unless pre_answer.nil?
|
19
|
+
|
20
|
+
answer = ''
|
21
|
+
loop do
|
22
|
+
show_prompt
|
23
|
+
answer = STDIN.gets.chomp.strip
|
24
|
+
|
25
|
+
if answer == '' && !pre_answer.nil?
|
26
|
+
answer = pre_answer
|
27
|
+
print answer.yellow
|
28
|
+
print "\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
next if answer.empty?
|
32
|
+
break if !selection || selection.include?(answer)
|
33
|
+
|
34
|
+
print_selection_info.call
|
35
|
+
end
|
36
|
+
|
37
|
+
answer
|
38
|
+
end
|
39
|
+
|
40
|
+
def wellcome_message
|
41
|
+
print <<~EOF
|
42
|
+
|
43
|
+
开始设置二进制化初始信息.
|
44
|
+
所有的信息都会保存在 #{CBin.config.config_file} 文件中.
|
45
|
+
%w[bin_dev.yml bin_debug_iphoneos.yml bin_release_iphoneos.yml]
|
46
|
+
你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
|
47
|
+
|
48
|
+
#{CBin.config.default_config.to_yaml}
|
49
|
+
EOF
|
50
|
+
end
|
51
|
+
|
52
|
+
def done_message
|
53
|
+
print "\n设置完成.\n".green
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module CBin
|
4
|
+
class Config
|
5
|
+
class Builder
|
6
|
+
|
7
|
+
include Pod
|
8
|
+
|
9
|
+
def self.instance
|
10
|
+
@instance ||= new
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
load_build_config
|
15
|
+
end
|
16
|
+
|
17
|
+
# 加载配置项
|
18
|
+
def load_build_config
|
19
|
+
@white_pod_list = []
|
20
|
+
@ignore_git_list = []
|
21
|
+
project_root = Pod::Config.instance.project_root
|
22
|
+
path = File.join(project_root.to_s, 'BinArchive.json')
|
23
|
+
|
24
|
+
if File.exist?(path)
|
25
|
+
config = JSON.parse(File.read(path))
|
26
|
+
@white_pod_list = config['archive-white-pod-list']
|
27
|
+
UI.warn "====== archive-white-pod-list = #{@white_pod_list}" if @white_pod_list
|
28
|
+
@ignore_git_list = config['ignore-git-list']
|
29
|
+
UI.warn "====== ignore_git_list = #{@ignore_git_list}" if @ignore_git_list
|
30
|
+
@ignore_http_list = config['ignore-http-list']
|
31
|
+
|
32
|
+
@xcode_build_name = config['xcode_build_path']
|
33
|
+
@root_dir = config['root_dir'] unless config['root_dir'].nil?
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
# 制作二进制打包 工程目录
|
39
|
+
def gen_name
|
40
|
+
'bin-archive'
|
41
|
+
end
|
42
|
+
|
43
|
+
# 制作二进制打包 工程目录
|
44
|
+
def gen_dir
|
45
|
+
@gen_dir ||= begin
|
46
|
+
dir = File.join(root_dir,gen_name)
|
47
|
+
Dir.mkdir(dir) unless File.exist?dir
|
48
|
+
Pathname.new(dir)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def framework_name(spec)
|
53
|
+
"#{spec.name}.framework"
|
54
|
+
end
|
55
|
+
|
56
|
+
def framework_file(spec)
|
57
|
+
File.join(zip_dir_name, framework_name(spec))
|
58
|
+
end
|
59
|
+
|
60
|
+
def library_name(spec)
|
61
|
+
library_name_version(spec.name, spec.version)
|
62
|
+
end
|
63
|
+
|
64
|
+
def library_name_version(name,version)
|
65
|
+
"bin_#{name}_#{version}"
|
66
|
+
end
|
67
|
+
def library_file(spec)
|
68
|
+
File.join(zip_dir_name, library_name(spec))
|
69
|
+
end
|
70
|
+
|
71
|
+
def zip_dir_name
|
72
|
+
"bin-zip"
|
73
|
+
end
|
74
|
+
|
75
|
+
def zip_dir
|
76
|
+
@zip_dir ||= begin
|
77
|
+
dir = File.join(root_dir,zip_dir_name)
|
78
|
+
Dir.mkdir(dir) unless File.exist?dir
|
79
|
+
Pathname.new(dir)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
#本地
|
84
|
+
def local_spec_dir_name
|
85
|
+
"bin-spec"
|
86
|
+
end
|
87
|
+
|
88
|
+
def local_psec_dir
|
89
|
+
@local_psec_dir ||= begin
|
90
|
+
dir = File.join(root_dir,local_spec_dir_name)
|
91
|
+
Dir.mkdir(dir) unless File.exist?dir
|
92
|
+
Pathname.new(dir)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def binary_json_dir_name
|
97
|
+
"bin-json"
|
98
|
+
end
|
99
|
+
|
100
|
+
def binary_json_dir
|
101
|
+
@binary_json_dir ||= begin
|
102
|
+
dir = File.join(root_dir,binary_json_dir_name)
|
103
|
+
Dir.mkdir(dir) unless File.exist?dir
|
104
|
+
Pathname.new(dir)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
#编译target名,如 seeyou
|
111
|
+
def target_name
|
112
|
+
@target_name ||= begin
|
113
|
+
Pod::Config.instance.podfile.root_target_definitions.first.children.first.to_s.split('-').last
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
#编译缓存文件目录,如Xcodebuild的编译缓存目录
|
118
|
+
# 如果有配置, 配置完整路径,会使用
|
119
|
+
def xcode_build_name
|
120
|
+
@xcode_build_name ||= begin
|
121
|
+
project_root = Pod::Config.instance.project_root
|
122
|
+
path = File.join(project_root.to_s, 'BinArchive.json')
|
123
|
+
|
124
|
+
if File.exist?(path)
|
125
|
+
config = JSON.parse(File.read(path))
|
126
|
+
@xcode_build_name = config['xcode_build_path']
|
127
|
+
end
|
128
|
+
#默认值,在美柚上使用默认
|
129
|
+
if @xcode_build_name.nil? || Dir.exist?(@xcode_build_name)
|
130
|
+
@xcode_build_name = "xcode-build/Build/Intermediates.noindex/ArchiveIntermediates/#{target_name}/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/"
|
131
|
+
end
|
132
|
+
@xcode_build_name
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
#完整的xcodebuild 输出路径
|
138
|
+
def xcode_build_dir
|
139
|
+
@xcode_build_dir ||= begin
|
140
|
+
temp_xcode_build_name = xcode_build_name
|
141
|
+
if File.exist?(temp_xcode_build_name)
|
142
|
+
Pathname.new(temp_xcode_build_name)
|
143
|
+
else
|
144
|
+
dir = File.join(root_dir,xcode_build_name)
|
145
|
+
Pathname.new(dir)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
#处理编译产物后存储根目录,会存放spec、 json、zip的父目录,默认是工程的同级目录下,"#{basename}-build-temp"
|
153
|
+
def root_dir
|
154
|
+
@root_dir ||= begin
|
155
|
+
basename = File.basename(Pod::Config.instance.installation_root)
|
156
|
+
parent_dir = File.dirname(Pod::Config.instance.installation_root)
|
157
|
+
root_name = File.join(parent_dir,"#{basename}-build-temp")
|
158
|
+
Dir.mkdir(root_name) unless File.exist?root_name
|
159
|
+
Pathname.new(root_name)
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
#制作二进制 白名单
|
165
|
+
def white_pod_list
|
166
|
+
@white_pod_list
|
167
|
+
end
|
168
|
+
#忽略制作二进制组件的 git
|
169
|
+
def ignore_git_list
|
170
|
+
@ignore_git_list
|
171
|
+
end
|
172
|
+
|
173
|
+
def ignore_http_list
|
174
|
+
@ignore_http_list
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'cocoapods-imy-bin/native/podfile'
|
3
|
+
require 'cocoapods-imy-bin/native/podfile_env'
|
4
|
+
require 'cocoapods/generate'
|
5
|
+
|
6
|
+
module CBin
|
7
|
+
class Config_Hot_Key
|
8
|
+
|
9
|
+
def config_file
|
10
|
+
config_file_with_hot_key_index(hot_key_index)
|
11
|
+
end
|
12
|
+
|
13
|
+
def template_hash
|
14
|
+
{
|
15
|
+
'hot_key_index' => { description: '快捷键', default: '1', selection: %w[1 2 3...] },
|
16
|
+
'hot_key_dir' => { description: '快捷键执行目录', default: '' },
|
17
|
+
'hot_key_cmd' => { description: '快捷键执行命令', default: 'pod bin update --no-repo-update' }
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def config_file_with_hot_key_index(hot_key_index)
|
22
|
+
file = config_file_whith_hot_key_index(hot_key_index)
|
23
|
+
raise "\n===== #{hot_key_index} 参数有误,请检查%w[1 2 3...]===" unless (hot_key_index.to_i).is_a?(Integer)
|
24
|
+
File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
|
25
|
+
end
|
26
|
+
|
27
|
+
def hot_key_index
|
28
|
+
@hot_key_index = 1 if @hot_key_index.is_a?(NilClass)
|
29
|
+
@hot_key_index
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_hot_key_index(hot_key_index)
|
33
|
+
@hot_key_index = hot_key_index
|
34
|
+
end
|
35
|
+
|
36
|
+
def config_file_whith_hot_key_index(hot_key_index)
|
37
|
+
"hot_key_#{hot_key_index}.yml"
|
38
|
+
end
|
39
|
+
|
40
|
+
def sync_config(config)
|
41
|
+
File.open(config_file_with_hot_key_index(config['hot_key_index']), 'w+') do |f|
|
42
|
+
f.write(config.to_yaml)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def default_config
|
47
|
+
@default_config ||= Hash[template_hash.map { |k, v| [k, v[:default]] }]
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def load_config
|
53
|
+
file = config_file
|
54
|
+
if (!file.nil?) && File.exist?(config_file)
|
55
|
+
YAML.load_file(config_file)
|
56
|
+
else
|
57
|
+
default_config
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def config
|
62
|
+
@config ||= begin
|
63
|
+
puts "====== cocoapods-imy-bin #{CBin::VERSION} 版本 ======== \n"
|
64
|
+
@config = OpenStruct.new load_config
|
65
|
+
validate!
|
66
|
+
@config
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def validate!
|
71
|
+
template_hash.each do |k, v|
|
72
|
+
selection = v[:selection]
|
73
|
+
next if !selection || selection.empty?
|
74
|
+
|
75
|
+
config_value = @config.send(k)
|
76
|
+
next unless config_value
|
77
|
+
unless selection.include?(config_value)
|
78
|
+
raise Pod::Informative, "#{k} 字段的值必须限定在可选值 [ #{selection.join(' / ')} ] 内".red
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def respond_to_missing?(method, include_private = false)
|
84
|
+
config.respond_to?(method) || super
|
85
|
+
end
|
86
|
+
|
87
|
+
def method_missing(method, *args, &block)
|
88
|
+
if config.respond_to?(method)
|
89
|
+
config.send(method, *args)
|
90
|
+
elsif template_hash.keys.include?(method.to_s)
|
91
|
+
raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
|
92
|
+
else
|
93
|
+
super
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.config_hot_key
|
99
|
+
@config_hot_key ||= Config_Hot_Key.new
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'cocoapods-imy-bin/config/config_hot_key'
|
3
|
+
|
4
|
+
module CBin
|
5
|
+
class Config_Hot_Key
|
6
|
+
class Asker
|
7
|
+
def show_prompt
|
8
|
+
print ' > '.green
|
9
|
+
end
|
10
|
+
|
11
|
+
def ask_with_answer(question, pre_answer, selection)
|
12
|
+
print "\n#{question}\n"
|
13
|
+
|
14
|
+
print_selection_info = lambda {
|
15
|
+
print "可选值:[ #{selection.join(' / ')} ]\n" if selection
|
16
|
+
}
|
17
|
+
print_selection_info.call
|
18
|
+
print "旧值:#{pre_answer}\n" unless pre_answer.nil?
|
19
|
+
|
20
|
+
answer = ''
|
21
|
+
loop do
|
22
|
+
show_prompt
|
23
|
+
answer = STDIN.gets.chomp.strip
|
24
|
+
|
25
|
+
if answer == '' && !pre_answer.nil?
|
26
|
+
answer = pre_answer
|
27
|
+
print answer.yellow
|
28
|
+
print "\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
next if answer.empty?
|
32
|
+
break if !selection || selection.include?(answer)
|
33
|
+
|
34
|
+
print_selection_info.call
|
35
|
+
end
|
36
|
+
|
37
|
+
answer
|
38
|
+
end
|
39
|
+
|
40
|
+
def wellcome_message
|
41
|
+
print <<~EOF
|
42
|
+
|
43
|
+
开始设置快捷键 pod bin imy.
|
44
|
+
所有的信息都会保存在 #{CBin.config_hot_key.config_file} 文件中.
|
45
|
+
%w[hot_key.yaml]
|
46
|
+
你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
|
47
|
+
|
48
|
+
#{CBin.config_hot_key.default_config.to_yaml}
|
49
|
+
EOF
|
50
|
+
end
|
51
|
+
|
52
|
+
def done_message
|
53
|
+
print "\n设置完成.\n".green
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# copy from https://github.com/CocoaPods/cocoapods-packager
|
2
|
+
|
3
|
+
require 'cocoapods-imy-bin/native/podfile'
|
4
|
+
require 'cocoapods/command/gen'
|
5
|
+
require 'cocoapods/generate'
|
6
|
+
require 'cocoapods-imy-bin/helpers/framework_builder'
|
7
|
+
require 'cocoapods-imy-bin/helpers/library_builder'
|
8
|
+
require 'cocoapods-imy-bin/config/config_builder'
|
9
|
+
|
10
|
+
module CBin
|
11
|
+
class Build
|
12
|
+
class Helper
|
13
|
+
include Pod
|
14
|
+
#class var
|
15
|
+
@@build_defines = ""
|
16
|
+
#Debug下还待完成
|
17
|
+
def initialize(spec,
|
18
|
+
platform,
|
19
|
+
framework_output,
|
20
|
+
zip,
|
21
|
+
rootSpec,
|
22
|
+
skip_archive = false,
|
23
|
+
build_model="Release")
|
24
|
+
@spec = spec
|
25
|
+
@platform = platform
|
26
|
+
@build_model = build_model
|
27
|
+
@rootSpec = rootSpec
|
28
|
+
@isRootSpec = rootSpec.name == spec.name
|
29
|
+
@skip_archive = skip_archive
|
30
|
+
@framework_output = framework_output
|
31
|
+
@zip = zip
|
32
|
+
|
33
|
+
@framework_path
|
34
|
+
end
|
35
|
+
|
36
|
+
def build
|
37
|
+
UI.section("Building static framework #{@spec}") do
|
38
|
+
|
39
|
+
build_static_framework
|
40
|
+
unless @skip_archive
|
41
|
+
build_static_library
|
42
|
+
zip_static_framework if @zip &&= @framework_output
|
43
|
+
zip_static_library
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_static_framework
|
51
|
+
source_dir = Dir.pwd
|
52
|
+
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
53
|
+
Dir.chdir(workspace_directory) do
|
54
|
+
builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir,@isRootSpec)
|
55
|
+
@@build_defines = builder.build if @isRootSpec
|
56
|
+
begin
|
57
|
+
@framework_path = builder.lipo_build(@@build_defines) unless @skip_archive
|
58
|
+
rescue
|
59
|
+
@skip_archive = true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def build_static_library
|
65
|
+
source_dir = zip_dir
|
66
|
+
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
67
|
+
Dir.chdir(workspace_directory) do
|
68
|
+
builder = CBin::Library::Builder.new(@spec, file_accessor, @platform, source_dir,@framework_path)
|
69
|
+
builder.build
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def zip_static_framework
|
74
|
+
Dir.chdir(zip_dir) do
|
75
|
+
output_name = "#{framework_name}.zip"
|
76
|
+
unless File.exist?(framework_name)
|
77
|
+
raise Informative, "没有需要压缩的 framework 文件:#{framework_name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
UI.puts "Compressing #{framework_name} into #{output_name}"
|
81
|
+
`zip --symlinks -r #{output_name} #{framework_name}`
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def zip_static_library
|
87
|
+
Dir.chdir(zip_dir) do
|
88
|
+
output_library = "#{library_name}.zip"
|
89
|
+
unless File.exist?(library_name)
|
90
|
+
raise Informative, "没有需要压缩的 library 文件:#{library_name}"
|
91
|
+
end
|
92
|
+
|
93
|
+
UI.puts "Compressing #{library_name} into #{output_library}"
|
94
|
+
|
95
|
+
`zip --symlinks -r #{output_library} #{library_name}`
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
def clean_workspace
|
102
|
+
UI.puts 'Cleaning workspace'
|
103
|
+
|
104
|
+
FileUtils.rm_rf(gen_name)
|
105
|
+
Dir.chdir(zip_dir) do
|
106
|
+
FileUtils.rm_rf(framework_name) if @zip
|
107
|
+
FileUtils.rm_rf(library_name)
|
108
|
+
FileUtils.rm_rf(framework_name) unless @framework_output
|
109
|
+
FileUtils.rm_rf("#{framework_name}.zip") unless @framework_output
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def framework_name
|
114
|
+
CBin::Config::Builder.instance.framework_name(@spec)
|
115
|
+
end
|
116
|
+
|
117
|
+
def library_name
|
118
|
+
CBin::Config::Builder.instance.library_name(@spec)
|
119
|
+
end
|
120
|
+
|
121
|
+
def workspace_directory
|
122
|
+
File.expand_path("#{gen_name}/#{@rootSpec.name}")
|
123
|
+
end
|
124
|
+
|
125
|
+
def zip_dir
|
126
|
+
CBin::Config::Builder.instance.zip_dir
|
127
|
+
end
|
128
|
+
|
129
|
+
def gen_name
|
130
|
+
CBin::Config::Builder.instance.gen_dir
|
131
|
+
end
|
132
|
+
|
133
|
+
def spec_file
|
134
|
+
@spec_file ||= begin
|
135
|
+
if @podspec
|
136
|
+
find_spec_file(@podspec)
|
137
|
+
else
|
138
|
+
if code_spec_files.empty?
|
139
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
140
|
+
end
|
141
|
+
|
142
|
+
spec_file = code_spec_files.first
|
143
|
+
spec_file
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|