cocoapods-bb-bin 0.1.8 → 0.1.8.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/repo/push.rb +1 -0
- data/lib/cocoapods-bb-bin/gem_version.rb +1 -1
- data/lib/cocoapods-bb-bin/native/push.rb +3 -2
- data/lib/cocoapods-bb-bin/native/validator.rb +151 -0
- data/lib/cocoapods-bb-bin/native.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ed14a53820238e12852776bab7bbd9229b2dae2fc38a78b41c4998dbcc58261
|
4
|
+
data.tar.gz: 0bb09aed068cafaa633dd1bc0d84a545f5c2e0ccea091833b01ce04bc7e69780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3491aafbd2c3aca48bdf526a861b491b67e4dcd544cf2d39c9215b98e366fda139aed77f93000d4b821c5b778b91de5acb5a25a9d91ac6e531fffb635df89e5
|
7
|
+
data.tar.gz: a5cf6d9fcb8f22206d9951cd7bb15e611c7b1c38efe1ab8665ca1ad1af8431913776a0ee7c049ac5d81e7013c361cb29303811c5f1615fa89db75b1498d02f06
|
@@ -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
|
|
@@ -27,14 +27,15 @@ module Pod
|
|
27
27
|
@skip_tests = argv.flag?('skip-tests', false)
|
28
28
|
@allow_overwrite = argv.flag?('overwrite', true)
|
29
29
|
super
|
30
|
+
@use_cocoapods_validator = argv.flag?('use_cocoapods_validator', false)# 配置参数cocoapods进行验证,内部进行hook,二进制hook,源码cocoapods进行验证
|
30
31
|
end
|
31
32
|
|
32
33
|
# Performs a full lint against the podspecs.
|
33
34
|
#
|
34
35
|
def validate_podspec_files
|
35
|
-
UI.puts "\
|
36
|
+
UI.puts "\nbin Validating #{'spec'.pluralize(count)}".yellow
|
36
37
|
podspec_files.each do |podspec|
|
37
|
-
validator = Validator.new(podspec, @source_urls)
|
38
|
+
validator = Validator.new(podspec, @source_urls, [], @use_cocoapods_validator)
|
38
39
|
validator.allow_warnings = @allow_warnings
|
39
40
|
validator.use_frameworks = @use_frameworks
|
40
41
|
validator.use_static_frameworks = @use_static_frameworks
|
@@ -0,0 +1,151 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Validator
|
5
|
+
# @return [Boolean] 使用cocoapods进行验证,二进制库推送默认不采用cocoapods(1.11.2)验证
|
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
|
+
|
32
|
+
# Perform analysis for a given spec (or subspec)
|
33
|
+
#
|
34
|
+
def perform_extensive_analysis(spec)
|
35
|
+
if @use_cocoapods_validator
|
36
|
+
return cocoapods_perform_extensive_analysis(spec)
|
37
|
+
end
|
38
|
+
return true
|
39
|
+
end
|
40
|
+
|
41
|
+
#覆盖
|
42
|
+
def check_file_patterns
|
43
|
+
if @use_cocoapods_validator
|
44
|
+
cocoapods_check_file_patterns
|
45
|
+
return
|
46
|
+
end
|
47
|
+
# 二进制验证部分
|
48
|
+
FILE_PATTERNS.each do |attr_name|
|
49
|
+
next if %i(source_files resources).include? attr_name
|
50
|
+
if respond_to?("_validate_#{attr_name}", true)
|
51
|
+
send("_validate_#{attr_name}")
|
52
|
+
else
|
53
|
+
validate_nonempty_patterns(attr_name, :error)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
_validate_header_mappings_dir
|
58
|
+
if consumer.spec.root?
|
59
|
+
_validate_license
|
60
|
+
_validate_module_map
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
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
|
+
|
150
|
+
end
|
151
|
+
end
|
@@ -12,7 +12,7 @@ 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
|
-
|
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'
|
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.8
|
4
|
+
version: 0.1.8.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-
|
11
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/cocoapods-bb-bin/native/sources_manager.rb
|
174
174
|
- lib/cocoapods-bb-bin/native/specification.rb
|
175
175
|
- lib/cocoapods-bb-bin/native/target_validator.rb
|
176
|
+
- lib/cocoapods-bb-bin/native/validator.rb
|
176
177
|
- lib/cocoapods-bb-bin/source_provider_hook.rb
|
177
178
|
- lib/cocoapods_plugin.rb
|
178
179
|
- spec/command/bin_spec.rb
|