cocoapods-mtxx-bin 0.0.3 → 0.0.7
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 +2 -1
- data/lib/cocoapods-mtxx-bin/command/bin/init.rb +1 -1
- data/lib/cocoapods-mtxx-bin/command/bin/upload.rb +173 -0
- data/lib/cocoapods-mtxx-bin/command/bin.rb +1 -0
- 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/builder.rb +1 -1
- data/lib/cocoapods-mtxx-bin/native/installer.rb +19 -19
- data/lib/cocoapods-mtxx-bin/native/resolver.rb +3 -9
- data/lib/cocoapods-mtxx-bin/source_provider_hook.rb +2 -1
- metadata +15 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df7e5b2628a85abdfb8c632ce10affd45eceef978f17030cc8fa587a55937052
|
4
|
+
data.tar.gz: 8ce6a4a89a75c32075f406d9ec8c929eac12b9b3b63e114f61b37ab56112a576
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bb9deccb62a75ca54db13fb02f2b1c43b0a0cd5f945fd18bcfd34858b1a16c35df4d4214f5942dd1480fe9bfae9035687989db60c53e1d000ebc51654749491
|
7
|
+
data.tar.gz: dff8ecc36300ffd1e885d1f968f43276a9c055b24fb8dc791b4d568ac985928e468ae2e46d198d1589bfabf17fc0f390557ee083b3377de10e5a34b08d263de2
|
@@ -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
|
|
@@ -71,7 +72,7 @@ module Pod
|
|
71
72
|
# 读取配置文件
|
72
73
|
def read_config
|
73
74
|
UI.title "Read config from file `BinConfig.yaml`".green do
|
74
|
-
config_file = File.join(
|
75
|
+
config_file = File.join(CBin.config.binary_dir, 'BinConfig.yaml')
|
75
76
|
return unless File.exist?(config_file)
|
76
77
|
config = YAML.load(File.open(config_file))
|
77
78
|
return if config.nil?
|
@@ -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,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,7 @@ 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/upload'
|
12
13
|
require 'cocoapods-mtxx-bin/helpers'
|
13
14
|
# require 'cocoapods-mtxx-bin/native'
|
14
15
|
|
@@ -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
|
@@ -233,7 +233,7 @@ ibtool \
|
|
233
233
|
header_dir = headers_dir
|
234
234
|
if @pod_target.uses_swift?
|
235
235
|
umbrella_header = "#{product_dir}/#{iphoneos}/#{@pod_target}/#{@pod_target}-umbrella.h"
|
236
|
-
swift_header = "#{product_dir}/#{iphoneos}/#{@pod_target}/Swift
|
236
|
+
swift_header = "#{product_dir}/#{iphoneos}/#{@pod_target}/Swift Compatibility Header/#{@pod_target.product_module_name}-Swift.h"
|
237
237
|
headers.concat([umbrella_header, swift_header])
|
238
238
|
end
|
239
239
|
else
|
@@ -94,25 +94,25 @@ module Pod
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
alias old_write_lockfiles write_lockfiles
|
98
|
-
def write_lockfiles
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
97
|
+
# alias old_write_lockfiles write_lockfiles
|
98
|
+
# def write_lockfiles
|
99
|
+
# old_write_lockfiles
|
100
|
+
# if File.exist?('Podfile_local')
|
101
|
+
#
|
102
|
+
# project = Xcodeproj::Project.open(config.sandbox.project_path)
|
103
|
+
# #获取主group
|
104
|
+
# group = project.main_group
|
105
|
+
# group.set_source_tree('SOURCE_ROOT')
|
106
|
+
# #向group中添加 文件引用
|
107
|
+
# file_ref = group.new_reference(config.sandbox.root + '../Podfile_local')
|
108
|
+
# #podfile_local排序
|
109
|
+
# podfile_local_group = group.children.last
|
110
|
+
# group.children.pop
|
111
|
+
# group.children.unshift(podfile_local_group)
|
112
|
+
# #保存
|
113
|
+
# project.save
|
114
|
+
# end
|
115
|
+
# end
|
116
116
|
end
|
117
117
|
|
118
118
|
module Downloader
|
@@ -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,41 +1,47 @@
|
|
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.7
|
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-05-30 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
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.10.2
|
34
|
+
- - "<="
|
32
35
|
- !ruby/object:Gem::Version
|
33
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
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.10.2
|
44
|
+
- - "<="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: 1.11.2
|
41
47
|
- !ruby/object:Gem::Dependency
|
@@ -109,6 +115,7 @@ files:
|
|
109
115
|
- lib/cocoapods-mtxx-bin/command/bin/spec/create.rb
|
110
116
|
- lib/cocoapods-mtxx-bin/command/bin/spec/lint.rb
|
111
117
|
- lib/cocoapods-mtxx-bin/command/bin/update.rb
|
118
|
+
- lib/cocoapods-mtxx-bin/command/bin/upload.rb
|
112
119
|
- lib/cocoapods-mtxx-bin/config/config.rb
|
113
120
|
- lib/cocoapods-mtxx-bin/config/config_asker.rb
|
114
121
|
- lib/cocoapods-mtxx-bin/config/config_builder.rb
|