pod-builder 5.1.0 → 5.1.2
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 +1 -1
- data/exe/pod_builder +105 -77
- data/lib/pod_builder/command/build.rb +41 -41
- data/lib/pod_builder/command/build_swiftmodules.rb +123 -0
- data/lib/pod_builder/command/init.rb +16 -16
- data/lib/pod_builder/command.rb +16 -15
- data/lib/pod_builder/configuration.rb +42 -34
- data/lib/pod_builder/install.rb +92 -90
- data/lib/pod_builder/podfile.rb +66 -59
- data/lib/pod_builder/podfile_item.rb +52 -52
- data/lib/pod_builder/rome/post_install.rb +152 -120
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- metadata +4 -3
@@ -22,7 +22,7 @@ module PodBuilder
|
|
22
22
|
# @return [String] The name of the pod, which might be the subspec name if appicable
|
23
23
|
#
|
24
24
|
attr_reader :name
|
25
|
-
|
25
|
+
|
26
26
|
# @return [String] The pinned tag of the pod, if any
|
27
27
|
#
|
28
28
|
attr_reader :tag
|
@@ -46,15 +46,15 @@ module PodBuilder
|
|
46
46
|
# @return [String] The pinned commit of the pod, if any
|
47
47
|
#
|
48
48
|
attr_reader :commit
|
49
|
-
|
49
|
+
|
50
50
|
# @return [String] The module name
|
51
51
|
#
|
52
52
|
attr_reader :module_name
|
53
|
-
|
53
|
+
|
54
54
|
# @return [String] The swift version if applicable
|
55
55
|
#
|
56
56
|
attr_reader :swift_version
|
57
|
-
|
57
|
+
|
58
58
|
# @return [Array<String>] The pod's dependency names, if any. Use dependencies() to get the [Array<PodfileItem>]
|
59
59
|
#
|
60
60
|
attr_reader :dependency_names
|
@@ -62,11 +62,11 @@ module PodBuilder
|
|
62
62
|
# @return [Array<String>] The pod's external dependency names (excluding subspecs), if any
|
63
63
|
#
|
64
64
|
attr_reader :external_dependency_names
|
65
|
-
|
65
|
+
|
66
66
|
# @return [Bool] True if the pod is shipped as a static binary
|
67
67
|
#
|
68
68
|
attr_reader :is_static
|
69
|
-
|
69
|
+
|
70
70
|
# @return [Array<Hash>] The pod's xcconfig configuration
|
71
71
|
#
|
72
72
|
attr_reader :xcconfig
|
@@ -146,7 +146,7 @@ module PodBuilder
|
|
146
146
|
# @return [Bool] True if warnings should be inhibited for the pod
|
147
147
|
#
|
148
148
|
attr_accessor :inhibit_warnings
|
149
|
-
|
149
|
+
|
150
150
|
# Initialize a new instance
|
151
151
|
#
|
152
152
|
# @param [Specification] spec
|
@@ -166,7 +166,7 @@ module PodBuilder
|
|
166
166
|
@tag = checkout_options[opts_key][:tag]
|
167
167
|
@commit = checkout_options[opts_key][:commit]
|
168
168
|
@path = checkout_options[opts_key][:path]
|
169
|
-
@podspec_path = checkout_options[opts_key][:podspec]
|
169
|
+
@podspec_path = checkout_options[opts_key][:podspec]
|
170
170
|
@branch = checkout_options[opts_key][:branch]
|
171
171
|
@is_external = true
|
172
172
|
else
|
@@ -174,13 +174,13 @@ module PodBuilder
|
|
174
174
|
@tag = spec.root.source[:tag]
|
175
175
|
@commit = spec.root.source[:commit]
|
176
176
|
@is_external = false
|
177
|
-
end
|
177
|
+
end
|
178
178
|
|
179
179
|
@defines_module = nil # nil is not specified
|
180
180
|
if override = spec.attributes_hash.dig("pod_target_xcconfig", "DEFINES_MODULE")
|
181
181
|
@defines_module = (override == "YES")
|
182
182
|
end
|
183
|
-
|
183
|
+
|
184
184
|
@vendored_frameworks = extract_vendored_frameworks(spec, all_specs)
|
185
185
|
@vendored_libraries = extract_vendored_libraries(spec, all_specs)
|
186
186
|
|
@@ -190,21 +190,21 @@ module PodBuilder
|
|
190
190
|
|
191
191
|
@frameworks += extract_array(spec.attributes_hash, "framework")
|
192
192
|
@frameworks += extract_array(spec.attributes_hash, "frameworks")
|
193
|
-
supported_platforms.each do |platform|
|
193
|
+
supported_platforms.each do |platform|
|
194
194
|
@frameworks += extract_array(spec.attributes_hash[platform], "framework")
|
195
195
|
@frameworks += extract_array(spec.attributes_hash[platform], "frameworks")
|
196
|
-
end
|
197
|
-
|
196
|
+
end
|
197
|
+
|
198
198
|
@weak_frameworks += extract_array(spec.attributes_hash, "weak_framework")
|
199
|
-
@weak_frameworks += extract_array(spec.attributes_hash, "weak_frameworks")
|
200
|
-
supported_platforms.each do |platform|
|
199
|
+
@weak_frameworks += extract_array(spec.attributes_hash, "weak_frameworks")
|
200
|
+
supported_platforms.each do |platform|
|
201
201
|
@weak_frameworks += extract_array(spec.attributes_hash[platform], "weak_framework")
|
202
202
|
@weak_frameworks += extract_array(spec.attributes_hash[platform], "weak_frameworks")
|
203
203
|
end
|
204
204
|
|
205
205
|
@libraries += extract_array(spec.attributes_hash, "library")
|
206
|
-
@libraries += extract_array(spec.attributes_hash, "libraries")
|
207
|
-
supported_platforms.each do |platform|
|
206
|
+
@libraries += extract_array(spec.attributes_hash, "libraries")
|
207
|
+
supported_platforms.each do |platform|
|
208
208
|
@libraries += extract_array(spec.attributes_hash[platform], "library")
|
209
209
|
@libraries += extract_array(spec.attributes_hash[platform], "libraries")
|
210
210
|
end
|
@@ -213,26 +213,26 @@ module PodBuilder
|
|
213
213
|
|
214
214
|
@version = spec.root.version.version
|
215
215
|
@available_versions = spec.respond_to?(:spec_source) ? spec.spec_source.versions(@root_name)&.map(&:to_s) : [@version]
|
216
|
-
|
216
|
+
|
217
217
|
@swift_version = spec.root.swift_version&.to_s
|
218
218
|
@module_name = spec.root.module_name
|
219
219
|
|
220
220
|
@default_subspecs = extract_array(spec.attributes_hash, "default_subspecs")
|
221
221
|
if default_subspec = spec.attributes_hash["default_subspec"]
|
222
|
-
@default_subspecs.push(default_subspec)
|
222
|
+
@default_subspecs.push(default_subspec)
|
223
223
|
end
|
224
224
|
|
225
225
|
if @name == @root_name && @default_subspecs.empty?
|
226
226
|
@default_subspecs += all_specs.select { |t| t.name.include?("/") && t.name.split("/").first == @root_name }.map { |t| t.name.split("/").last }
|
227
227
|
end
|
228
228
|
|
229
|
-
@dependency_names = spec.attributes_hash.fetch("dependencies", {}).keys + default_subspecs.map { |t| "#{@root_name}/#{t}" }
|
230
|
-
supported_platforms.each do |platform|
|
229
|
+
@dependency_names = spec.attributes_hash.fetch("dependencies", {}).keys + default_subspecs.map { |t| "#{@root_name}/#{t}" }
|
230
|
+
supported_platforms.each do |platform|
|
231
231
|
@dependency_names += (spec.attributes_hash.dig(platform, "dependencies") || {}).keys
|
232
232
|
end
|
233
233
|
@dependency_names.uniq!
|
234
234
|
|
235
|
-
@external_dependency_names = @dependency_names.select { |t| !t.start_with?(root_name)
|
235
|
+
@external_dependency_names = @dependency_names.select { |t| !t.start_with?(root_name) }
|
236
236
|
|
237
237
|
@is_static = spec.root.attributes_hash["static_framework"] || false
|
238
238
|
@xcconfig = spec.root.attributes_hash["xcconfig"] || {}
|
@@ -244,20 +244,20 @@ module PodBuilder
|
|
244
244
|
end
|
245
245
|
|
246
246
|
default_subspecs_specs ||= begin
|
247
|
-
|
248
|
-
|
249
|
-
|
247
|
+
subspecs = all_specs.select { |t| t.name.split("/").first == @root_name }
|
248
|
+
subspecs.select { |t| @default_subspecs.include?(t.name.split("/").last) }
|
249
|
+
end
|
250
250
|
root_spec = all_specs.detect { |t| t.name == @root_name } || spec
|
251
251
|
@source_files = source_files_from([spec, root_spec] + default_subspecs_specs)
|
252
|
-
|
252
|
+
|
253
253
|
@build_configuration = spec.root.attributes_hash.dig("pod_target_xcconfig", "prebuild_configuration") || "release"
|
254
254
|
@build_configuration.downcase!
|
255
255
|
|
256
256
|
default_license = "MIT"
|
257
|
-
@license = spec.root.attributes_hash.fetch("license", {"type"=>"#{default_license}"})["type"] || default_license
|
257
|
+
@license = spec.root.attributes_hash.fetch("license", { "type" => "#{default_license}" })["type"] || default_license
|
258
258
|
@summary = spec.root.attributes_hash.fetch("summary", "A summary for #{@name}")
|
259
|
-
@source = spec.root.attributes_hash.fetch("source", { "git"=>"https://github.com/Subito-it/PodBuilder.git" })
|
260
|
-
@authors = spec.root.attributes_hash.fetch("authors", {"PodBuilder"=>"pod@podbuilder.com"})
|
259
|
+
@source = spec.root.attributes_hash.fetch("source", { "git" => "https://github.com/Subito-it/PodBuilder.git" })
|
260
|
+
@authors = spec.root.attributes_hash.fetch("authors", { "PodBuilder" => "pod@podbuilder.com" })
|
261
261
|
@homepage = spec.root.attributes_hash.fetch("homepage", "https://github.com/Subito-it/PodBuilder")
|
262
262
|
|
263
263
|
if Configuration.build_xcframeworks_all
|
@@ -302,13 +302,13 @@ module PodBuilder
|
|
302
302
|
|
303
303
|
spec_raw["dependencies"] = @dependency_names.map { |x| [x, []] }.to_h
|
304
304
|
|
305
|
-
spec = Pod::Specification.from_hash(spec_raw, parent_spec)
|
305
|
+
spec = Pod::Specification.from_hash(spec_raw, parent_spec)
|
306
306
|
all_subspec_items = all_poditems.select { |x| x.is_subspec && x.root_name == @name }
|
307
307
|
spec.subspecs = all_subspec_items.map { |x| x.pod_specification(all_poditems, spec) }
|
308
308
|
|
309
309
|
return spec
|
310
310
|
end
|
311
|
-
|
311
|
+
|
312
312
|
def inspect
|
313
313
|
return "#{@name} repo=#{@repo} pinned=#{@tag || @commit} is_static=#{@is_static} deps=#{@dependencies || "[]"}"
|
314
314
|
end
|
@@ -325,8 +325,8 @@ module PodBuilder
|
|
325
325
|
names = [name]
|
326
326
|
|
327
327
|
deps = []
|
328
|
-
last_count = -1
|
329
|
-
while deps.count != last_count
|
328
|
+
last_count = -1
|
329
|
+
while deps.count != last_count
|
330
330
|
last_count = deps.count
|
331
331
|
|
332
332
|
updated_names = []
|
@@ -336,20 +336,20 @@ module PodBuilder
|
|
336
336
|
updated_names += pod.dependency_names
|
337
337
|
end
|
338
338
|
end
|
339
|
-
|
339
|
+
|
340
340
|
names = updated_names.uniq
|
341
341
|
|
342
|
-
deps.uniq!
|
342
|
+
deps.uniq!
|
343
343
|
end
|
344
344
|
|
345
345
|
root_names = deps.map(&:root_name).uniq
|
346
346
|
|
347
347
|
# We need to build all other common subspecs to properly build the item
|
348
|
-
# Ex.
|
348
|
+
# Ex.
|
349
349
|
# PodA depends on DepA/subspec1
|
350
350
|
# PodB depends on DepA/subspec2
|
351
351
|
#
|
352
|
-
# When building PodA we need to build both DepA subspecs because they might
|
352
|
+
# When building PodA we need to build both DepA subspecs because they might
|
353
353
|
# contain different code
|
354
354
|
deps += available_pods.select { |t| root_names.include?(t.root_name) && t.root_name != t.name }
|
355
355
|
|
@@ -386,25 +386,25 @@ module PodBuilder
|
|
386
386
|
|
387
387
|
if is_external
|
388
388
|
if @path
|
389
|
-
e += ", :path => '#{@path}'"
|
389
|
+
e += ", :path => '#{@path}'"
|
390
390
|
elsif @podspec_path
|
391
|
-
e += ", :podspec => '#{@podspec_path}'"
|
391
|
+
e += ", :podspec => '#{@podspec_path}'"
|
392
392
|
else
|
393
393
|
if @repo
|
394
|
-
e += ", :git => '#{@repo}'"
|
394
|
+
e += ", :git => '#{@repo}'"
|
395
395
|
end
|
396
396
|
if @tag
|
397
397
|
e += ", :tag => '#{@tag}'"
|
398
398
|
end
|
399
399
|
if @commit
|
400
|
-
e += ", :commit => '#{@commit}'"
|
400
|
+
e += ", :commit => '#{@commit}'"
|
401
401
|
end
|
402
402
|
if @branch
|
403
|
-
e += ", :branch => '#{@branch}'"
|
403
|
+
e += ", :branch => '#{@branch}'"
|
404
404
|
end
|
405
405
|
end
|
406
406
|
else
|
407
|
-
e += ", '=#{@version}'"
|
407
|
+
e += ", '=#{@version}'"
|
408
408
|
end
|
409
409
|
|
410
410
|
e += e_suffix
|
@@ -415,7 +415,7 @@ module PodBuilder
|
|
415
415
|
data = JSON.parse(File.read(prebuilt_info_path))
|
416
416
|
swift_version = data["swift_version"]
|
417
417
|
is_static = data["is_static"] || false
|
418
|
-
|
418
|
+
|
419
419
|
e += "#{prebuilt_marker()} is<#{is_static}>"
|
420
420
|
if swift_version
|
421
421
|
e += " sv<#{swift_version}>"
|
@@ -438,7 +438,7 @@ module PodBuilder
|
|
438
438
|
|
439
439
|
def prebuilt_podspec_path(absolute_path = true)
|
440
440
|
podspec_path = PodBuilder::prebuiltpath("#{@root_name}/#{@root_name}.podspec")
|
441
|
-
if absolute_path
|
441
|
+
if absolute_path
|
442
442
|
return podspec_path
|
443
443
|
else
|
444
444
|
pod_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::basepath)).to_s
|
@@ -476,7 +476,7 @@ module PodBuilder
|
|
476
476
|
private
|
477
477
|
|
478
478
|
# @return [Bool] True if it's a pod that doesn't provide source code (is already shipped as a prebuilt pod)
|
479
|
-
#
|
479
|
+
#
|
480
480
|
def extract_is_prebuilt(spec, all_specs, checkout_options, supported_platforms)
|
481
481
|
if Configuration.force_prebuild_pods.include?(@root_name) || Configuration.force_prebuild_pods.include?(@name)
|
482
482
|
return false
|
@@ -502,7 +502,7 @@ module PodBuilder
|
|
502
502
|
# Therefore it can become tricky to understand which pods are already precompiled by boxing a .framework or .a
|
503
503
|
embedded_as_vendored = vendored_frameworks.map { |x| File.basename(x) }.include?("#{module_name}.framework")
|
504
504
|
embedded_as_static_lib = vendored_libraries.map { |x| File.basename(x) }.include?("lib#{module_name}.a")
|
505
|
-
|
505
|
+
|
506
506
|
only_headers = (source_files.count > 0 && @source_files.all? { |x| x.end_with?(".h") })
|
507
507
|
no_sources = (@source_files.count == 0 || only_headers) && (@vendored_frameworks + @vendored_libraries).count > 0
|
508
508
|
|
@@ -532,10 +532,10 @@ module PodBuilder
|
|
532
532
|
supported_platforms = spec.available_platforms.flatten.map(&:name).map(&:to_s)
|
533
533
|
|
534
534
|
items += [spec.attributes_hash["vendored_libraries"]]
|
535
|
-
items += [spec.attributes_hash["vendored_library"]]
|
535
|
+
items += [spec.attributes_hash["vendored_library"]]
|
536
536
|
|
537
537
|
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_libraries"] }
|
538
|
-
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_library"] }
|
538
|
+
items += supported_platforms.map { |x| spec.attributes_hash.fetch(x, {})["vendored_library"] }
|
539
539
|
|
540
540
|
return items.flatten.uniq.compact
|
541
541
|
end
|
@@ -554,17 +554,17 @@ module PodBuilder
|
|
554
554
|
end
|
555
555
|
|
556
556
|
def source_files_from_string(source)
|
557
|
-
# Transform source file entries
|
557
|
+
# Transform source file entries
|
558
558
|
# "Networking{Response,Request}*.{h,m}" -> ["NetworkingResponse*.h", "NetworkingResponse*.m", "NetworkingRequest*.h", "NetworkingRequest*.m"]
|
559
559
|
files = []
|
560
|
-
if source.is_a? String
|
560
|
+
if source.is_a? String
|
561
561
|
matches = source.match(/(.*){(.*)}(.*)/)
|
562
562
|
if matches&.size == 4
|
563
563
|
res = matches[2].split(",").map { |t| "#{matches[1]}#{t}#{matches[3]}" }
|
564
564
|
if res.any? { |t| t.include?("{") }
|
565
565
|
return res.map { |t| source_files_from_string(t) }.flatten
|
566
566
|
end
|
567
|
-
|
567
|
+
|
568
568
|
return res
|
569
569
|
end
|
570
570
|
|