cocoapods-bb-bin 0.1.7 → 0.1.9.1
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-bb-bin/command/bin/auto.rb +1 -1
- data/lib/cocoapods-bb-bin/command/bin/lib/lint.rb +78 -21
- data/lib/cocoapods-bb-bin/command/bin/repo/push.rb +177 -0
- data/lib/cocoapods-bb-bin/gem_version.rb +1 -1
- data/lib/cocoapods-bb-bin/helpers/upload_helper.rb +3 -2
- data/lib/cocoapods-bb-bin/native/push.rb +60 -0
- data/lib/cocoapods-bb-bin/native/resolver.rb +2 -2
- data/lib/cocoapods-bb-bin/native/validator.rb +120 -9
- data/lib/cocoapods-bb-bin/native.rb +2 -1
- metadata +4 -3
- data/lib/cocoapods-bb-bin/command/bin/spec/push.rb +0 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 421565cc472d283f9e146259dc55a04d59f47ea257971c5ed08c0c91a20f8103
|
4
|
+
data.tar.gz: 6fd6c9755d9dc3277a9f055e38dac34edee2ed1f2a827d454558be14c8a78668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48b8836abd60d88e82321a1843964ccda27ff364a09f8f5b56b4ecd2b56b6d0735b07fa561954411534fd2d93338db0b34009764eb382f0b1794ae7781a16d69
|
7
|
+
data.tar.gz: 41233c856e3922cb85ac445219b14021670b10516fc8b2292e1326648ca842857081e27bce96c36bc61c242408a51d89e5876315476687985d67a12f745baff1
|
@@ -32,7 +32,7 @@ module Pod
|
|
32
32
|
@env = argv.option('env') || 'dev'
|
33
33
|
CBin.config.set_configuration_env(@env)
|
34
34
|
|
35
|
-
podfile_path = link_podfile # 创建软链接
|
35
|
+
# podfile_path = link_podfile # 创建软链接 去除link操作 by hm 21/11/24
|
36
36
|
@podspec = argv.shift_argument || find_podspec
|
37
37
|
@specification = Specification.from_file(@podspec)
|
38
38
|
|
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'cocoapods-bb-bin/config/config'
|
2
2
|
require 'cocoapods-bb-bin/native/podfile'
|
3
|
+
require 'cocoapods/command/lib/lint'
|
4
|
+
require 'cocoapods'
|
3
5
|
|
4
6
|
module Pod
|
5
7
|
class Command
|
6
8
|
class Bin < Command
|
7
9
|
class Lib < Bin
|
8
10
|
class Lint < Lib
|
9
|
-
self.summary = '
|
11
|
+
self.summary = 'Validates a Pod'
|
12
|
+
|
10
13
|
self.description = <<-DESC
|
11
|
-
|
14
|
+
Validates the Pod using the files in the working directory.
|
12
15
|
DESC
|
13
16
|
|
14
17
|
self.arguments = [
|
15
|
-
CLAide::Argument.new('NAME.podspec', false)
|
18
|
+
CLAide::Argument.new('NAME.podspec', false),
|
16
19
|
]
|
17
20
|
|
18
21
|
# lib lint 不会下载 source,所以不能进行二进制 lint
|
@@ -21,46 +24,100 @@ module Pod
|
|
21
24
|
[
|
22
25
|
['--code-dependencies', '使用源码依赖进行 lint'],
|
23
26
|
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
24
|
-
['--allow-prerelease', '允许使用 prerelease 的版本 lint']
|
27
|
+
['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
|
28
|
+
['--bb-env', 'bb Company environment(Internal use),support oc、swift project']
|
25
29
|
].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
|
26
30
|
end
|
27
31
|
|
28
32
|
def initialize(argv)
|
29
33
|
@loose_options = argv.flag?('loose-options')
|
30
|
-
@code_dependencies = argv.flag?('code-dependencies')
|
34
|
+
@code_dependencies = argv.flag?('code-dependencies', true)
|
31
35
|
@sources = argv.option('sources') || []
|
32
36
|
@allow_prerelease = argv.flag?('allow-prerelease')
|
37
|
+
@bb_env = argv.flag?('bb-env', false)
|
33
38
|
@podspec = argv.shift_argument
|
34
39
|
super
|
35
|
-
|
36
40
|
@additional_args = argv.remainder!
|
41
|
+
@verbose = argv.flag?('verbose', false)
|
37
42
|
end
|
38
43
|
|
39
44
|
def run
|
40
|
-
|
41
|
-
|
45
|
+
# @bb_env = false
|
46
|
+
if @bb_env
|
47
|
+
Podfile.execute_with_bin_plugin do
|
42
48
|
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
build_bb_lint
|
50
|
+
end
|
51
|
+
end
|
52
|
+
else
|
53
|
+
Podfile.execute_with_bin_plugin do
|
54
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
55
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
56
|
+
argvs = [
|
57
|
+
@podspec || code_spec_files.first,
|
58
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
59
|
+
*@additional_args
|
60
|
+
]
|
48
61
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
62
|
+
if @loose_options
|
63
|
+
argvs << '--allow-warnings'
|
64
|
+
if code_spec&.all_dependencies&.any?
|
65
|
+
argvs << '--use-libraries'
|
66
|
+
end
|
53
67
|
end
|
54
|
-
end
|
55
68
|
|
56
|
-
|
57
|
-
|
58
|
-
|
69
|
+
lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
|
70
|
+
lint.validate!
|
71
|
+
lint.run
|
72
|
+
end
|
59
73
|
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
63
77
|
|
78
|
+
private
|
79
|
+
|
80
|
+
def build_bb_lint
|
81
|
+
UI.section("\npod bin lib lint\n".yellow) do
|
82
|
+
begin
|
83
|
+
if @podspec && !@podspec.empty?
|
84
|
+
argvs = [
|
85
|
+
@podspec, # 业务方传入podspec,对于业务方没有传入podspec,内部由podspecs_to_lint进行遍历
|
86
|
+
# '--verbose',
|
87
|
+
'--allow-warnings',
|
88
|
+
'--use-static-frameworks',
|
89
|
+
'--no-clean',
|
90
|
+
'--skip-import-validation',
|
91
|
+
'--use-modular-headers',
|
92
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
93
|
+
'--swift-version=5.0',
|
94
|
+
*@additional_args
|
95
|
+
]
|
96
|
+
argvs += ['--verbose'] if @verbose
|
97
|
+
else
|
98
|
+
argvs = [
|
99
|
+
# '--verbose',
|
100
|
+
'--allow-warnings',
|
101
|
+
'--use-static-frameworks',
|
102
|
+
'--no-clean',
|
103
|
+
'--skip-import-validation',
|
104
|
+
'--use-modular-headers',
|
105
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
106
|
+
'--swift-version=5.0',
|
107
|
+
*@additional_args
|
108
|
+
]
|
109
|
+
argvs += ['--verbose'] if @verbose
|
110
|
+
end
|
111
|
+
|
112
|
+
# puts "pod lib lint argvs:#{argvs}"
|
113
|
+
lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
|
114
|
+
lint.validate!
|
115
|
+
lint.run
|
116
|
+
rescue Object => exception
|
117
|
+
UI.puts exception
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
64
121
|
|
65
122
|
end
|
66
123
|
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require 'cocoapods-bb-bin/config/config'
|
2
|
+
require 'cocoapods-bb-bin/native/podfile'
|
3
|
+
require 'cocoapods-bb-bin/native/push'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Repo < Bin
|
9
|
+
class Push < Repo
|
10
|
+
self.summary = '发布组件.'
|
11
|
+
self.description = <<-DESC
|
12
|
+
发布二进制组件 / 源码组件
|
13
|
+
DESC
|
14
|
+
|
15
|
+
self.arguments = [
|
16
|
+
CLAide::Argument.new('REPO', true),
|
17
|
+
CLAide::Argument.new('NAME.podspec', false),
|
18
|
+
]
|
19
|
+
|
20
|
+
def self.options
|
21
|
+
[
|
22
|
+
['--binary', '发布组件的二进制版本'],
|
23
|
+
['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
|
24
|
+
['--reserve-created-spec', '保留生成的二进制 spec 文件'],
|
25
|
+
['--code-dependencies', '使用源码依赖进行 lint'],
|
26
|
+
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
27
|
+
['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
|
28
|
+
['--use-static-frameworks', 'Lint uses static frameworks during installation,support modulemap'],
|
29
|
+
['--bb-env', 'bb Company environment(Internal use),support oc、swift project']
|
30
|
+
].concat(Pod::Command::Repo::Push.options).concat(super).uniq
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(argv)
|
34
|
+
super
|
35
|
+
@repo = argv.shift_argument
|
36
|
+
@podspec = argv.shift_argument
|
37
|
+
@binary = argv.flag?('binary')
|
38
|
+
@loose_options = argv.flag?('loose-options')
|
39
|
+
@code_dependencies = argv.flag?('code-dependencies', true)
|
40
|
+
@sources = argv.option('sources') || []
|
41
|
+
@reserve_created_spec = argv.flag?('reserve-created-spec')
|
42
|
+
@template_podspec = argv.option('template-podspec')
|
43
|
+
@allow_prerelease = argv.flag?('allow-prerelease')
|
44
|
+
@use_static_frameworks = argv.flag?('use-static-frameworks', true)
|
45
|
+
@bb_env = argv.flag?('bb-env', false)
|
46
|
+
|
47
|
+
@additional_args = argv.remainder!
|
48
|
+
@message = argv.option('commit-message')
|
49
|
+
@commit_message = argv.flag?('commit-message', false)
|
50
|
+
@use_json = argv.flag?('use-json')
|
51
|
+
@verbose = argv.flag?('verbose', false)
|
52
|
+
@local_only = argv.flag?('local-only')
|
53
|
+
end
|
54
|
+
|
55
|
+
def run
|
56
|
+
# @bb_env = false
|
57
|
+
if @bb_env
|
58
|
+
Podfile.execute_with_bin_plugin do
|
59
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
60
|
+
build_bb_push
|
61
|
+
end
|
62
|
+
end
|
63
|
+
else
|
64
|
+
Podfile.execute_with_bin_plugin do
|
65
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
66
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
67
|
+
argvs = [
|
68
|
+
repo,
|
69
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
70
|
+
*@additional_args
|
71
|
+
]
|
72
|
+
|
73
|
+
argvs << spec_file if spec_file
|
74
|
+
|
75
|
+
if @loose_options
|
76
|
+
argvs += ['--allow-warnings', '--use-json']
|
77
|
+
if code_spec&.all_dependencies&.any?
|
78
|
+
argvs << '--use-libraries'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
|
83
|
+
push.validate!
|
84
|
+
push.run
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
ensure
|
90
|
+
clear_binary_spec_file_if_needed unless @reserve_created_spec
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
def build_bb_push
|
95
|
+
UI.section("\npod bin repo push\n".yellow) do
|
96
|
+
begin
|
97
|
+
unless @podspec && !@podspec.empty? # 遍历当前目录下podspec文件
|
98
|
+
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.json,}')
|
99
|
+
if podspecs.count.zero?
|
100
|
+
raise Informative, 'Unable to find a podspec in the working ' \
|
101
|
+
'directory'
|
102
|
+
end
|
103
|
+
@podspec = podspecs.first
|
104
|
+
end
|
105
|
+
new_repo = repo # 内部判断区源码还是二进制
|
106
|
+
if !@repo.nil?
|
107
|
+
new_repo = @repo # 使用命令传入
|
108
|
+
end
|
109
|
+
argvs = [
|
110
|
+
new_repo,
|
111
|
+
@podspec,
|
112
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
113
|
+
# '--verbose'
|
114
|
+
'--allow-warnings',
|
115
|
+
'--use-static-frameworks',
|
116
|
+
'--skip-import-validation',
|
117
|
+
'--use-modular-headers',
|
118
|
+
'--swift-version=5.0',
|
119
|
+
'--use_cocoapods_validator', #cocoapods验证
|
120
|
+
*@additional_args
|
121
|
+
]
|
122
|
+
argvs += ['--verbose'] if @verbose
|
123
|
+
argvs += ['--commit-message'] if @message
|
124
|
+
argvs += ['--use-json'] if @use_json
|
125
|
+
argvs += ['--local-only'] if @local_only
|
126
|
+
|
127
|
+
# UI.puts "pod repo push argvs:#{argvs}"
|
128
|
+
push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
|
129
|
+
push.validate!
|
130
|
+
push.run
|
131
|
+
rescue Object => exception
|
132
|
+
UI.puts exception
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def template_spec_file
|
138
|
+
@template_spec_file ||= begin
|
139
|
+
if @template_podspec
|
140
|
+
find_spec_file(@template_podspec)
|
141
|
+
else
|
142
|
+
binary_template_spec_file
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def spec_file
|
148
|
+
@spec_file ||= begin
|
149
|
+
if @podspec
|
150
|
+
find_spec_file(@podspec)
|
151
|
+
else
|
152
|
+
if code_spec_files.empty?
|
153
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
154
|
+
end
|
155
|
+
|
156
|
+
spec_file = if @binary
|
157
|
+
code_spec = Pod::Specification.from_file(code_spec_files.first)
|
158
|
+
if template_spec_file
|
159
|
+
template_spec = Pod::Specification.from_file(template_spec_file)
|
160
|
+
end
|
161
|
+
create_binary_spec_file(code_spec, template_spec)
|
162
|
+
else
|
163
|
+
code_spec_files.first
|
164
|
+
end
|
165
|
+
spec_file
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def repo
|
171
|
+
@binary ? binary_source.name : code_source.name
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
@@ -8,7 +8,7 @@ require 'cocoapods/generate'
|
|
8
8
|
require 'cocoapods-bb-bin/helpers/framework_builder'
|
9
9
|
require 'cocoapods-bb-bin/helpers/library_builder'
|
10
10
|
require 'cocoapods-bb-bin/helpers/sources_helper'
|
11
|
-
require 'cocoapods-bb-bin/command/bin/
|
11
|
+
require 'cocoapods-bb-bin/command/bin/repo/push'
|
12
12
|
|
13
13
|
module CBin
|
14
14
|
class Upload
|
@@ -73,7 +73,8 @@ EOF
|
|
73
73
|
# 上传二进制 podspec
|
74
74
|
def push_binary_repo(binary_podsepc_json)
|
75
75
|
argvs = [
|
76
|
-
"#{
|
76
|
+
"#{binary_source.name}", # repo
|
77
|
+
"#{binary_podsepc_json}", # spec
|
77
78
|
"--binary",
|
78
79
|
"--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org",
|
79
80
|
"--skip-import-validation",
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'active_support/core_ext/string/inflections'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Repo < Command
|
8
|
+
class Push < Repo
|
9
|
+
|
10
|
+
def initialize(argv)
|
11
|
+
@allow_warnings = argv.flag?('allow-warnings')
|
12
|
+
@local_only = argv.flag?('local-only')
|
13
|
+
@repo = argv.shift_argument
|
14
|
+
@source = source_for_repo
|
15
|
+
@source_urls = argv.option('sources', config.sources_manager.all.map(&:url).append(Pod::TrunkSource::TRUNK_REPO_URL).uniq.join(',')).split(',')
|
16
|
+
@update_sources = argv.flag?('update-sources')
|
17
|
+
@podspec = argv.shift_argument
|
18
|
+
@use_frameworks = !argv.flag?('use-libraries')
|
19
|
+
@use_modular_headers = argv.flag?('use-modular-headers', false)
|
20
|
+
@use_static_frameworks = argv.flag?('use-static-frameworks')
|
21
|
+
@private = argv.flag?('private', true)
|
22
|
+
@message = argv.option('commit-message')
|
23
|
+
@commit_message = argv.flag?('commit-message', false)
|
24
|
+
@use_json = argv.flag?('use-json')
|
25
|
+
@swift_version = argv.option('swift-version', nil)
|
26
|
+
@skip_import_validation = argv.flag?('skip-import-validation', false)
|
27
|
+
@skip_tests = argv.flag?('skip-tests', false)
|
28
|
+
@allow_overwrite = argv.flag?('overwrite', true)
|
29
|
+
super
|
30
|
+
@use_cocoapods_validator = argv.flag?('use_cocoapods_validator', false)# 配置参数cocoapods进行验证,内部进行hook,二进制hook,源码cocoapods进行验证
|
31
|
+
end
|
32
|
+
|
33
|
+
# Performs a full lint against the podspecs.
|
34
|
+
#
|
35
|
+
def validate_podspec_files
|
36
|
+
UI.puts "\nbin Validating #{'spec'.pluralize(count)}".yellow
|
37
|
+
podspec_files.each do |podspec|
|
38
|
+
validator = Validator.new(podspec, @source_urls, [], @use_cocoapods_validator)
|
39
|
+
validator.allow_warnings = @allow_warnings
|
40
|
+
validator.use_frameworks = @use_frameworks
|
41
|
+
validator.use_static_frameworks = @use_static_frameworks
|
42
|
+
validator.use_modular_headers = @use_modular_headers
|
43
|
+
validator.ignore_public_only_results = @private
|
44
|
+
validator.swift_version = @swift_version
|
45
|
+
validator.skip_import_validation = @skip_import_validation
|
46
|
+
validator.skip_tests = @skip_tests
|
47
|
+
begin
|
48
|
+
validator.validate
|
49
|
+
rescue => e
|
50
|
+
raise Informative, "The `#{podspec}` specification does not validate." \
|
51
|
+
"\n\n#{e.message}"
|
52
|
+
end
|
53
|
+
raise Informative, "The `#{podspec}` specification does not validate." unless validator.validated?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -126,8 +126,8 @@ module Pod
|
|
126
126
|
source = use_binary ? sources_manager.binary_source : sources_manager.code_source
|
127
127
|
|
128
128
|
spec_version = rspec.spec.version
|
129
|
-
UI.message 'cocoapods-bb-bin 插件'
|
130
|
-
UI.message "- 开始处理 #{rspec.spec.name} #{spec_version} 组件."
|
129
|
+
# UI.message 'cocoapods-bb-bin 插件'
|
130
|
+
# UI.message "- 开始处理 #{rspec.spec.name} #{spec_version} 组件."
|
131
131
|
|
132
132
|
begin
|
133
133
|
# 从新 source 中获取 spec,在bin archive中会异常,因为找不到
|
@@ -2,23 +2,49 @@
|
|
2
2
|
|
3
3
|
module Pod
|
4
4
|
class Validator
|
5
|
-
#
|
6
|
-
# return if spec.source.nil? || spec.source[:http].nil?
|
7
|
-
# url = URI(spec.source[:http])
|
8
|
-
# return if url.scheme == 'https' || url.scheme == 'file'
|
9
|
-
# warning('http', "The URL (`#{url}`) doesn't use the encrypted HTTPs protocol. " \
|
10
|
-
# 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\
|
11
|
-
# 'This will be an error in future releases. Please update the URL to use https.')
|
12
|
-
# end
|
5
|
+
# @return [Boolean] 使用cocoapods进行验证,二进制库推送默认不采用cocoapods(1.11.2)验证
|
13
6
|
#
|
7
|
+
# attr_accessor :use_cocoapods_validator
|
8
|
+
def initialize(spec_or_path, source_urls, platforms = [], use_cocoapods_validator = false)
|
9
|
+
@use_cocoapods_validator = use_cocoapods_validator
|
10
|
+
@use_frameworks = true
|
11
|
+
@linter = Specification::Linter.new(spec_or_path)
|
12
|
+
@source_urls = if @linter.spec && @linter.spec.dependencies.empty? && @linter.spec.recursive_subspecs.all? { |s| s.dependencies.empty? }
|
13
|
+
[]
|
14
|
+
else
|
15
|
+
source_urls.map { |url| config.sources_manager.source_with_name_or_url(url) }.map(&:url)
|
16
|
+
end
|
17
|
+
|
18
|
+
@platforms = platforms.map do |platform|
|
19
|
+
result = case platform.to_s.downcase
|
20
|
+
# Platform doesn't recognize 'macos' as being the same as 'osx' when initializing
|
21
|
+
when 'macos' then Platform.macos
|
22
|
+
else Platform.new(platform, nil)
|
23
|
+
end
|
24
|
+
unless valid_platform?(result)
|
25
|
+
raise Informative, "Unrecognized platform `#{platform}`. Valid platforms: #{VALID_PLATFORMS.join(', ')}"
|
26
|
+
end
|
27
|
+
result
|
28
|
+
end
|
29
|
+
@use_frameworks = true
|
30
|
+
end
|
31
|
+
|
14
32
|
# Perform analysis for a given spec (or subspec)
|
15
33
|
#
|
16
34
|
def perform_extensive_analysis(spec)
|
35
|
+
if @use_cocoapods_validator
|
36
|
+
return cocoapods_perform_extensive_analysis(spec)
|
37
|
+
end
|
17
38
|
return true
|
18
39
|
end
|
19
40
|
|
20
41
|
#覆盖
|
21
42
|
def check_file_patterns
|
43
|
+
if @use_cocoapods_validator
|
44
|
+
cocoapods_check_file_patterns
|
45
|
+
return
|
46
|
+
end
|
47
|
+
# 二进制验证部分
|
22
48
|
FILE_PATTERNS.each do |attr_name|
|
23
49
|
next if %i(source_files resources).include? attr_name
|
24
50
|
if respond_to?("_validate_#{attr_name}", true)
|
@@ -35,6 +61,91 @@ module Pod
|
|
35
61
|
end
|
36
62
|
end
|
37
63
|
|
38
|
-
def validate_source_url(spec)
|
64
|
+
def validate_source_url(spec)
|
65
|
+
if @use_cocoapods_validator
|
66
|
+
cocoapods_validate_source_url(spec)
|
67
|
+
return
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# cocoapods(1.11.2) validator源码
|
72
|
+
private
|
73
|
+
|
74
|
+
# It checks that every file pattern specified in a spec yields
|
75
|
+
# at least one file. It requires the pods to be already present
|
76
|
+
# in the current working directory under Pods/spec.name.
|
77
|
+
#
|
78
|
+
# @return [void]
|
79
|
+
#
|
80
|
+
def cocoapods_check_file_patterns
|
81
|
+
FILE_PATTERNS.each do |attr_name|
|
82
|
+
if respond_to?("_validate_#{attr_name}", true)
|
83
|
+
send("_validate_#{attr_name}")
|
84
|
+
else
|
85
|
+
validate_nonempty_patterns(attr_name, :error)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
_validate_header_mappings_dir
|
90
|
+
if consumer.spec.root?
|
91
|
+
_validate_license
|
92
|
+
_validate_module_map
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Performs validations related to the `source` -> `http` attribute (if exists)
|
97
|
+
#
|
98
|
+
def cocoapods_validate_source_url(spec)
|
99
|
+
return if spec.source.nil? || spec.source[:http].nil?
|
100
|
+
url = URI(spec.source[:http])
|
101
|
+
return if url.scheme == 'https' || url.scheme == 'file'
|
102
|
+
warning('http', "The URL (`#{url}`) doesn't use the encrypted HTTPS protocol. " \
|
103
|
+
'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\
|
104
|
+
'This will be an error in future releases. Please update the URL to use https.')
|
105
|
+
end
|
106
|
+
|
107
|
+
# Perform analysis for a given spec (or subspec)
|
108
|
+
#
|
109
|
+
def cocoapods_perform_extensive_analysis(spec)
|
110
|
+
if spec.non_library_specification?
|
111
|
+
error('spec', "Validating a non library spec (`#{spec.name}`) is not supported.")
|
112
|
+
return false
|
113
|
+
end
|
114
|
+
validate_homepage(spec)
|
115
|
+
validate_screenshots(spec)
|
116
|
+
validate_social_media_url(spec)
|
117
|
+
validate_documentation_url(spec)
|
118
|
+
validate_source_url(spec)
|
119
|
+
|
120
|
+
platforms = platforms_to_lint(spec)
|
121
|
+
|
122
|
+
valid = platforms.send(fail_fast ? :all? : :each) do |platform|
|
123
|
+
UI.message "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed
|
124
|
+
@consumer = spec.consumer(platform)
|
125
|
+
setup_validation_environment
|
126
|
+
begin
|
127
|
+
create_app_project
|
128
|
+
download_pod
|
129
|
+
check_file_patterns
|
130
|
+
install_pod
|
131
|
+
validate_swift_version
|
132
|
+
add_app_project_import
|
133
|
+
validate_vendored_dynamic_frameworks
|
134
|
+
build_pod
|
135
|
+
test_pod unless skip_tests
|
136
|
+
ensure
|
137
|
+
tear_down_validation_environment
|
138
|
+
end
|
139
|
+
validated?
|
140
|
+
end
|
141
|
+
return false if fail_fast && !valid
|
142
|
+
perform_extensive_subspec_analysis(spec) unless @no_subspecs
|
143
|
+
rescue => e
|
144
|
+
message = e.to_s
|
145
|
+
message << "\n" << e.backtrace.join("\n") << "\n" if config.verbose?
|
146
|
+
error('unknown', "Encountered an unknown error (#{message}) during validation.")
|
147
|
+
false
|
148
|
+
end
|
149
|
+
|
39
150
|
end
|
40
151
|
end
|
@@ -12,12 +12,13 @@ if Pod.match_version?('~> 1.4')
|
|
12
12
|
require 'cocoapods-bb-bin/native/linter'
|
13
13
|
require 'cocoapods-bb-bin/native/resolver'
|
14
14
|
require 'cocoapods-bb-bin/native/source'
|
15
|
-
require 'cocoapods-bb-bin/native/validator'
|
15
|
+
require 'cocoapods-bb-bin/native/validator' #使用cocoapods-1.11.2
|
16
16
|
require 'cocoapods-bb-bin/native/acknowledgements'
|
17
17
|
require 'cocoapods-bb-bin/native/sandbox_analyzer'
|
18
18
|
require 'cocoapods-bb-bin/native/podspec_finder'
|
19
19
|
require 'cocoapods-bb-bin/native/file_accessor'
|
20
20
|
require 'cocoapods-bb-bin/native/pod_target_installer'
|
21
21
|
require 'cocoapods-bb-bin/native/target_validator'
|
22
|
+
require 'cocoapods-bb-bin/native/push' # 支持modulemap & swift与oc工程混编
|
22
23
|
|
23
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bb-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -128,9 +128,9 @@ files:
|
|
128
128
|
- lib/cocoapods-bb-bin/command/bin/initHotKey.rb
|
129
129
|
- lib/cocoapods-bb-bin/command/bin/install.rb
|
130
130
|
- lib/cocoapods-bb-bin/command/bin/lib/lint.rb
|
131
|
+
- lib/cocoapods-bb-bin/command/bin/repo/push.rb
|
131
132
|
- lib/cocoapods-bb-bin/command/bin/repo/update.rb
|
132
133
|
- lib/cocoapods-bb-bin/command/bin/spec/create.rb
|
133
|
-
- lib/cocoapods-bb-bin/command/bin/spec/push.rb
|
134
134
|
- lib/cocoapods-bb-bin/command/bin/update.rb
|
135
135
|
- lib/cocoapods-bb-bin/config/config.rb
|
136
136
|
- lib/cocoapods-bb-bin/config/config_asker.rb
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/cocoapods-bb-bin/native/podfile_env.rb
|
167
167
|
- lib/cocoapods-bb-bin/native/podfile_generator.rb
|
168
168
|
- lib/cocoapods-bb-bin/native/podspec_finder.rb
|
169
|
+
- lib/cocoapods-bb-bin/native/push.rb
|
169
170
|
- lib/cocoapods-bb-bin/native/resolver.rb
|
170
171
|
- lib/cocoapods-bb-bin/native/sandbox_analyzer.rb
|
171
172
|
- lib/cocoapods-bb-bin/native/source.rb
|
@@ -1,114 +0,0 @@
|
|
1
|
-
require 'cocoapods-bb-bin/config/config'
|
2
|
-
require 'cocoapods-bb-bin/native/podfile'
|
3
|
-
|
4
|
-
module Pod
|
5
|
-
class Command
|
6
|
-
class Bin < Command
|
7
|
-
class Repo < Bin
|
8
|
-
class Push < Repo
|
9
|
-
self.summary = '发布组件.'
|
10
|
-
self.description = <<-DESC
|
11
|
-
发布二进制组件 / 源码组件
|
12
|
-
DESC
|
13
|
-
|
14
|
-
self.arguments = [
|
15
|
-
CLAide::Argument.new('NAME.podspec', false)
|
16
|
-
]
|
17
|
-
|
18
|
-
def self.options
|
19
|
-
[
|
20
|
-
['--binary', '发布组件的二进制版本'],
|
21
|
-
['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
|
22
|
-
['--reserve-created-spec', '保留生成的二进制 spec 文件'],
|
23
|
-
['--code-dependencies', '使用源码依赖进行 lint'],
|
24
|
-
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
25
|
-
['--allow-prerelease', '允许使用 prerelease 的版本 lint']
|
26
|
-
].concat(Pod::Command::Repo::Push.options).concat(super).uniq
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize(argv)
|
30
|
-
@podspec = argv.shift_argument
|
31
|
-
@binary = argv.flag?('binary')
|
32
|
-
@loose_options = argv.flag?('loose-options')
|
33
|
-
@code_dependencies = argv.flag?('code-dependencies')
|
34
|
-
@sources = argv.option('sources') || []
|
35
|
-
@reserve_created_spec = argv.flag?('reserve-created-spec')
|
36
|
-
@template_podspec = argv.option('template-podspec')
|
37
|
-
@allow_prerelease = argv.flag?('allow-prerelease')
|
38
|
-
super
|
39
|
-
|
40
|
-
@additional_args = argv.remainder!
|
41
|
-
end
|
42
|
-
|
43
|
-
def run
|
44
|
-
Podfile.execute_with_bin_plugin do
|
45
|
-
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
46
|
-
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
47
|
-
argvs = [
|
48
|
-
repo,
|
49
|
-
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
50
|
-
*@additional_args
|
51
|
-
]
|
52
|
-
|
53
|
-
argvs << spec_file if spec_file
|
54
|
-
|
55
|
-
if @loose_options
|
56
|
-
argvs += ['--allow-warnings', '--use-json']
|
57
|
-
if code_spec&.all_dependencies&.any?
|
58
|
-
argvs << '--use-libraries'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
|
63
|
-
push.validate!
|
64
|
-
push.run
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
ensure
|
69
|
-
clear_binary_spec_file_if_needed unless @reserve_created_spec
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
|
-
def template_spec_file
|
75
|
-
@template_spec_file ||= begin
|
76
|
-
if @template_podspec
|
77
|
-
find_spec_file(@template_podspec)
|
78
|
-
else
|
79
|
-
binary_template_spec_file
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def spec_file
|
85
|
-
@spec_file ||= begin
|
86
|
-
if @podspec
|
87
|
-
find_spec_file(@podspec)
|
88
|
-
else
|
89
|
-
if code_spec_files.empty?
|
90
|
-
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
91
|
-
end
|
92
|
-
|
93
|
-
spec_file = if @binary
|
94
|
-
code_spec = Pod::Specification.from_file(code_spec_files.first)
|
95
|
-
if template_spec_file
|
96
|
-
template_spec = Pod::Specification.from_file(template_spec_file)
|
97
|
-
end
|
98
|
-
create_binary_spec_file(code_spec, template_spec)
|
99
|
-
else
|
100
|
-
code_spec_files.first
|
101
|
-
end
|
102
|
-
spec_file
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def repo
|
108
|
-
@binary ? binary_source.name : code_source.name
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|