cocoapods-mtxx-bin 0.0.4 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocoapods-mtxx-bin/command/bin/buildAll.rb +48 -42
- data/lib/cocoapods-mtxx-bin/command/bin/init.rb +1 -1
- data/lib/cocoapods-mtxx-bin/command/bin/outputSource.rb +141 -0
- data/lib/cocoapods-mtxx-bin/command/bin/upload.rb +173 -0
- data/lib/cocoapods-mtxx-bin/command/bin.rb +3 -1
- data/lib/cocoapods-mtxx-bin/config/config.rb +16 -6
- data/lib/cocoapods-mtxx-bin/config/config_asker.rb +3 -3
- data/lib/cocoapods-mtxx-bin/gem_version.rb +1 -1
- data/lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb +2 -0
- data/lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb +7 -3
- data/lib/cocoapods-mtxx-bin/native/resolver.rb +3 -9
- data/lib/cocoapods-mtxx-bin/source_provider_hook.rb +2 -1
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c25aad1e1bb13ef8c88e50faf60801931532128a902ab72d40415c6f74809f
|
4
|
+
data.tar.gz: 59e39e2c15ea57d12940f89dc13760155a663aeb22ed7077bb6bcc8e0d4c7e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f9e5f92d9a260f67fe3f94ecd695314fcb523defdb9d407a5398be6984c2d1d672cc7a54e47c0d031ee158d91075c8da5a6cc27a9d53c1588fc1cc5a6f639d
|
7
|
+
data.tar.gz: 3c678a0494d56ac065707adb58470f33ac94590087b9b2957fd901e23dfd1bcd589214ef42ce5df285ed2511d11af1481202f211faffa4628ac5a39f5a42a072
|
@@ -2,6 +2,7 @@ require 'cocoapods-mtxx-bin/helpers/buildAll/builder'
|
|
2
2
|
require 'cocoapods-mtxx-bin/helpers/buildAll/podspec_util'
|
3
3
|
require 'cocoapods-mtxx-bin/helpers/buildAll/zip_file_helper'
|
4
4
|
require 'cocoapods-mtxx-bin/helpers/buildAll/bin_helper'
|
5
|
+
require 'cocoapods-mtxx-bin/config/config'
|
5
6
|
require 'yaml'
|
6
7
|
require 'digest'
|
7
8
|
|
@@ -18,7 +19,7 @@ module Pod
|
|
18
19
|
|
19
20
|
self.summary = '根据壳工程打包所有依赖组件为静态库(static framework)'
|
20
21
|
self.description = <<-DESC
|
21
|
-
#{
|
22
|
+
#{summary}
|
22
23
|
DESC
|
23
24
|
|
24
25
|
def self.options
|
@@ -30,9 +31,9 @@ module Pod
|
|
30
31
|
end
|
31
32
|
|
32
33
|
def initialize(argv)
|
33
|
-
@clean = argv.flag?('clean', false
|
34
|
-
@repo_update = argv.flag?('repo-update', false
|
35
|
-
@full_build = argv.flag?('full-build', false
|
34
|
+
@clean = argv.flag?('clean', false)
|
35
|
+
@repo_update = argv.flag?('repo-update', false)
|
36
|
+
@full_build = argv.flag?('full-build', false)
|
36
37
|
@base_dir = "#{Pathname.pwd}/build_pods"
|
37
38
|
super
|
38
39
|
end
|
@@ -70,10 +71,10 @@ module Pod
|
|
70
71
|
|
71
72
|
# 读取配置文件
|
72
73
|
def read_config
|
73
|
-
UI.title
|
74
|
-
config_file = File.join(
|
74
|
+
UI.title 'Read config from file `BinConfig.yaml`'.green do
|
75
|
+
config_file = File.join(CBin.config.binary_dir, 'BinConfig.yaml')
|
75
76
|
return unless File.exist?(config_file)
|
76
|
-
config = YAML.
|
77
|
+
config = YAML.safe_load(File.open(config_file))
|
77
78
|
return if config.nil?
|
78
79
|
build_config = config['build_config']
|
79
80
|
return if build_config.nil?
|
@@ -86,38 +87,44 @@ module Pod
|
|
86
87
|
|
87
88
|
# 更新repo仓库
|
88
89
|
def repo_update
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
90
|
+
if @repo_update
|
91
|
+
UI.title 'Repo update'.green do
|
92
|
+
return if podfile.nil?
|
93
|
+
sources_manager = Pod::Config.instance.sources_manager
|
94
|
+
podfile.sources.uniq.map do |src|
|
95
|
+
# next if src.include?(CDN) || src.include?(MASTER_HTTP) || src.include?(MASTER_SSH)
|
96
|
+
next unless src.include?(MT_REPO)
|
97
|
+
UI.message "Update repo: #{src}"
|
98
|
+
source = sources_manager.source_with_name_or_url(src)
|
99
|
+
source.update(false)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
100
103
|
end
|
101
104
|
|
102
105
|
# 执行pre build
|
103
106
|
def pre_build
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
+
if @pre_build
|
108
|
+
UI.title 'Execute the command of pre build'.green do
|
109
|
+
system(@pre_build)
|
110
|
+
end
|
111
|
+
end
|
107
112
|
end
|
108
113
|
|
109
114
|
# 执行post build
|
110
|
-
def post_build(
|
111
|
-
|
112
|
-
|
113
|
-
|
115
|
+
def post_build(_results)
|
116
|
+
if @post_build
|
117
|
+
UI.title 'Execute the command of post build'.green do
|
118
|
+
system(@post_build)
|
119
|
+
end
|
120
|
+
end
|
114
121
|
end
|
115
122
|
|
116
123
|
# 获取 podfile
|
117
124
|
def podfile
|
118
125
|
@podfile ||= begin
|
119
|
-
podfile_path = File.join(Pathname.pwd,
|
120
|
-
raise
|
126
|
+
podfile_path = File.join(Pathname.pwd, 'Podfile')
|
127
|
+
raise 'Podfile不存在' unless File.exist?(podfile_path)
|
121
128
|
sources_manager = Pod::Config.instance.sources_manager
|
122
129
|
podfile = Podfile.from_file(Pathname.new(podfile_path))
|
123
130
|
podfile_hash = podfile.to_hash
|
@@ -131,8 +138,8 @@ module Pod
|
|
131
138
|
# 获取 podfile.lock
|
132
139
|
def lockfile
|
133
140
|
@lockfile ||= begin
|
134
|
-
lock_path = File.join(Pathname.pwd,
|
135
|
-
raise
|
141
|
+
lock_path = File.join(Pathname.pwd, 'Podfile.lock')
|
142
|
+
raise 'Podfile.lock不存在,请执行pod install' unless File.exist?(lock_path)
|
136
143
|
Lockfile.from_file(Pathname.new(lock_path))
|
137
144
|
end
|
138
145
|
end
|
@@ -140,30 +147,30 @@ module Pod
|
|
140
147
|
# 获取 sandbox
|
141
148
|
def sandbox
|
142
149
|
@sandbox ||= begin
|
143
|
-
sandbox_path = File.join(Pathname.pwd,
|
144
|
-
raise
|
150
|
+
sandbox_path = File.join(Pathname.pwd, 'Pods')
|
151
|
+
raise 'Pods文件夹不存在,请执行pod install' unless File.exist?(sandbox_path)
|
145
152
|
Pod::Sandbox.new(sandbox_path)
|
146
153
|
end
|
147
154
|
end
|
148
155
|
|
149
156
|
# 根据podfile和podfile.lock分析依赖
|
150
157
|
def analyse
|
151
|
-
UI.title
|
158
|
+
UI.title 'Analyze dependencies'.green do
|
152
159
|
analyzer = Pod::Installer::Analyzer.new(
|
153
160
|
sandbox,
|
154
161
|
podfile,
|
155
162
|
lockfile
|
156
163
|
)
|
157
|
-
analyzer.analyze(true
|
164
|
+
analyzer.analyze(true)
|
158
165
|
end
|
159
166
|
end
|
160
167
|
|
161
168
|
# 删除编译产物
|
162
169
|
def clean_build_pods
|
163
|
-
UI.title
|
164
|
-
build_path = Dir.pwd +
|
170
|
+
UI.title 'Clean build pods'.green do
|
171
|
+
build_path = Dir.pwd + '/build'
|
165
172
|
FileUtils.rm_rf(build_path) if File.exist?(build_path)
|
166
|
-
build_pods_path = Dir.pwd +
|
173
|
+
build_pods_path = Dir.pwd + '/build_pods'
|
167
174
|
FileUtils.rm_rf(build_pods_path) if File.exist?(build_pods_path)
|
168
175
|
end
|
169
176
|
end
|
@@ -268,14 +275,14 @@ module Pod
|
|
268
275
|
|
269
276
|
# 展示结果
|
270
277
|
def show_results(results)
|
271
|
-
UI.title
|
272
|
-
UI.info
|
273
|
-
UI.info "|#{
|
274
|
-
UI.info
|
278
|
+
UI.title '打包结果:'.green do
|
279
|
+
UI.info '——————————————————————————————————'.green
|
280
|
+
UI.info "|#{'Type'.center(20)}|#{'Count'.center(11)}|".green
|
281
|
+
UI.info '——————————————————————————————————'.green
|
275
282
|
results.each do |key, value|
|
276
283
|
UI.info "|#{key.center(20)}|#{value.size.to_s.center(11)}|".green
|
277
284
|
end
|
278
|
-
UI.info
|
285
|
+
UI.info '——————————————————————————————————'.green
|
279
286
|
|
280
287
|
# 打印出失败的 target
|
281
288
|
unless results['Fail'].empty?
|
@@ -303,7 +310,6 @@ module Pod
|
|
303
310
|
end
|
304
311
|
result
|
305
312
|
end
|
306
|
-
|
307
313
|
end
|
308
314
|
end
|
309
315
|
end
|
@@ -11,7 +11,7 @@ module Pod
|
|
11
11
|
|
12
12
|
def self.options
|
13
13
|
[
|
14
|
-
[
|
14
|
+
%w[--bin-url=URL 配置文件地址,直接从此地址下载配置文件],
|
15
15
|
['--update-sources', '更新源码私有源配置 bin_dev.yml 中的 code_repo_url_list 配置,支持多私有源,多个私有源用分号区分 example:git@techgit.meitu.com:iMeituPic/mtsourcespecs.git;git@techgit.meitu.com:iosmodules/specs.git;https://github.com/CocoaPods/Specs.git']
|
16
16
|
].concat(super)
|
17
17
|
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'cocoapods-mtxx-bin/helpers/buildAll/builder'
|
2
|
+
require 'cocoapods-mtxx-bin/helpers/buildAll/podspec_util'
|
3
|
+
require 'cocoapods-mtxx-bin/helpers/buildAll/zip_file_helper'
|
4
|
+
require 'cocoapods-mtxx-bin/helpers/buildAll/bin_helper'
|
5
|
+
require 'cocoapods-mtxx-bin/config/config'
|
6
|
+
require 'yaml'
|
7
|
+
require 'digest'
|
8
|
+
|
9
|
+
module Pod
|
10
|
+
class Command
|
11
|
+
class Bin < Command
|
12
|
+
class OutputSource < Bin
|
13
|
+
self.summary = '输出各个组件的source源,默认输出全部组件的source'
|
14
|
+
self.description = <<-DESC
|
15
|
+
#{summary}
|
16
|
+
DESC
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
%w[--error-source 过滤异常的source,比如http的,CI打包只支持SSH认证]
|
21
|
+
].concat(super).uniq
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(argv)
|
25
|
+
@error_source = argv.flag?('error-source', false)
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
# 开始时间
|
31
|
+
@start_time = Time.now.to_i
|
32
|
+
# 更新repo仓库
|
33
|
+
repo_update
|
34
|
+
# 分析依赖
|
35
|
+
@analyze_result = analyse
|
36
|
+
# 打印source
|
37
|
+
show_cost_source
|
38
|
+
# 计算耗时
|
39
|
+
show_cost_time
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# 打印source
|
45
|
+
def show_cost_source
|
46
|
+
all_source_list = []
|
47
|
+
error_source_list = []
|
48
|
+
@analyze_result.specifications.each do |specification|
|
49
|
+
next if specification.subspec?
|
50
|
+
all_source_list << specification.source
|
51
|
+
if @error_source && verified_git_address(specification)
|
52
|
+
error_source_list << specification.name + ' ' + specification.source[:git] + + ' ' + specification.source[:tag]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
if @error_source
|
56
|
+
UI.info '问题组件,source 为http CI打包不支持http认证,应修改为ssh'.red
|
57
|
+
UI.info error_source_list.to_s.red
|
58
|
+
else
|
59
|
+
UI.info '输出所有pod组件source'.green
|
60
|
+
UI.info error_source_list.to_s.green
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# git clone 地址 是否非法
|
65
|
+
def verified_git_address(specification)
|
66
|
+
return false if specification.source[:git].nil?
|
67
|
+
git = specification.source[:git]
|
68
|
+
git.include?('http://techgit.meitu.com') || git.include?('https://techgit.meitu.com')
|
69
|
+
end
|
70
|
+
|
71
|
+
# 打印耗时
|
72
|
+
def show_cost_time
|
73
|
+
return if @start_time.nil?
|
74
|
+
UI.info "总耗时:#{Time.now.to_i - @start_time}s".green
|
75
|
+
end
|
76
|
+
|
77
|
+
# 更新repo仓库
|
78
|
+
def repo_update
|
79
|
+
if @repo_update
|
80
|
+
UI.title 'Repo update'.green do
|
81
|
+
return if podfile.nil?
|
82
|
+
sources_manager = Pod::Config.instance.sources_manager
|
83
|
+
podfile.sources.uniq.map do |src|
|
84
|
+
# next if src.include?(CDN) || src.include?(MASTER_HTTP) || src.include?(MASTER_SSH)
|
85
|
+
next unless src.include?(MT_REPO)
|
86
|
+
UI.message "Update repo: #{src}"
|
87
|
+
source = sources_manager.source_with_name_or_url(src)
|
88
|
+
source.update(false)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# 获取 podfile
|
95
|
+
def podfile
|
96
|
+
@podfile ||= begin
|
97
|
+
podfile_path = File.join(Pathname.pwd, 'Podfile')
|
98
|
+
raise 'Podfile不存在' unless File.exist?(podfile_path)
|
99
|
+
sources_manager = Pod::Config.instance.sources_manager
|
100
|
+
podfile = Podfile.from_file(Pathname.new(podfile_path))
|
101
|
+
podfile_hash = podfile.to_hash
|
102
|
+
podfile_hash['sources'] = (podfile_hash['sources'] || []).concat(sources_manager.code_source_list.map(&:url))
|
103
|
+
podfile_hash['sources'] << sources_manager.binary_source.url
|
104
|
+
podfile_hash['sources'].uniq!
|
105
|
+
Podfile.from_hash(podfile_hash)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# 获取 podfile.lock
|
110
|
+
def lockfile
|
111
|
+
@lockfile ||= begin
|
112
|
+
lock_path = File.join(Pathname.pwd, 'Podfile.lock')
|
113
|
+
raise 'Podfile.lock不存在,请执行pod install' unless File.exist?(lock_path)
|
114
|
+
Lockfile.from_file(Pathname.new(lock_path))
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# 获取 sandbox
|
119
|
+
def sandbox
|
120
|
+
@sandbox ||= begin
|
121
|
+
sandbox_path = File.join(Pathname.pwd, 'Pods')
|
122
|
+
raise 'Pods文件夹不存在,请执行pod install' unless File.exist?(sandbox_path)
|
123
|
+
Pod::Sandbox.new(sandbox_path)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# 根据podfile和podfile.lock分析依赖
|
128
|
+
def analyse
|
129
|
+
UI.title 'Analyze dependencies'.green do
|
130
|
+
analyzer = Pod::Installer::Analyzer.new(
|
131
|
+
sandbox,
|
132
|
+
podfile,
|
133
|
+
lockfile
|
134
|
+
)
|
135
|
+
analyzer.analyze(true)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Upload < Bin
|
7
|
+
include Pod
|
8
|
+
|
9
|
+
self.summary = "上传二进制文件及podspec"
|
10
|
+
self.description = <<-DESC
|
11
|
+
#{self.summary}
|
12
|
+
|
13
|
+
`NAME`: 库名【必填】\n
|
14
|
+
`VERSION`: 版本号【必填】\n
|
15
|
+
`FILE`: 需要压缩的二进制文件或目录【必填】\n
|
16
|
+
`REPO`: 上传podspec的仓库,可以通过`pod repo list`查看【必填】\n
|
17
|
+
|
18
|
+
e.g.:\n
|
19
|
+
pod bin upload Pod1 1.0.0 Pod1.framework mtxxspecs --spec=Pod1.podspec
|
20
|
+
DESC
|
21
|
+
|
22
|
+
self.arguments = [
|
23
|
+
CLAide::Argument.new('NAME', true ),
|
24
|
+
CLAide::Argument.new('VERSION', true),
|
25
|
+
CLAide::Argument.new('FILE', true),
|
26
|
+
CLAide::Argument.new('REPO', true)
|
27
|
+
]
|
28
|
+
|
29
|
+
def self.options
|
30
|
+
[
|
31
|
+
%w[--spec=SPEC 指定podspec文件路径,如果不指定,将在当前目录下查找]
|
32
|
+
].concat(super)
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(argv)
|
36
|
+
@name = argv.shift_argument
|
37
|
+
@version = argv.shift_argument
|
38
|
+
@file = argv.shift_argument
|
39
|
+
@repo = argv.shift_argument
|
40
|
+
@spec = argv.option('spec', nil)
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
44
|
+
def run
|
45
|
+
# 参数检查
|
46
|
+
argvsCheck
|
47
|
+
# 压缩文件
|
48
|
+
zip_file
|
49
|
+
# 上传文件
|
50
|
+
upload_zip_file
|
51
|
+
# 修改podspec
|
52
|
+
modify_spec
|
53
|
+
# 上传podspec
|
54
|
+
upload_spec
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
# 参数检查
|
60
|
+
def argvsCheck
|
61
|
+
raise Informative, "name不能为空" if @name.nil?
|
62
|
+
raise Informative, "version不能为空" if @version.nil?
|
63
|
+
raise Informative, "repo不能为空" if @repo.nil?
|
64
|
+
raise Informative, "未找到需要压缩的二进制文件" if @file.nil?
|
65
|
+
raise Informative, "未找到podspec文件" unless File.exist?(podspec)
|
66
|
+
end
|
67
|
+
|
68
|
+
# 压缩文件
|
69
|
+
def zip_file
|
70
|
+
UI.title "压缩二进制文件`#{zip_file_name}`".yellow do
|
71
|
+
output_zip_file = File.join(Dir.pwd, zip_file_name)
|
72
|
+
FileUtils.rm_f(output_zip_file) if File.exist?(output_zip_file)
|
73
|
+
command = "zip --symlinks -r #{zip_file_name} #{@file}"
|
74
|
+
UI.info "#{command}"
|
75
|
+
`#{command}`
|
76
|
+
raise Informative, "压缩二进制文件失败" unless File.exist?(output_zip_file)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# 压缩后的zip包名
|
81
|
+
def zip_file_name
|
82
|
+
@zip_file_name ||= begin
|
83
|
+
"#{@name}_#{@version}.zip"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# 上传文件
|
88
|
+
def upload_zip_file
|
89
|
+
UI.title "上传二进制文件`#{zip_file_name}`".yellow do
|
90
|
+
zip_file = File.join(Dir.pwd, zip_file_name)
|
91
|
+
raise Informative, "`#{@zip_file_name}`不存在" unless File.exist?(zip_file)
|
92
|
+
upload_url = CBin.config.binary_upload_url_str
|
93
|
+
command = "curl -F \"name=#{@name}\" -F \"version=#{@version}\" -F \"file=@#{zip_file}\" #{upload_url}"
|
94
|
+
UI.info "#{command}"
|
95
|
+
json = `#{command}`
|
96
|
+
UI.info json
|
97
|
+
begin
|
98
|
+
error_code = JSON.parse(json)["error_code"]
|
99
|
+
raise Informative, "`#{zip_file_name}`上传失败" unless error_code == 0
|
100
|
+
UI.info "`#{zip_file_name}`上传成功".green
|
101
|
+
rescue JSON::ParserError => e
|
102
|
+
raise Informative, "`#{zip_file_name}`上传失败\n#{e.to_s}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# 修改podspec
|
108
|
+
def modify_spec
|
109
|
+
UI.title "修改podspec:`#{podspec}`".yellow do
|
110
|
+
spec = Specification.from_file(podspec)
|
111
|
+
spec_hash = spec.to_hash
|
112
|
+
spec_hash['version'] = @version
|
113
|
+
spec_hash['source'] = source
|
114
|
+
spec = Specification.from_hash(spec_hash)
|
115
|
+
write_podspec_json(spec)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# 写入podspec
|
120
|
+
def write_podspec_json(spec)
|
121
|
+
FileUtils.rm_f(podspec_json_file) if File.exist?(podspec_json_file)
|
122
|
+
File.open(podspec_json_file, "w+") do |f|
|
123
|
+
f.write(spec.to_pretty_json)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def source
|
128
|
+
url = "#{CBin.config.binary_download_url_str}/#{@name}/#{@version}/#{zip_file_name}"
|
129
|
+
{ http: url, type: 'zip' }
|
130
|
+
end
|
131
|
+
|
132
|
+
# 上传podspec
|
133
|
+
def upload_spec
|
134
|
+
UI.title "推送podspec:`#{podspec_json_file_name}`".yellow do
|
135
|
+
raise Informative, "`#{podspec_json_file_name}`不存在" unless File.exist?(podspec_json_file)
|
136
|
+
argvs = %W[#{@repo} #{podspec_json_file} --skip-import-validation --use-libraries --allow-warnings --verbose]
|
137
|
+
|
138
|
+
begin
|
139
|
+
push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
|
140
|
+
push.validate!
|
141
|
+
push.run
|
142
|
+
rescue Pod::StandardError => e
|
143
|
+
raise Informative, "推送podspec:`#{podspec_json_file_name}失败\n#{e.to_s}"
|
144
|
+
end
|
145
|
+
# 上传完成后,清理工作目录
|
146
|
+
FileUtils.rm_f(podspec_json_file) if File.exist?(podspec_json_file)
|
147
|
+
FileUtils.rm_r('binary') if File.exist?('binary')
|
148
|
+
FileUtils.rm_f(zip_file_name) if File.exist?(zip_file_name)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def binary_dir
|
153
|
+
File.join(Dir.pwd, 'binary')
|
154
|
+
end
|
155
|
+
|
156
|
+
def podspec_json_file_name
|
157
|
+
"#{@name}.podspec.json"
|
158
|
+
end
|
159
|
+
|
160
|
+
def podspec_json_file
|
161
|
+
File.join(Dir.pwd, podspec_json_file_name)
|
162
|
+
end
|
163
|
+
|
164
|
+
def podspec
|
165
|
+
@spec ||= begin
|
166
|
+
"#{@name}.podspec"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -9,6 +9,8 @@ require 'cocoapods-mtxx-bin/command/bin/install'
|
|
9
9
|
require 'cocoapods-mtxx-bin/command/bin/repo'
|
10
10
|
require 'cocoapods-mtxx-bin/command/bin/spec'
|
11
11
|
require 'cocoapods-mtxx-bin/command/bin/buildAll'
|
12
|
+
require 'cocoapods-mtxx-bin/command/bin/outputSource'
|
13
|
+
require 'cocoapods-mtxx-bin/command/bin/upload'
|
12
14
|
require 'cocoapods-mtxx-bin/helpers'
|
13
15
|
# require 'cocoapods-mtxx-bin/native'
|
14
16
|
|
@@ -41,7 +43,7 @@ module Pod
|
|
41
43
|
self.summary = '组件二进制化插件'
|
42
44
|
self.description = <<-DESC.strip_heredoc
|
43
45
|
组件二进制化插件
|
44
|
-
|
46
|
+
|
45
47
|
利用源码私有源与二进制私有源实现对组件依赖类型的切换
|
46
48
|
DESC
|
47
49
|
|
@@ -13,12 +13,12 @@ module CBin
|
|
13
13
|
def template_hash
|
14
14
|
{
|
15
15
|
'configuration_env' => { description: '编译环境', default: 'dev', selection: %w[dev debug_iphoneos release_iphoneos] },
|
16
|
-
'code_repo_url_list' => { description: '源码私有源 Git
|
16
|
+
'code_repo_url_list' => { description: '源码私有源 Git 地址,多个私有源用分号区分', default: 'git@techgit.meitu.com:iMeituPic/mtsourcespecs.git' },
|
17
17
|
'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'git@techgit.meitu.com:iMeituPic/mtbinaryspecs.git' },
|
18
|
-
'binary_upload_url' => { description: '
|
18
|
+
'binary_upload_url' => { description: '二进制文件上传地址', default: 'http://pre.intapi.xiuxiu.meitu.com/internal/file/upload.json' },
|
19
19
|
# 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
|
20
|
-
'binary_download_url' => { description: '
|
21
|
-
'download_file_type' => { description: '
|
20
|
+
'binary_download_url' => { description: '二进制文件下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s', default: 'https://manhattan-test.obs.cn-north-4.myhuaweicloud.com:443/ios/binary' },
|
21
|
+
'download_file_type' => { description: '二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
@@ -36,12 +36,22 @@ module CBin
|
|
36
36
|
raise "===== #{configuration_env} %w[dev debug_iphoneos release_iphoneos]===="
|
37
37
|
end
|
38
38
|
|
39
|
-
File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
|
39
|
+
# File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
|
40
|
+
File.expand_path("#{binary_dir}/#{file}")
|
40
41
|
end
|
41
42
|
|
42
43
|
def config_file_with_configuration_env_list(configuration_env)
|
43
44
|
file = config_dev_file
|
44
|
-
File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
|
45
|
+
# File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
|
46
|
+
File.expand_path("#{binary_dir}/#{file}")
|
47
|
+
end
|
48
|
+
|
49
|
+
def binary_dir
|
50
|
+
@binary_dir ||= begin
|
51
|
+
binary_dir = "#{Pod::Config.instance.project_root}/binary"
|
52
|
+
FileUtils.mkdir(binary_dir) unless File.exist?(binary_dir)
|
53
|
+
binary_dir
|
54
|
+
end
|
45
55
|
end
|
46
56
|
|
47
57
|
def configuration_env
|
@@ -40,10 +40,10 @@ module CBin
|
|
40
40
|
def wellcome_message
|
41
41
|
print <<~EOF
|
42
42
|
|
43
|
-
|
43
|
+
设置插件配置信息.
|
44
44
|
所有的信息都会保存在 #{CBin.config.config_file} 文件中.
|
45
|
-
|
46
|
-
|
45
|
+
你可以在对应目录下手动添加编辑该文件.
|
46
|
+
文件包含的配置信息样式如下:
|
47
47
|
|
48
48
|
#{CBin.config.default_config.to_yaml}
|
49
49
|
EOF
|
@@ -10,6 +10,8 @@ module CBin
|
|
10
10
|
specs = specifications.map(&:name).select { |spec|
|
11
11
|
spec.include?(pod_name) && !spec.include?('/Binary')
|
12
12
|
}.sort!
|
13
|
+
xcode_version = `xcodebuild -version`.split(' ').join('')
|
14
|
+
specs << xcode_version
|
13
15
|
specs_str = specs.join('')
|
14
16
|
"#{original_version}.bin#{Digest::MD5.hexdigest(specs_str)[0,6]}"
|
15
17
|
end
|
@@ -94,12 +94,16 @@ module CBin
|
|
94
94
|
"#{@base_dir}/#{@pod_target}/Temp"
|
95
95
|
end
|
96
96
|
|
97
|
+
def configuration
|
98
|
+
"Debug"
|
99
|
+
end
|
100
|
+
|
97
101
|
def iphoneos
|
98
|
-
"
|
102
|
+
"#{configuration}-iphoneos"
|
99
103
|
end
|
100
104
|
|
101
105
|
def iphonesimulator
|
102
|
-
"
|
106
|
+
"#{configuration}-iphonesimulator"
|
103
107
|
end
|
104
108
|
|
105
109
|
# 需要排除的资源文件后缀
|
@@ -130,7 +134,7 @@ CONFIGURATION_TEMP_DIR=#{temp_dir} \
|
|
130
134
|
BUILD_ROOT=#{product_dir} \
|
131
135
|
BUILD_DIR=#{product_dir} \
|
132
136
|
clean build \
|
133
|
-
-configuration
|
137
|
+
-configuration #{configuration} \
|
134
138
|
-target #{@pod_target} \
|
135
139
|
-project #{project}
|
136
140
|
BUILD
|
@@ -8,6 +8,7 @@ require 'cocoapods-mtxx-bin/native/installation_options'
|
|
8
8
|
require 'cocoapods-mtxx-bin/gem_version'
|
9
9
|
require 'cocoapods-mtxx-bin/command/bin/archive'
|
10
10
|
require 'cocoapods-mtxx-bin/helpers/buildAll/bin_helper'
|
11
|
+
require 'cocoapods-mtxx-bin/config/config'
|
11
12
|
|
12
13
|
module Pod
|
13
14
|
class Resolver
|
@@ -90,8 +91,8 @@ module Pod
|
|
90
91
|
|
91
92
|
# 读取黑名单
|
92
93
|
def read_black_list
|
93
|
-
|
94
|
-
config_file = File.join(
|
94
|
+
binary_dir = CBin.config.binary_dir
|
95
|
+
config_file = File.join(binary_dir, 'BinConfig.yaml')
|
95
96
|
return nil unless File.exist?(config_file)
|
96
97
|
config = YAML.load(File.open(config_file))
|
97
98
|
return nil if config.nil?
|
@@ -199,13 +200,6 @@ module Pod
|
|
199
200
|
|
200
201
|
UI.message "specification = #{specification}"
|
201
202
|
# 组件是 subspec
|
202
|
-
# subspec 需要特殊处理
|
203
|
-
# 如果是源码,则获取相应 subspec 的 specification
|
204
|
-
# 如果是二进制,则获取整个 specification
|
205
|
-
# if !use_binary && rspec.spec.subspec?
|
206
|
-
# specification = specification.subspec_by_name(rspec.name, false, true)
|
207
|
-
# end
|
208
|
-
|
209
203
|
if rspec.spec.subspec?
|
210
204
|
specification = specification.subspec_by_name(rspec.name, false, true)
|
211
205
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'cocoapods-mtxx-bin/native/sources_manager'
|
2
2
|
require 'cocoapods-mtxx-bin/command/bin/repo/update'
|
3
|
+
require 'cocoapods-mtxx-bin/config/config'
|
3
4
|
require 'cocoapods/user_interface'
|
4
5
|
require 'yaml'
|
5
6
|
|
@@ -44,7 +45,7 @@ Pod::HooksManager.register('cocoapods-mtxx-bin', :source_provider) do |context,
|
|
44
45
|
podfile = Pod::Config.instance.podfile
|
45
46
|
if podfile
|
46
47
|
# 读取配置文件
|
47
|
-
project_root =
|
48
|
+
project_root = CBin.config.binary_dir
|
48
49
|
config_file = File.join(project_root, 'BinConfig.yaml')
|
49
50
|
if File.exist?(config_file)
|
50
51
|
config = YAML.load(File.open(config_file))
|
metadata
CHANGED
@@ -1,43 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-mtxx-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.22.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.22.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cocoapods
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.10.2
|
34
|
+
- - "<="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.11.2
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- -
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 1.10.2
|
44
|
+
- - "<="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.11.2
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: cocoapods-generate
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,6 +108,7 @@ files:
|
|
102
108
|
- lib/cocoapods-mtxx-bin/command/bin/initHotKey.rb
|
103
109
|
- lib/cocoapods-mtxx-bin/command/bin/install.rb
|
104
110
|
- lib/cocoapods-mtxx-bin/command/bin/lib/lint.rb
|
111
|
+
- lib/cocoapods-mtxx-bin/command/bin/outputSource.rb
|
105
112
|
- lib/cocoapods-mtxx-bin/command/bin/repo.rb
|
106
113
|
- lib/cocoapods-mtxx-bin/command/bin/repo/push.rb
|
107
114
|
- lib/cocoapods-mtxx-bin/command/bin/repo/update.rb
|
@@ -109,6 +116,7 @@ files:
|
|
109
116
|
- lib/cocoapods-mtxx-bin/command/bin/spec/create.rb
|
110
117
|
- lib/cocoapods-mtxx-bin/command/bin/spec/lint.rb
|
111
118
|
- lib/cocoapods-mtxx-bin/command/bin/update.rb
|
119
|
+
- lib/cocoapods-mtxx-bin/command/bin/upload.rb
|
112
120
|
- lib/cocoapods-mtxx-bin/config/config.rb
|
113
121
|
- lib/cocoapods-mtxx-bin/config/config_asker.rb
|
114
122
|
- lib/cocoapods-mtxx-bin/config/config_builder.rb
|