pod-builder 2.0.0.beta.35 → 2.0.0.beta.36

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 037b4a3f456716c55d38e1ec98307ff27e87b97c908dd5e80e5895e9686f6e3f
4
- data.tar.gz: 82dbc45cb9220beb68fe1b76c26ac11f6f8d45927e35fa73ecdd754609742830
3
+ metadata.gz: 777b8b6cfc8ea30b7472322cde03ea58f8ba36cb7d9b3f345413424f773e223d
4
+ data.tar.gz: 9feb6584f9c6ef90e56797359919001216746d789838ec706eebe73acc6259b6
5
5
  SHA512:
6
- metadata.gz: d067c51f54eea74198b8d9ae7a85a25d271666ca3301836ab14920f52c5d9dc47aae4dfafea4de43953c09b5d15cbede4f7bcd0841772c55e7a6f057e61a737b
7
- data.tar.gz: 504fd2e0adec760b4a58d26bec752b3dcf7755b425a0b109662e8cc4e852387b21d003c6d2abbe87e3d92d40412c9d544eb2c2bc65f41ae9e9a94a5e1eec58c3
6
+ metadata.gz: cc6ced09f8669ececcacfdb04831af14bdd12221cf50a67f57f3d5f00019aad02094ae4df8a172932990073051572c02a8c214bd39bf7eb01311c44ee10540b4
7
+ data.tar.gz: 3fce108fd76d9ed4abb0ec3fa54afc4df93cde2ffbce058edd76b44ee27229dc7f0f6429254db839765635fd109984c3f8243c91311fcb46462a77eaba4bb2e4
@@ -72,11 +72,15 @@ module PodBuilder
72
72
  podfiles_items = [pods_to_build_debug] + [pods_to_build_release]
73
73
 
74
74
  install_using_frameworks = Podfile::install_using_frameworks(analyzer)
75
-
76
- if install_using_frameworks
77
- raise "\n\nOnly static library packaging currently supported for react native projects. Please remove 'use_frameworks!' in #{PodBuilder::basepath("Podfile")}".red if Configuration.react_native_project
78
- else
75
+ if Configuration.react_native_project
76
+ if install_using_frameworks
77
+ raise "\n\nOnly static library packaging currently supported for react native projects. Please remove 'use_frameworks!' in #{PodBuilder::basepath("Podfile")}".red
78
+ end
79
79
  prepare_defines_modules_override(all_buildable_items)
80
+ else
81
+ unless install_using_frameworks
82
+ raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at root level (not nested in targets) in #{PodBuilder::basepath("Podfile")}".red
83
+ end
80
84
  end
81
85
 
82
86
  install_result = InstallResult.new
@@ -394,9 +394,6 @@ module PodBuilder
394
394
  def self.install_using_frameworks(analyzer)
395
395
  target_settings = analyzer.podfile.target_definition_list.map(&:uses_frameworks?).uniq
396
396
  if target_settings.count == 1
397
- if target_settings.first == false && ENV["DEBUGGING"].nil?
398
- raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at root level (not nested in targets) in #{PodBuilder::basepath("Podfile")}".red
399
- end
400
397
  return target_settings.first
401
398
  elsif target_settings.count > 1
402
399
  raise "\n\n'use_frameworks!' should be declared only once at Podfile root level (not nested in targets)".red
@@ -3,6 +3,7 @@
3
3
  require 'fourflusher'
4
4
  require 'colored'
5
5
  require 'pathname'
6
+ require 'ruby-progressbar'
6
7
 
7
8
  module PodBuilder
8
9
  def self.build_for_iosish_platform_framework(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
@@ -20,7 +21,7 @@ module PodBuilder
20
21
  excluded_archs = ["i386"] # Fixes https://github.com/Subito-it/PodBuilder/issues/17
21
22
  excluded_archs += build_for_apple_silicon ? [] : ["arm64"]
22
23
  xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs, {})
23
-
24
+
24
25
  spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
25
26
  spec_names.each do |root_name, module_name|
26
27
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
@@ -66,30 +67,30 @@ module PodBuilder
66
67
  FileUtils.rm_rf(simulator_framework_lib)
67
68
  end
68
69
  end
69
-
70
+
70
71
  def self.build_for_iosish_platform_lib(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon, prebuilt_root_paths)
71
72
  raise "\n\nApple silicon hardware still unsupported since it requires to migrate to xcframeworks".red if build_for_apple_silicon
72
-
73
+
73
74
  deployment_target = target.platform_deployment_target
74
75
  target_label = target.cocoapods_target_label
75
-
76
+
76
77
  spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
77
-
78
+
78
79
  xcodebuild(sandbox, target_label, device, deployment_target, configuration, deterministic_build, [], prebuilt_root_paths)
79
80
  excluded_archs = build_for_apple_silicon ? [] : ["arm64"]
80
81
  xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs, prebuilt_root_paths)
81
-
82
+
82
83
  spec_names.each do |root_name, module_name|
83
84
  simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
84
85
  simulator_lib = "#{simulator_base}/lib#{root_name}.a"
85
-
86
+
86
87
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
87
88
  device_lib = "#{device_base}/lib#{root_name}.a"
88
-
89
+
89
90
  unless File.file?(device_lib) && File.file?(simulator_lib)
90
91
  next
91
92
  end
92
-
93
+
93
94
  # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
94
95
  # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
95
96
  # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
@@ -101,12 +102,12 @@ module PodBuilder
101
102
  end
102
103
 
103
104
  raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
104
-
105
+
105
106
  device_headers = Dir.glob("#{device_base}/**/*.h")
106
107
  simulator_headers = Dir.glob("#{simulator_base}/**/*.h")
107
108
  device_headers.each do |device_path|
108
109
  simulator_path = device_path.gsub(device_base, simulator_base)
109
-
110
+
110
111
  merge_header_into(device_path, simulator_path)
111
112
  end
112
113
  simulator_only_headers = simulator_headers - device_headers.map { |t| t.gsub(device_base, simulator_base) }
@@ -117,12 +118,12 @@ module PodBuilder
117
118
  FileUtils.mkdir_p(destination_folder)
118
119
  FileUtils.cp(path, destination_folder)
119
120
  end
120
-
121
+
121
122
  swiftmodule_path = "#{simulator_base}/#{root_name}.swiftmodule"
122
123
  if File.directory?(swiftmodule_path)
123
124
  FileUtils.cp_r("#{swiftmodule_path}/.", "#{device_base}/#{root_name}.swiftmodule")
124
125
  end
125
-
126
+
126
127
  if File.exist?("#{device_base}/#{root_name}.swiftmodule")
127
128
  # This is a swift pod with a swiftmodule in the root of the prebuilt folder
128
129
  else
@@ -141,11 +142,11 @@ module PodBuilder
141
142
  FileUtils.cp(path, destination_folder)
142
143
  end
143
144
  end
144
-
145
+
145
146
  destination_path = "#{build_dir}/#{root_name}"
146
147
  if Dir.glob("#{device_base}/**/*.{a,framework,h}").count > 0
147
148
  FileUtils.mv(device_base, destination_path)
148
-
149
+
149
150
  module_maps = Dir.glob("#{destination_path}/**/*.modulemap")
150
151
  module_map_device_base = device_base.gsub(/^\/private/, "") + "/"
151
152
  module_maps.each do |module_map|
@@ -156,7 +157,7 @@ module PodBuilder
156
157
  end
157
158
  end
158
159
  end
159
-
160
+
160
161
  def self.merge_header_into(device_file, simulator_file)
161
162
  unless File.exist?(device_file) || File.exist?(simulator_file)
162
163
  return
@@ -165,33 +166,33 @@ module PodBuilder
165
166
  device_content = File.file?(device_file) ? File.read(device_file) : ""
166
167
  simulator_content = File.file?(simulator_file) ? File.read(simulator_file) : ""
167
168
  merged_content = %{
168
- #if TARGET_OS_SIMULATOR
169
- // ->
170
-
171
- #{simulator_content}
172
-
173
- // ->
174
- #else
175
- // ->
176
-
177
- #{device_content}
178
-
179
- // ->
180
- #endif
169
+ #if TARGET_OS_SIMULATOR
170
+ // ->
171
+
172
+ #{simulator_content}
173
+
174
+ // ->
175
+ #else
176
+ // ->
177
+
178
+ #{device_content}
179
+
180
+ // ->
181
+ #endif
181
182
  }
182
183
  File.write(device_file, merged_content)
183
184
  end
184
-
185
+
185
186
  def self.add_simulator_conditional(path)
186
187
  file_content = File.read(path)
187
188
  content = %{
188
- #if TARGET_OS_SIMULATOR
189
- #{file_content}
190
- #endif
189
+ #if TARGET_OS_SIMULATOR
190
+ #{file_content}
191
+ #endif
191
192
  }
192
193
  File.write(path, content)
193
194
  end
194
-
195
+
195
196
  def self.xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, configuration, deterministic_build, exclude_archs, prebuilt_root_paths)
196
197
  args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{configuration} -sdk #{sdk})
197
198
  supported_platforms = { 'iphonesimulator' => 'iOS', 'appletvsimulator' => 'tvOS', 'watchsimulator' => 'watchOS' }
@@ -269,15 +270,27 @@ module PodBuilder
269
270
  end
270
271
 
271
272
  Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_context, user_options|
272
- puts "Building".yellow
273
+ build_items_count = installer_context.umbrella_targets.map(&:specs).flatten.count * 2
274
+ progressbar = ProgressBar.create(:length => 80,
275
+ :total => build_items_count,
276
+ :title => "Building",
277
+ :format => "%t |%b>%i|".yellow)
273
278
 
279
+ progressbar_thread = Thread.new {
280
+ loop do
281
+ built_pods = Dir.glob("#{PodBuilder::Configuration.build_path}/build/Release*/*").count
282
+ progressbar.progress = [0, built_pods - 1].max
283
+ sleep(5)
284
+ end
285
+ }
286
+
274
287
  enable_dsym = user_options.fetch('dsym', true)
275
288
  configuration = user_options.fetch('configuration', 'Debug')
276
289
  uses_frameworks = user_options.fetch('uses_frameworks', true)
277
290
  if user_options["pre_compile"]
278
291
  user_options["pre_compile"].call(installer_context)
279
292
  end
280
-
293
+
281
294
  prebuilt_root_paths = JSON.parse(user_options["prebuilt_root_paths"].gsub('=>', ':'))
282
295
 
283
296
  sandbox_root = Pathname(installer_context.sandbox_root)
@@ -301,75 +314,77 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
301
314
  when [:tvos, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'appletvos', 'appletvsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon, prebuilt_root_paths)
302
315
  when [:watchos, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'watchos', 'watchsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon, prebuilt_root_paths)
303
316
  else raise "\n\nUnknown platform '#{target.platform_name}'".red end
304
- end
317
+ end
305
318
 
306
- raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
307
-
308
- specs = installer_context.umbrella_targets.map { |t| t.specs.map(&:name) }.flatten.map { |t| t.split("/").first }.uniq
309
- built_count = Dir["#{build_dir}/*"].select { |t| specs.include?(File.basename(t)) }.count
310
- Pod::UI.puts "Built #{built_count} #{'items'.pluralize(built_count)}, copying..."
319
+ progressbar.finish
320
+ progressbar_thread.join
311
321
 
312
- base_destination.rmtree if base_destination.directory?
313
-
314
- installer_context.umbrella_targets.each do |umbrella|
315
- umbrella.specs.each do |spec|
316
- root_name = spec.name.split("/").first
317
-
318
- if uses_frameworks
319
- destination = File.join(base_destination, root_name)
320
- else
321
- destination = File.join(base_destination, root_name, root_name)
322
- end
323
- # Make sure the device target overwrites anything in the simulator build, otherwise iTunesConnect
324
- # can get upset about Info.plist containing references to the simulator SDK
325
- files = Pathname.glob("build/#{root_name}/*").reject { |f| f.to_s =~ /Pods[^.]+\.framework/ }
326
-
327
- consumer = spec.consumer(umbrella.platform_name)
328
- file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
329
- files += file_accessor.vendored_libraries
330
- files += file_accessor.vendored_frameworks
331
- begin
332
- files += file_accessor.resources
333
- rescue
334
- end
335
-
336
- FileUtils.mkdir_p(destination)
337
- files.each do |file|
338
- FileUtils.cp_r(file, destination)
339
- end
340
- end
341
- end
322
+ raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
323
+
324
+ specs = installer_context.umbrella_targets.map { |t| t.specs.map(&:name) }.flatten.map { |t| t.split("/").first }.uniq
325
+ built_count = Dir["#{build_dir}/*"].select { |t| specs.include?(File.basename(t)) }.count
326
+ Pod::UI.puts "Built #{built_count} #{'items'.pluralize(built_count)}, copying..."
327
+
328
+ base_destination.rmtree if base_destination.directory?
342
329
 
343
- # Depending on the resource it may happen that it is present twice, both in the .framework and in the parent folder
344
- Dir.glob("#{base_destination}/*") do |path|
345
- unless File.directory?(path)
346
- return
330
+ installer_context.umbrella_targets.each do |umbrella|
331
+ umbrella.specs.each do |spec|
332
+ root_name = spec.name.split("/").first
333
+
334
+ if uses_frameworks
335
+ destination = File.join(base_destination, root_name)
336
+ else
337
+ destination = File.join(base_destination, root_name, root_name)
347
338
  end
339
+ # Make sure the device target overwrites anything in the simulator build, otherwise iTunesConnect
340
+ # can get upset about Info.plist containing references to the simulator SDK
341
+ files = Pathname.glob("build/#{root_name}/*").reject { |f| f.to_s =~ /Pods[^.]+\.framework/ }
348
342
 
349
- files = Dir.glob("#{path}/*")
350
- framework_files = Dir.glob("#{path}/*.framework/**/*").map { |t| File.basename(t) }
343
+ consumer = spec.consumer(umbrella.platform_name)
344
+ file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(spec.root.name), consumer)
345
+ files += file_accessor.vendored_libraries
346
+ files += file_accessor.vendored_frameworks
347
+ begin
348
+ files += file_accessor.resources
349
+ rescue
350
+ end
351
351
 
352
+ FileUtils.mkdir_p(destination)
352
353
  files.each do |file|
353
- filename = File.basename(file.gsub(/\.xib$/, ".nib"))
354
- if framework_files.include?(filename)
355
- FileUtils.rm_rf(file)
356
- end
357
- end
354
+ FileUtils.cp_r(file, destination)
355
+ end
358
356
  end
359
-
360
- if enable_dsym
361
- dsym_source = "#{build_dir}/dSYM"
362
- if File.directory?(dsym_source)
363
- FileUtils.mv(dsym_source, sandbox_root.parent)
364
- end
365
- else
366
- raise "Not implemented"
357
+ end
358
+
359
+ # Depending on the resource it may happen that it is present twice, both in the .framework and in the parent folder
360
+ Dir.glob("#{base_destination}/*") do |path|
361
+ unless File.directory?(path)
362
+ return
367
363
  end
368
364
 
369
- build_dir.rmtree if build_dir.directory?
365
+ files = Dir.glob("#{path}/*")
366
+ framework_files = Dir.glob("#{path}/*.framework/**/*").map { |t| File.basename(t) }
370
367
 
371
- if user_options["post_compile"]
372
- user_options["post_compile"].call(installer_context)
368
+ files.each do |file|
369
+ filename = File.basename(file.gsub(/\.xib$/, ".nib"))
370
+ if framework_files.include?(filename)
371
+ FileUtils.rm_rf(file)
372
+ end
373
+ end
374
+ end
375
+
376
+ if enable_dsym
377
+ dsym_source = "#{build_dir}/dSYM"
378
+ if File.directory?(dsym_source)
379
+ FileUtils.mv(dsym_source, sandbox_root.parent)
373
380
  end
381
+ else
382
+ raise "Not implemented"
383
+ end
384
+
385
+ build_dir.rmtree if build_dir.directory?
386
+
387
+ if user_options["post_compile"]
388
+ user_options["post_compile"].call(installer_context)
374
389
  end
375
-
390
+ end
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.35"
2
+ VERSION = "2.0.0.beta.36"
3
3
  end
4
4
 
@@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_runtime_dependency 'cocoapods-core', '~> 1.6'
36
36
  spec.add_runtime_dependency 'CFPropertyList'
37
37
  spec.add_runtime_dependency 'json'
38
+ spec.add_runtime_dependency 'ruby-progressbar'
38
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.35
4
+ version: 2.0.0.beta.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-13 00:00:00.000000000 Z
11
+ date: 2020-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: ruby-progressbar
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: Prebuild CocoaPods pods to make compiling your Xcode projects faster
168
182
  email:
169
183
  - tomas.camin@adevinta.com