cocoapods-bin 0.1.24 → 0.1.25
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/Gemfile.lock +2 -2
- data/lib/cocoapods-bin.rb +3 -1
- data/lib/cocoapods-bin/command.rb +2 -0
- data/lib/cocoapods-bin/command/bin.rb +4 -2
- data/lib/cocoapods-bin/command/bin/archive.rb +21 -15
- data/lib/cocoapods-bin/command/bin/init.rb +14 -9
- data/lib/cocoapods-bin/command/bin/lib.rb +3 -1
- data/lib/cocoapods-bin/command/bin/lib/lint.rb +13 -9
- data/lib/cocoapods-bin/command/bin/list.rb +16 -12
- data/lib/cocoapods-bin/command/bin/open.rb +10 -8
- data/lib/cocoapods-bin/command/bin/repo.rb +3 -1
- data/lib/cocoapods-bin/command/bin/repo/push.rb +22 -14
- data/lib/cocoapods-bin/command/bin/repo/update.rb +6 -4
- data/lib/cocoapods-bin/command/bin/search.rb +9 -7
- data/lib/cocoapods-bin/command/bin/spec.rb +3 -1
- data/lib/cocoapods-bin/command/bin/spec/create.rb +15 -8
- data/lib/cocoapods-bin/command/bin/spec/lint.rb +18 -10
- data/lib/cocoapods-bin/command/bin/umbrella.rb +13 -7
- data/lib/cocoapods-bin/config/config.rb +18 -14
- data/lib/cocoapods-bin/config/config_asker.rb +22 -19
- data/lib/cocoapods-bin/gem_version.rb +5 -3
- data/lib/cocoapods-bin/helpers.rb +2 -0
- data/lib/cocoapods-bin/helpers/framework.rb +5 -3
- data/lib/cocoapods-bin/helpers/framework_builder.rb +31 -24
- data/lib/cocoapods-bin/helpers/sources_helper.rb +6 -4
- data/lib/cocoapods-bin/helpers/spec_creator.rb +28 -18
- data/lib/cocoapods-bin/helpers/spec_files_helper.rb +28 -15
- data/lib/cocoapods-bin/native.rb +16 -14
- data/lib/cocoapods-bin/native/acknowledgements.rb +5 -2
- data/lib/cocoapods-bin/native/analyzer.rb +6 -5
- data/lib/cocoapods-bin/native/installation_options.rb +13 -11
- data/lib/cocoapods-bin/native/installer.rb +54 -47
- data/lib/cocoapods-bin/native/linter.rb +4 -2
- data/lib/cocoapods-bin/native/path_source.rb +9 -7
- data/lib/cocoapods-bin/native/pod_source_installer.rb +10 -6
- data/lib/cocoapods-bin/native/podfile.rb +11 -7
- data/lib/cocoapods-bin/native/podfile_env.rb +11 -9
- data/lib/cocoapods-bin/native/podspec_finder.rb +3 -0
- data/lib/cocoapods-bin/native/resolver.rb +65 -45
- data/lib/cocoapods-bin/native/sandbox_analyzer.rb +27 -25
- data/lib/cocoapods-bin/native/source.rb +7 -4
- data/lib/cocoapods-bin/native/sources_manager.rb +11 -9
- data/lib/cocoapods-bin/native/specification.rb +14 -12
- data/lib/cocoapods-bin/native/validator.rb +3 -3
- data/lib/cocoapods-bin/source_provider_hook.rb +12 -8
- data/lib/cocoapods_plugin.rb +2 -0
- metadata +3 -3
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# copy from https://github.com/CocoaPods/cocoapods-packager
|
2
4
|
|
3
5
|
module CBin
|
4
|
-
|
6
|
+
class Framework
|
5
7
|
attr_reader :headers_path
|
6
8
|
attr_reader :module_map_path
|
7
9
|
attr_reader :resources_path
|
@@ -58,5 +60,5 @@ module CBin
|
|
58
60
|
@root_path = Pathname.new(@platform)
|
59
61
|
@root_path.mkpath unless @root_path.exist?
|
60
62
|
end
|
61
|
-
|
62
|
-
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# copy from https://github.com/CocoaPods/cocoapods-packager
|
2
4
|
|
3
5
|
require 'cocoapods-bin/helpers/framework.rb'
|
4
6
|
|
5
7
|
module CBin
|
6
|
-
|
8
|
+
class Framework
|
7
9
|
class Builder
|
8
10
|
include Pod
|
9
11
|
|
10
|
-
def initialize(spec, file_accessor, platform, source_dir)
|
12
|
+
def initialize(spec, file_accessor, platform, source_dir)
|
11
13
|
@spec = spec
|
12
14
|
@source_dir = source_dir
|
13
15
|
@file_accessor = file_accessor
|
@@ -16,7 +18,7 @@ module CBin
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def build
|
19
|
-
UI.section("Building static framework #{@spec}") do
|
21
|
+
UI.section("Building static framework #{@spec}") do
|
20
22
|
defines = compile
|
21
23
|
|
22
24
|
build_sim_libraries(defines)
|
@@ -29,15 +31,15 @@ module CBin
|
|
29
31
|
|
30
32
|
cp_to_source_dir
|
31
33
|
end
|
32
|
-
end
|
34
|
+
end
|
33
35
|
|
34
36
|
private
|
35
37
|
|
36
38
|
def cp_to_source_dir
|
37
|
-
target_dir = "#{@source_dir}/#{@spec.name}.framework"
|
39
|
+
target_dir = "#{@source_dir}/#{@spec.name}.framework"
|
38
40
|
FileUtils.rm_rf(target_dir) if File.exist?(target_dir)
|
39
41
|
|
40
|
-
`cp -fa #{@platform
|
42
|
+
`cp -fa #{@platform}/#{@spec.name}.framework #{@source_dir}`
|
41
43
|
end
|
42
44
|
|
43
45
|
def build_sim_libraries(defines)
|
@@ -49,8 +51,8 @@ module CBin
|
|
49
51
|
public_headers = @file_accessor.public_headers
|
50
52
|
UI.message "Copying public headers #{public_headers.map(&:basename).map(&:to_s)}"
|
51
53
|
|
52
|
-
public_headers.each do |h|
|
53
|
-
`ditto #{h} #{framework.headers_path}/#{h.basename}`
|
54
|
+
public_headers.each do |h|
|
55
|
+
`ditto #{h} #{framework.headers_path}/#{h.basename}`
|
54
56
|
end
|
55
57
|
|
56
58
|
# If custom 'module_map' is specified add it to the framework distribution
|
@@ -58,7 +60,9 @@ module CBin
|
|
58
60
|
# create a default 'module_map' one using it.
|
59
61
|
if !@spec.module_map.nil?
|
60
62
|
module_map_file = @file_accessor.module_map
|
61
|
-
|
63
|
+
if Pathname(module_map_file).exist?
|
64
|
+
module_map = File.read(module_map_file)
|
65
|
+
end
|
62
66
|
elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}.h")
|
63
67
|
module_map = <<-MAP
|
64
68
|
framework module #{@spec.name} {
|
@@ -72,26 +76,28 @@ module CBin
|
|
72
76
|
|
73
77
|
unless module_map.nil?
|
74
78
|
UI.message "Writing module map #{module_map}"
|
75
|
-
|
79
|
+
unless framework.module_map_path.exist?
|
80
|
+
framework.module_map_path.mkpath
|
81
|
+
end
|
76
82
|
File.write("#{framework.module_map_path}/module.modulemap", module_map)
|
77
83
|
end
|
78
84
|
end
|
79
85
|
|
80
86
|
def copy_license
|
81
|
-
UI.message
|
87
|
+
UI.message 'Copying license'
|
82
88
|
license_file = @spec.license[:file] || 'LICENSE'
|
83
89
|
`cp "#{license_file}" .` if Pathname(license_file).exist?
|
84
90
|
end
|
85
91
|
|
86
92
|
def copy_resources
|
87
|
-
bundles = Dir.glob(
|
93
|
+
bundles = Dir.glob('./build/*.bundle')
|
88
94
|
|
89
95
|
bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
|
90
96
|
consumer = spec.consumer(@platform)
|
91
97
|
consumer.resource_bundles.keys +
|
92
|
-
|
93
|
-
|
94
|
-
|
98
|
+
consumer.resources.map do |r|
|
99
|
+
File.basename(r, '.bundle') if File.extname(r) == 'bundle'
|
100
|
+
end
|
95
101
|
end.compact.uniq
|
96
102
|
|
97
103
|
bundles.select! do |bundle|
|
@@ -140,7 +146,7 @@ module CBin
|
|
140
146
|
end
|
141
147
|
|
142
148
|
def ios_architectures
|
143
|
-
archs = %w
|
149
|
+
archs = %w[x86_64 arm64 armv7 armv7s i386]
|
144
150
|
@vendored_libraries.each do |library|
|
145
151
|
archs = `lipo -info #{library}`.split & archs
|
146
152
|
end
|
@@ -149,7 +155,8 @@ module CBin
|
|
149
155
|
|
150
156
|
def compile
|
151
157
|
defines = "GCC_PREPROCESSOR_DEFINITIONS='$(inherited)'"
|
152
|
-
defines
|
158
|
+
defines += ' '
|
159
|
+
defines += @spec.consumer(@platform).compiler_flags.join(' ')
|
153
160
|
|
154
161
|
options = ios_build_options
|
155
162
|
xcodebuild(defines, options)
|
@@ -170,10 +177,10 @@ module CBin
|
|
170
177
|
output = `#{command}`.lines.to_a
|
171
178
|
|
172
179
|
if $?.exitstatus != 0
|
173
|
-
raise
|
174
|
-
Build command failed: #{command}
|
175
|
-
Output:
|
176
|
-
#{output.map { |line| " #{line}" }.join}
|
180
|
+
raise <<~EOF
|
181
|
+
Build command failed: #{command}
|
182
|
+
Output:
|
183
|
+
#{output.map { |line| " #{line}" }.join}
|
177
184
|
EOF
|
178
185
|
|
179
186
|
Process.exit
|
@@ -187,12 +194,12 @@ Output:
|
|
187
194
|
end
|
188
195
|
|
189
196
|
def framework
|
190
|
-
@framework ||= begin
|
197
|
+
@framework ||= begin
|
191
198
|
framework = Framework.new(@spec.name, @platform.name.to_s)
|
192
199
|
framework.make
|
193
200
|
framework
|
194
201
|
end
|
195
202
|
end
|
196
203
|
end
|
197
|
-
|
198
|
-
end
|
204
|
+
end
|
205
|
+
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods-bin/native/sources_manager.rb'
|
2
4
|
|
3
5
|
module CBin
|
4
|
-
|
6
|
+
module SourcesHelper
|
5
7
|
def sources_manager
|
6
8
|
Pod::Config.instance.sources_manager
|
7
9
|
end
|
@@ -24,8 +26,8 @@ module CBin
|
|
24
26
|
sources
|
25
27
|
end
|
26
28
|
|
27
|
-
def sources_option(code_dependencies, additional_sources)
|
29
|
+
def sources_option(code_dependencies, additional_sources)
|
28
30
|
(valid_sources(code_dependencies).map(&:url) + Array(additional_sources)).join(',')
|
29
31
|
end
|
30
|
-
|
31
|
-
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods'
|
2
4
|
require 'cocoapods-bin/config/config'
|
3
5
|
|
@@ -8,22 +10,24 @@ module CBin
|
|
8
10
|
attr_reader :template_spec
|
9
11
|
attr_reader :spec
|
10
12
|
|
11
|
-
def initialize(code_spec, template_spec, platforms = 'ios')
|
13
|
+
def initialize(code_spec, template_spec, platforms = 'ios')
|
12
14
|
@code_spec = code_spec
|
13
15
|
@template_spec = template_spec
|
14
16
|
@platforms = Array(platforms)
|
15
|
-
validate!
|
17
|
+
validate!
|
16
18
|
end
|
17
19
|
|
18
20
|
def validate!
|
19
|
-
raise Pod::Informative,
|
20
|
-
|
21
|
+
raise Pod::Informative, '源码 podspec 不能为空 .' unless code_spec
|
22
|
+
if code_spec.subspecs.any? && template_spec.nil?
|
23
|
+
raise Pod::Informative, "不支持自动生成存在 subspec 的二进制 podspec , 需要提供模版文件 #{code_spec.name}.binary.podspec.template ."
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
def create
|
24
28
|
spec = template_spec ? create_from_code_spec_and_template_spec : create_from_code_spec
|
25
29
|
|
26
|
-
Pod::UI.message
|
30
|
+
Pod::UI.message '生成二进制 podspec 内容: '
|
27
31
|
spec.to_pretty_json.split("\n").each do |text|
|
28
32
|
Pod::UI.message text
|
29
33
|
end
|
@@ -38,15 +42,15 @@ module CBin
|
|
38
42
|
f.write(spec.to_pretty_json)
|
39
43
|
end
|
40
44
|
|
41
|
-
@filename = file
|
45
|
+
@filename = file
|
42
46
|
end
|
43
47
|
|
44
48
|
def clear_spec_file
|
45
49
|
File.delete(filename) if File.exist?(filename)
|
46
50
|
end
|
47
51
|
|
48
|
-
def filename
|
49
|
-
@filename ||= "#{spec.name}.binary.podspec.json"
|
52
|
+
def filename
|
53
|
+
@filename ||= "#{spec.name}.binary.podspec.json"
|
50
54
|
end
|
51
55
|
|
52
56
|
private
|
@@ -62,8 +66,12 @@ module CBin
|
|
62
66
|
# Resources
|
63
67
|
extnames = []
|
64
68
|
extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
|
65
|
-
|
66
|
-
|
69
|
+
if code_spec_consumer.resources.any?
|
70
|
+
extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
|
71
|
+
end
|
72
|
+
if extnames.any?
|
73
|
+
@spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
|
74
|
+
end
|
67
75
|
|
68
76
|
# Source Location
|
69
77
|
@spec.source = binary_source
|
@@ -72,7 +80,7 @@ module CBin
|
|
72
80
|
@spec.source_files = framework_contents('Headers/*')
|
73
81
|
@spec.public_header_files = framework_contents('Headers/*')
|
74
82
|
|
75
|
-
# Unused for binary
|
83
|
+
# Unused for binary
|
76
84
|
spec_hash = @spec.to_hash
|
77
85
|
# spec_hash.delete('license')
|
78
86
|
spec_hash.delete('resource_bundles')
|
@@ -85,14 +93,16 @@ module CBin
|
|
85
93
|
# spec_hash.delete('vendored_libraries')
|
86
94
|
# libraries 只能假设为动态库不做处理了,如果有例外,需要开发者自行处理
|
87
95
|
vendored_libraries = spec_hash.delete('vendored_libraries')
|
88
|
-
vendored_libraries = Array(vendored_libraries).reject { |l| l.end_with?('.a') }
|
89
|
-
|
96
|
+
vendored_libraries = Array(vendored_libraries).reject { |l| l.end_with?('.a') }
|
97
|
+
if vendored_libraries.any?
|
98
|
+
spec_hash['vendored_libraries'] = vendored_libraries
|
99
|
+
end
|
90
100
|
|
91
101
|
# Filter platforms
|
92
102
|
platforms = spec_hash['platforms']
|
93
|
-
selected_platforms = platforms.select { |k,
|
103
|
+
selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
|
94
104
|
spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
|
95
|
-
|
105
|
+
|
96
106
|
@spec = Pod::Specification.from_hash(spec_hash)
|
97
107
|
@spec
|
98
108
|
end
|
@@ -106,10 +116,10 @@ module CBin
|
|
106
116
|
end
|
107
117
|
|
108
118
|
def binary_source
|
109
|
-
{ http: CBin.config.binary_download_url
|
119
|
+
{ http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
|
110
120
|
end
|
111
121
|
|
112
|
-
def code_spec_consumer(
|
122
|
+
def code_spec_consumer(_platform = :ios)
|
113
123
|
code_spec.consumer(:ios)
|
114
124
|
end
|
115
125
|
|
@@ -118,4 +128,4 @@ module CBin
|
|
118
128
|
end
|
119
129
|
end
|
120
130
|
end
|
121
|
-
end
|
131
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods-bin/native/sources_manager.rb'
|
2
4
|
require 'cocoapods-bin/helpers/spec_creator'
|
3
5
|
|
4
6
|
module CBin
|
5
|
-
|
7
|
+
module SpecFilesHelper
|
6
8
|
def spec_files
|
7
9
|
@spec_files ||= Pathname.glob('*.podspec{,.json}')
|
8
10
|
end
|
@@ -13,32 +15,39 @@ module CBin
|
|
13
15
|
|
14
16
|
def binary_template_spec_files
|
15
17
|
@binary_spec_template_files ||= Pathname.glob('*.binary-template.podspec{,.json}')
|
16
|
-
end
|
18
|
+
end
|
17
19
|
|
18
20
|
def binary_template_spec_file
|
19
21
|
@binary_spec_template_file ||= binary_template_spec_files.first
|
20
|
-
end
|
22
|
+
end
|
21
23
|
|
22
24
|
def code_spec_files
|
23
25
|
@code_spec_files ||= spec_files - binary_spec_files - binary_template_spec_files
|
24
26
|
end
|
25
27
|
|
26
|
-
def code_spec
|
27
|
-
|
28
|
+
def code_spec
|
29
|
+
if code_spec_files.first
|
30
|
+
Pod::Specification.from_file(code_spec_files.first)
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
|
-
def binary_spec
|
31
|
-
|
34
|
+
def binary_spec
|
35
|
+
if binary_spec_files.first
|
36
|
+
Pod::Specification.from_file(binary_spec_files.first)
|
37
|
+
end
|
32
38
|
end
|
33
39
|
|
34
40
|
def binary_template_spec
|
35
|
-
|
36
|
-
|
41
|
+
if binary_template_spec_file
|
42
|
+
Pod::Specification.from_file(binary_template_spec_file)
|
43
|
+
end
|
44
|
+
end
|
37
45
|
|
38
46
|
def find_spec_file(podspec)
|
39
47
|
path = Pathname(podspec)
|
40
48
|
raise Pod::Informative, "无法找到 #{podspec}" unless path.exist?
|
41
|
-
|
49
|
+
|
50
|
+
path
|
42
51
|
end
|
43
52
|
|
44
53
|
def create_binary_spec_file(code_spec, template_spec)
|
@@ -48,8 +57,12 @@ module CBin
|
|
48
57
|
# 1.2.1 有,根据 template spec 生成
|
49
58
|
# 1.2.2 没有,根据 code spec 生成
|
50
59
|
|
51
|
-
|
52
|
-
|
60
|
+
unless code_spec
|
61
|
+
raise Pod::Informative, '没有二进制 podspec 的情况下,必须要提供源码 podspec.'
|
62
|
+
end
|
63
|
+
if code_spec.subspecs.any? && template_spec.nil?
|
64
|
+
raise Pod::Informative, '拥有 subspec 的组件,在生成二进制 podspec 时,必须要提供模版 podspec.'
|
65
|
+
end
|
53
66
|
|
54
67
|
@spec_creator = CBin::Specification::Creator.new(code_spec, template_spec)
|
55
68
|
@spec_creator.create
|
@@ -58,7 +71,7 @@ module CBin
|
|
58
71
|
end
|
59
72
|
|
60
73
|
def clear_binary_spec_file_if_needed
|
61
|
-
|
74
|
+
@spec_creator&.clear_spec_file
|
62
75
|
end
|
63
|
-
|
64
|
-
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/cocoapods-bin/native.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods'
|
2
4
|
|
3
5
|
if Pod.match_version?('~> 1.4')
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
require 'cocoapods-bin/native/podfile'
|
7
|
+
require 'cocoapods-bin/native/installation_options'
|
8
|
+
require 'cocoapods-bin/native/specification'
|
9
|
+
require 'cocoapods-bin/native/path_source'
|
10
|
+
require 'cocoapods-bin/native/analyzer'
|
11
|
+
require 'cocoapods-bin/native/installer'
|
12
|
+
require 'cocoapods-bin/native/pod_source_installer'
|
13
|
+
require 'cocoapods-bin/native/linter'
|
14
|
+
require 'cocoapods-bin/native/resolver'
|
15
|
+
require 'cocoapods-bin/native/source'
|
16
|
+
require 'cocoapods-bin/native/validator'
|
17
|
+
require 'cocoapods-bin/native/acknowledgements'
|
18
|
+
require 'cocoapods-bin/native/sandbox_analyzer'
|
19
|
+
require 'cocoapods-bin/native/podspec_finder'
|
18
20
|
end
|
@@ -1,8 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
module Generator
|
3
5
|
class Acknowledgements
|
4
|
-
|
6
|
+
def license_text(spec)
|
5
7
|
return nil unless spec.license
|
8
|
+
|
6
9
|
text = spec.license[:text]
|
7
10
|
unless text
|
8
11
|
if license_file = spec.license[:file]
|
@@ -21,4 +24,4 @@ module Pod
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
24
|
-
end
|
27
|
+
end
|