fastlane 2.238.0 → 2.240.0

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +98 -98
  3. data/bin/fastlane +2 -2
  4. data/deliver/lib/deliver/html_generator.rb +1 -1
  5. data/deliver/lib/deliver/options.rb +8 -0
  6. data/deliver/lib/deliver/runner.rb +5 -4
  7. data/deliver/lib/deliver/upload_metadata.rb +22 -0
  8. data/deliver/lib/deliver/upload_screenshots.rb +12 -4
  9. data/fastlane/lib/fastlane/actions/build_and_upload_to_appetize.rb +3 -1
  10. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +7 -2
  11. data/fastlane/lib/fastlane/actions/docs/get_push_certificate.md +6 -0
  12. data/fastlane/lib/fastlane/actions/lcov.rb +3 -1
  13. data/fastlane/lib/fastlane/actions/spaceship_logs.rb +4 -2
  14. data/fastlane/lib/fastlane/actions/swiftlint.rb +6 -3
  15. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +3 -1
  16. data/fastlane/lib/fastlane/helper/git_helper.rb +4 -2
  17. data/fastlane/lib/fastlane/helper/sh_helper.rb +9 -1
  18. data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +1 -1
  19. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +5 -1
  20. data/fastlane/lib/fastlane/version.rb +1 -1
  21. data/fastlane/swift/Deliverfile.swift +1 -1
  22. data/fastlane/swift/DeliverfileProtocol.swift +8 -1
  23. data/fastlane/swift/Fastlane.swift +75 -3
  24. data/fastlane/swift/Gymfile.swift +1 -1
  25. data/fastlane/swift/GymfileProtocol.swift +8 -1
  26. data/fastlane/swift/Matchfile.swift +1 -1
  27. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  28. data/fastlane/swift/Precheckfile.swift +1 -1
  29. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  30. data/fastlane/swift/Scanfile.swift +1 -1
  31. data/fastlane/swift/ScanfileProtocol.swift +8 -1
  32. data/fastlane/swift/Screengrabfile.swift +1 -1
  33. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  34. data/fastlane/swift/Snapshotfile.swift +1 -1
  35. data/fastlane/swift/SnapshotfileProtocol.swift +8 -1
  36. data/fastlane_core/lib/fastlane_core/fastlane_pty.rb +20 -7
  37. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +1 -1
  38. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +16 -13
  39. data/fastlane_core/lib/fastlane_core/project.rb +19 -0
  40. data/gym/lib/gym/options.rb +5 -0
  41. data/match/lib/match/nuke.rb +2 -2
  42. data/match/lib/match/storage/git_storage.rb +1 -4
  43. data/match/lib/match/storage/google_cloud_storage.rb +6 -1
  44. data/pem/lib/pem/manager.rb +5 -1
  45. data/pem/lib/pem/options.rb +6 -0
  46. data/pilot/lib/pilot/build_manager.rb +32 -0
  47. data/pilot/lib/pilot/options.rb +8 -0
  48. data/scan/lib/scan/options.rb +5 -0
  49. data/sigh/lib/assets/resign.sh +21 -9
  50. data/snapshot/lib/snapshot/options.rb +5 -0
  51. data/spaceship/lib/spaceship/client.rb +137 -15
  52. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +16 -0
  53. data/spaceship/lib/spaceship/connect_api/models/routing_app_coverage.rb +75 -0
  54. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  55. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +45 -0
  56. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  57. data/spaceship/lib/spaceship/du/upload_file.rb +4 -3
  58. data/supply/lib/supply/client.rb +6 -0
  59. data/supply/lib/supply/reader.rb +15 -0
  60. data/trainer/lib/trainer/xcresult/helper.rb +27 -13
  61. metadata +34 -50
@@ -152,6 +152,9 @@ public protocol GymfileProtocol: AnyObject {
152
152
  /// Skips resolution of Swift Package Manager dependencies
153
153
  var skipPackageDependenciesResolution: Bool { get }
154
154
 
155
+ /// Raises an error instead of fetching build settings by running `xcodebuild -showBuildSettings`, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually
156
+ var disallowXcodebuildSettingsLookup: Bool { get }
157
+
155
158
  /// Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file. This translates in the option `-disableAutomaticPackageResolution` being passed to xcodebuild
156
159
  var disablePackageAutomaticUpdates: Bool { get }
157
160
 
@@ -369,6 +372,10 @@ public extension GymfileProtocol {
369
372
  return false
370
373
  }
371
374
 
375
+ var disallowXcodebuildSettingsLookup: Bool {
376
+ return false
377
+ }
378
+
372
379
  var disablePackageAutomaticUpdates: Bool {
373
380
  return false
374
381
  }
@@ -392,4 +399,4 @@ public extension GymfileProtocol {
392
399
 
393
400
  // Please don't remove the lines below
394
401
  // They are used to detect outdated files
395
- // FastlaneRunnerAPIVersion [0.9.155]
402
+ // FastlaneRunnerAPIVersion [0.9.157]
@@ -17,4 +17,4 @@ public class Matchfile: MatchfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.238.0
20
+ // Generated with fastlane 2.240.0
@@ -413,4 +413,4 @@ public extension MatchfileProtocol {
413
413
 
414
414
  // Please don't remove the lines below
415
415
  // They are used to detect outdated files
416
- // FastlaneRunnerAPIVersion [0.9.149]
416
+ // FastlaneRunnerAPIVersion [0.9.151]
@@ -17,4 +17,4 @@ public class Precheckfile: PrecheckfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.238.0
20
+ // Generated with fastlane 2.240.0
@@ -84,4 +84,4 @@ public extension PrecheckfileProtocol {
84
84
 
85
85
  // Please don't remove the lines below
86
86
  // They are used to detect outdated files
87
- // FastlaneRunnerAPIVersion [0.9.148]
87
+ // FastlaneRunnerAPIVersion [0.9.150]
@@ -17,4 +17,4 @@ public class Scanfile: ScanfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.238.0
20
+ // Generated with fastlane 2.240.0
@@ -230,6 +230,9 @@ public protocol ScanfileProtocol: AnyObject {
230
230
  /// Skips resolution of Swift Package Manager dependencies
231
231
  var skipPackageDependenciesResolution: Bool { get }
232
232
 
233
+ /// Raises an error instead of fetching build settings by running `xcodebuild -showBuildSettings`, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually
234
+ var disallowXcodebuildSettingsLookup: Bool { get }
235
+
233
236
  /// Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file. This translates in the option `-disableAutomaticPackageResolution` being passed to xcodebuild
234
237
  var disablePackageAutomaticUpdates: Bool { get }
235
238
 
@@ -554,6 +557,10 @@ public extension ScanfileProtocol {
554
557
  return false
555
558
  }
556
559
 
560
+ var disallowXcodebuildSettingsLookup: Bool {
561
+ return false
562
+ }
563
+
557
564
  var disablePackageAutomaticUpdates: Bool {
558
565
  return false
559
566
  }
@@ -581,4 +588,4 @@ public extension ScanfileProtocol {
581
588
 
582
589
  // Please don't remove the lines below
583
590
  // They are used to detect outdated files
584
- // FastlaneRunnerAPIVersion [0.9.160]
591
+ // FastlaneRunnerAPIVersion [0.9.162]
@@ -17,4 +17,4 @@ public class Screengrabfile: ScreengrabfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.238.0
20
+ // Generated with fastlane 2.240.0
@@ -161,4 +161,4 @@ public extension ScreengrabfileProtocol {
161
161
 
162
162
  // Please don't remove the lines below
163
163
  // They are used to detect outdated files
164
- // FastlaneRunnerAPIVersion [0.9.150]
164
+ // FastlaneRunnerAPIVersion [0.9.152]
@@ -17,4 +17,4 @@ public class Snapshotfile: SnapshotfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.238.0
20
+ // Generated with fastlane 2.240.0
@@ -125,6 +125,9 @@ public protocol SnapshotfileProtocol: AnyObject {
125
125
  /// Skips resolution of Swift Package Manager dependencies
126
126
  var skipPackageDependenciesResolution: Bool { get }
127
127
 
128
+ /// Raises an error instead of fetching build settings by running `xcodebuild -showBuildSettings`, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually
129
+ var disallowXcodebuildSettingsLookup: Bool { get }
130
+
128
131
  /// Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file. This translates in the option `-disableAutomaticPackageResolution` being passed to xcodebuild
129
132
  var disablePackageAutomaticUpdates: Bool { get }
130
133
 
@@ -327,6 +330,10 @@ public extension SnapshotfileProtocol {
327
330
  return false
328
331
  }
329
332
 
333
+ var disallowXcodebuildSettingsLookup: Bool {
334
+ return false
335
+ }
336
+
330
337
  var disablePackageAutomaticUpdates: Bool {
331
338
  return false
332
339
  }
@@ -378,4 +385,4 @@ public extension SnapshotfileProtocol {
378
385
 
379
386
  // Please don't remove the lines below
380
387
  // They are used to detect outdated files
381
- // FastlaneRunnerAPIVersion [0.9.144]
388
+ // FastlaneRunnerAPIVersion [0.9.146]
@@ -30,6 +30,11 @@ module FastlaneCore
30
30
  require 'pty'
31
31
  # this forces the PTY flush - fixes #21792
32
32
  command = ENV['FASTLANE_EXEC_FLUSH_PTY_WORKAROUND'] ? "#{original_command};" : original_command
33
+ # The status is produced in the ensure below and read after the block. It
34
+ # travels in a local rather than in $?, which is a thread global: anything
35
+ # that runs a subprocess in between overwrites it, and nothing writes it at
36
+ # all when the wait does not happen. See fastlane#30188.
37
+ status = nil
33
38
  PTY.spawn(command) do |command_stdout, command_stdin, pid|
34
39
  begin
35
40
  yield(command_stdout, command_stdin, pid)
@@ -42,20 +47,28 @@ module FastlaneCore
42
47
  command_stdin.close
43
48
  command_stdout.close
44
49
  begin
45
- Process.wait(pid)
46
- rescue Errno::ECHILD, PTY::ChildExited
47
- # The process might have exited.
50
+ _pid, status = Process.wait2(pid)
51
+ rescue PTY::ChildExited => e
52
+ # The pty saw the child go before we asked for it. The exception
53
+ # carries the status we were about to wait for.
54
+ status = e.status
55
+ rescue Errno::ECHILD
56
+ # Something else reaped it, so there is nothing left to ask for. $?
57
+ # may still hold it, and may just as easily hold someone else's.
48
58
  end
49
59
  end
50
60
  end
51
- status = self.process_status
61
+ status ||= self.process_status
62
+ # Better a plain error than a NoMethodError raised from inside the handler
63
+ # that exists to report the failure, which is what nil used to produce.
64
+ raise StandardError, "Could not determine the exit status of the command" if status.nil?
52
65
  raise StandardError, "Process crashed" if status.signaled?
53
66
  status.exitstatus
54
67
  rescue StandardError => e
55
68
  # Wrapping any error in FastlanePtyError to allow callers to see and use
56
- # $?.exitstatus that would usually get returned
57
- status = self.process_status
58
- raise FastlanePtyError.new(e, status.exitstatus || e.exit_status, status)
69
+ # the exit status that would usually get returned
70
+ status ||= self.process_status
71
+ raise FastlanePtyError.new(e, status&.exitstatus || e.exit_status, status)
59
72
  end
60
73
 
61
74
  def self.spawn_with_popen(command, &block)
@@ -55,7 +55,7 @@ module FastlaneCore
55
55
  end
56
56
 
57
57
  def self.fetch_info_plist_with_rubyzip(path)
58
- Zip::File.open(path, "rb") do |zipfile|
58
+ Zip::File.open(path) do |zipfile|
59
59
  file = zipfile.glob('**/Payload/*.app/Info.plist').first
60
60
  return nil unless file
61
61
  zipfile.read(file)
@@ -35,7 +35,7 @@ module FastlaneCore
35
35
 
36
36
  private_constant :ERROR_REGEX, :WARNING_REGEX, :OUTPUT_REGEX, :RETURN_VALUE_REGEX, :SKIP_ERRORS
37
37
 
38
- def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
38
+ def build_download_command(username, password, apple_id, destination = Dir.tmpdir, provider_short_name = "", jwt = nil)
39
39
  not_implemented(__method__)
40
40
  end
41
41
 
@@ -43,11 +43,11 @@ module FastlaneCore
43
43
  not_implemented(__method__)
44
44
  end
45
45
 
46
- def build_upload_command(username, password, source = "/tmp", options = {})
46
+ def build_upload_command(username, password, source = Dir.tmpdir, options = {})
47
47
  not_implemented(__method__)
48
48
  end
49
49
 
50
- def build_verify_command(username, password, source = "/tmp", provider_short_name = "", **kwargs)
50
+ def build_verify_command(username, password, source = Dir.tmpdir, provider_short_name = "", **kwargs)
51
51
  not_implemented(__method__)
52
52
  end
53
53
 
@@ -291,6 +291,7 @@ module FastlaneCore
291
291
 
292
292
  @errors << "The call to the altool completed with a non-zero exit status: #{exit_status}. This indicates a failure." unless exit_status.zero?
293
293
  @errors << "-1 indicates altool exited abnormally; try retrying (see https://github.com/fastlane/fastlane/issues/21535)" if exit_status == -1
294
+ @errors.clear if @all_lines.any? { |line| line.include?("UPLOAD SUCCEEDED with no errors") }
294
295
 
295
296
  unless @errors.empty? || @all_lines.empty?
296
297
  @all_lines.each do |line|
@@ -319,7 +320,7 @@ module FastlaneCore
319
320
  end
320
321
  end
321
322
 
322
- def build_upload_command(username, password, source = "/tmp", options = {})
323
+ def build_upload_command(username, password, source = Dir.tmpdir, options = {})
323
324
  provider_short_name = options.fetch(:provider_short_name, "")
324
325
  provider_public_id = options.fetch(:provider_public_id, "")
325
326
  jwt = options[:jwt]
@@ -351,11 +352,11 @@ module FastlaneCore
351
352
  ].compact.join(' ')
352
353
  end
353
354
 
354
- def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
355
+ def build_download_command(username, password, apple_id, destination = Dir.tmpdir, provider_short_name = "", jwt = nil)
355
356
  raise "This feature has not been implemented yet with altool for Xcode 14"
356
357
  end
357
358
 
358
- def build_verify_command(username, password, source = "/tmp", options = {})
359
+ def build_verify_command(username, password, source = Dir.tmpdir, options = {})
359
360
  provider_short_name = options.fetch(:provider_short_name, "")
360
361
  provider_public_id = options.fetch(:provider_public_id, "")
361
362
  api_key = options[:api_key]
@@ -442,7 +443,7 @@ module FastlaneCore
442
443
  end
443
444
  end
444
445
 
445
- def build_upload_command(username, password, source = "/tmp", options = {})
446
+ def build_upload_command(username, password, source = Dir.tmpdir, options = {})
446
447
  provider_short_name = options.fetch(:provider_short_name, "")
447
448
  jwt = options[:jwt]
448
449
  api_key = options[:api_key]
@@ -458,7 +459,7 @@ module FastlaneCore
458
459
  ].compact.join(' ')
459
460
  end
460
461
 
461
- def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
462
+ def build_download_command(username, password, apple_id, destination = Dir.tmpdir, provider_short_name = "", jwt = nil)
462
463
  [
463
464
  '"' + Helper.transporter_path + '"',
464
465
  "-m lookupMetadata",
@@ -477,7 +478,7 @@ module FastlaneCore
477
478
  ].compact.join(' ')
478
479
  end
479
480
 
480
- def build_verify_command(username, password, source = "/tmp", options = {})
481
+ def build_verify_command(username, password, source = Dir.tmpdir, options = {})
481
482
  provider_short_name = options.fetch(:provider_short_name, "")
482
483
  jwt = options[:jwt]
483
484
  [
@@ -568,7 +569,7 @@ module FastlaneCore
568
569
  end
569
570
  end
570
571
 
571
- def build_upload_command(username, password, source = "/tmp", options = {})
572
+ def build_upload_command(username, password, source = Dir.tmpdir, options = {})
572
573
  provider_short_name = options.fetch(:provider_short_name, "")
573
574
  jwt = options[:jwt]
574
575
  api_key = options[:api_key]
@@ -607,7 +608,7 @@ module FastlaneCore
607
608
  end
608
609
  end
609
610
 
610
- def build_verify_command(username, password, source = "/tmp", options = {})
611
+ def build_verify_command(username, password, source = Dir.tmpdir, options = {})
611
612
  provider_short_name = options.fetch(:provider_short_name, "")
612
613
  jwt = options[:jwt]
613
614
  credential_params = build_credential_params(username, password, jwt, nil, is_default_itms_on_xcode_11?)
@@ -641,7 +642,7 @@ module FastlaneCore
641
642
  end
642
643
  end
643
644
 
644
- def build_download_command(username, password, apple_id, destination = "/tmp", provider_short_name = "", jwt = nil)
645
+ def build_download_command(username, password, apple_id, destination = Dir.tmpdir, provider_short_name = "", jwt = nil)
645
646
  credential_params = build_credential_params(username, password, jwt, nil, is_default_itms_on_xcode_11?)
646
647
  if is_default_itms_on_xcode_11?
647
648
  [
@@ -793,7 +794,9 @@ module FastlaneCore
793
794
  # @raise [Deliver::TransporterTransferError] when something went wrong
794
795
  # when transferring
795
796
  def download(app_id, dir = nil)
796
- dir ||= "/tmp"
797
+ # Dir.tmpdir, not a literal "/tmp": the transporter chdirs into this
798
+ # directory, and "/tmp" is not one on Windows. See fastlane#30184.
799
+ dir ||= Dir.tmpdir
797
800
 
798
801
  password_placeholder = @jwt.nil? ? 'YourPassword' : nil
799
802
  jwt_placeholder = @jwt.nil? ? nil : 'YourJWT'
@@ -412,6 +412,16 @@ module FastlaneCore
412
412
  # @param [String] The key of which we want the value for (e.g. "PRODUCT_NAME")
413
413
  def build_settings(key: nil, optional: true)
414
414
  unless @build_settings
415
+ if (disallowed_by = xcodebuild_settings_lookup_disallowed_by)
416
+ message = "Could not read the '#{key}' build setting: fetching build settings by running" \
417
+ " `xcodebuild -showBuildSettings` is disallowed by #{disallowed_by}."
418
+ trigger = caller.find { |frame| !frame.start_with?(__FILE__) }
419
+ message += "\nThe build setting lookup was triggered by: #{trigger}" if trigger
420
+ message += "\nTo fix this, manually specify the option whose automatic detection required the '#{key}' build setting," \
421
+ " or disable #{disallowed_by} to allow fastlane to fetch it automatically."
422
+ UI.user_error!(message)
423
+ end
424
+
415
425
  if is_workspace
416
426
  if schemes.count == 0
417
427
  UI.user_error!("Could not find any schemes for Xcode workspace at path '#{self.path}'. Please make sure that the schemes you want to use are marked as `Shared` from Xcode.")
@@ -563,5 +573,14 @@ module FastlaneCore
563
573
  def automated_scheme_selection?
564
574
  FastlaneCore::Env.truthy?("AUTOMATED_SCHEME_SELECTION")
565
575
  end
576
+
577
+ # Returns a description of what disallowed fetching build settings via the
578
+ # (potentially slow on large projects) `xcodebuild -showBuildSettings` command,
579
+ # or nil if the lookup is allowed
580
+ def xcodebuild_settings_lookup_disallowed_by
581
+ return "the FASTLANE_DISALLOW_XCODEBUILD_SETTINGS_LOOKUP environment variable" if FastlaneCore::Env.truthy?("FASTLANE_DISALLOW_XCODEBUILD_SETTINGS_LOOKUP")
582
+ return "the `disallow_xcodebuild_settings_lookup` option" if options[:disallow_xcodebuild_settings_lookup]
583
+ nil
584
+ end
566
585
  end
567
586
  end
@@ -321,6 +321,11 @@ module Gym
321
321
  description: "Skips resolution of Swift Package Manager dependencies",
322
322
  type: Boolean,
323
323
  default_value: false),
324
+ FastlaneCore::ConfigItem.new(key: :disallow_xcodebuild_settings_lookup,
325
+ env_name: "GYM_DISALLOW_XCODEBUILD_SETTINGS_LOOKUP",
326
+ description: "Raises an error instead of fetching build settings by running `xcodebuild -showBuildSettings`, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually",
327
+ type: Boolean,
328
+ default_value: false),
324
329
  FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
325
330
  env_name: "GYM_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
326
331
  description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file. This translates in the option `-disableAutomaticPackageResolution` being passed to xcodebuild",
@@ -341,9 +341,9 @@ module Match
341
341
  def filter_profiles_and_files_by_selected_certificates
342
342
  # Do profile selection logic
343
343
  cert_ids = self.certs.map { |cert| cert.id.to_s }
344
- self.profiles = self.profiles.reject do |profile|
344
+ self.profiles = self.profiles.select do |profile|
345
345
  profile_cert_ids = profile.certificates.map { |cert| cert.id.to_s }
346
- (cert_ids & profile_cert_ids).empty?
346
+ cert_ids.intersect?(profile_cert_ids)
347
347
  end
348
348
 
349
349
  profile_uuids = self.profiles.map do |profile|
@@ -117,13 +117,10 @@ module Match
117
117
  print_command: FastlaneCore::Globals.verbose?)
118
118
  end
119
119
  rescue
120
- UI.error("Error cloning certificates repo, please make sure you have read access to the repository you want to use")
121
120
  if self.branch && self.clone_branch_directly
122
121
  UI.error("You passed '#{self.branch}' as branch in combination with the `clone_branch_directly` flag. Please remove `clone_branch_directly` flag on the first run for _match_ to create the branch.")
123
122
  end
124
- UI.error("Run the following command manually to make sure you're properly authenticated:")
125
- UI.command(command)
126
- UI.user_error!("Error cloning certificates git repo, please make sure you have access to the repository - see instructions above")
123
+ UI.user_error!("Error cloning certificates repo, please make sure you have read access to the repository you want to use")
127
124
  end
128
125
 
129
126
  add_user_config(self.git_full_name, self.git_user_email)
@@ -82,7 +82,12 @@ module Match
82
82
  if self.google_cloud_keys_file.to_s.length > 0
83
83
  # Extract the Project ID from the `JSON` file
84
84
  # so the user doesn't have to provide it manually
85
- keys_file_content = JSON.parse(File.read(self.google_cloud_keys_file))
85
+ begin
86
+ keys_file_content = JSON.parse(File.read(self.google_cloud_keys_file))
87
+ rescue JSON::ParserError
88
+ # Don't dump secret into logs in case a secret (p8) is passed. See fastlane/fastlane#21017
89
+ UI.user_error!("Provided keys file on path #{File.expand_path(self.google_cloud_keys_file)} is not a valid JSON file")
90
+ end
86
91
  if google_cloud_project_id.to_s.length > 0 && google_cloud_project_id != keys_file_content["project_id"]
87
92
  UI.important("The google_cloud_keys_file's project ID ('#{keys_file_content['project_id']}') doesn't match the google_cloud_project_id ('#{google_cloud_project_id}'). This may be the wrong keys file.")
88
93
  end
@@ -20,7 +20,7 @@ module PEM
20
20
  remaining_days = (existing_certificate.expires - Time.now) / 60 / 60 / 24
21
21
 
22
22
  display_platform = ''
23
- unless PEM.config[:website_push]
23
+ unless PEM.config[:website_push] || PEM.config[:voip_push]
24
24
  display_platform = "#{PEM.config[:platform]} "
25
25
  end
26
26
 
@@ -94,6 +94,8 @@ module PEM
94
94
  def certificate
95
95
  if PEM.config[:website_push]
96
96
  Spaceship.certificate.website_push
97
+ elsif PEM.config[:voip_push]
98
+ Spaceship.certificate.voip_push
97
99
  else
98
100
  platform = PEM.config[:platform]
99
101
  UI.user_error!('platform parameter is unspecified.') unless platform
@@ -123,6 +125,8 @@ module PEM
123
125
  'development'
124
126
  elsif PEM.config[:website_push]
125
127
  'website'
128
+ elsif PEM.config[:voip_push]
129
+ 'voip'
126
130
  else
127
131
  'production'
128
132
  end
@@ -30,6 +30,12 @@ module PEM
30
30
  is_string: false,
31
31
  conflicting_options: [:development],
32
32
  default_value: false),
33
+ FastlaneCore::ConfigItem.new(key: :voip_push,
34
+ env_name: "PEM_VOIP_PUSH",
35
+ description: "Create a VoIP Services certificate",
36
+ is_string: false,
37
+ conflicting_options: [:development, :website_push],
38
+ default_value: false),
33
39
  FastlaneCore::ConfigItem.new(key: :generate_p12,
34
40
  env_name: "PEM_GENERATE_P12_FILE",
35
41
  description: "Generate a p12 file additionally to a PEM file",
@@ -296,6 +296,9 @@ module Pilot
296
296
 
297
297
  # Handle beta app clip invocations
298
298
  update_app_clip_invocations(options: options, build: build)
299
+
300
+ # Handle routing app coverage file
301
+ update_routing_app_coverage(options)
299
302
  end
300
303
 
301
304
  def self.truncate_changelog(changelog)
@@ -679,6 +682,35 @@ module Pilot
679
682
  end
680
683
  end
681
684
  end
685
+
686
+ def update_routing_app_coverage(options)
687
+ # Skip logic entirely if no coverage file passed. So status-quo stays the same.
688
+ return unless options[:routing_app_coverage_file]
689
+
690
+ # We can only attach a coverage file to build upload - so pick the most recent edit.
691
+ platform = Spaceship::ConnectAPI::Platform.map(fetch_app_platform)
692
+ version = app.get_edit_app_store_version(platform: platform)
693
+ unless version
694
+ UI.important("Skipping upload of routing app coverage file - could not find an editable app store version")
695
+ return
696
+ end
697
+
698
+ routing_app_coverage =
699
+ begin
700
+ version.fetch_routing_app_coverage
701
+ rescue => error
702
+ UI.important("Error fetching routing app coverage - #{error.message}")
703
+ nil
704
+ end
705
+
706
+ if routing_app_coverage
707
+ UI.message("Removing previous routing app coverage file from App Store Connect")
708
+ routing_app_coverage.delete!
709
+ end
710
+
711
+ UI.message("Uploading routing app coverage file to App Store Connect")
712
+ version.upload_routing_app_coverage(path: options[:routing_app_coverage_file])
713
+ end
682
714
  end
683
715
  # rubocop:enable Metrics/ClassLength
684
716
  end
@@ -201,6 +201,14 @@ module Pilot
201
201
  optional: true,
202
202
  type: Boolean,
203
203
  default_value: false),
204
+ FastlaneCore::ConfigItem.new(key: :routing_app_coverage_file,
205
+ env_name: "PILOT_ROUTING_APP_COVERAGE_FILE",
206
+ description: "Path to the routing app coverage file (`.geojson`) that is required for routing apps. It will be uploaded to the editable App Store version of the app",
207
+ optional: true,
208
+ verify_block: proc do |value|
209
+ UI.user_error!("Could not find routing app coverage file at path '#{File.expand_path(value)}'") unless File.exist?(value)
210
+ UI.user_error!("Routing app coverage file must be a .geojson file") unless File.extname(value).casecmp(".geojson").zero?
211
+ end),
204
212
 
205
213
  # distribution
206
214
  FastlaneCore::ConfigItem.new(key: :distribute_only,
@@ -527,6 +527,11 @@ module Scan
527
527
  description: "Skips resolution of Swift Package Manager dependencies",
528
528
  type: Boolean,
529
529
  default_value: false),
530
+ FastlaneCore::ConfigItem.new(key: :disallow_xcodebuild_settings_lookup,
531
+ env_name: "SCAN_DISALLOW_XCODEBUILD_SETTINGS_LOOKUP",
532
+ description: "Raises an error instead of fetching build settings by running `xcodebuild -showBuildSettings`, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually",
533
+ type: Boolean,
534
+ default_value: false),
530
535
  FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
531
536
  env_name: "SCAN_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
532
537
  description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file. This translates in the option `-disableAutomaticPackageResolution` being passed to xcodebuild",
@@ -665,9 +665,18 @@ function resign {
665
665
  # Get the old and the new team ID
666
666
  # Old team ID is not part of app entitlements, have to get it from old embedded provisioning profile
667
667
  security cms -D -i "$TEMP_DIR/old-embedded.mobileprovision" > "$TEMP_DIR/old-embedded-profile.plist"
668
- OLD_TEAM_ID=$(PlistBuddy -c "Print :TeamIdentifier:0" "$TEMP_DIR/old-embedded-profile.plist")
668
+ OLD_TEAM_ID=$(PlistBuddy -c "Print :TeamIdentifier:0" "$TEMP_DIR/old-embedded-profile.plist" 2>/dev/null)
669
+ if [ "$OLD_TEAM_ID" == "" ]; then
670
+ OLD_TEAM_ID="$OLD_APP_ID"
671
+ fi
669
672
  # New team ID is part of profile entitlements
670
- NEW_TEAM_ID=$(PlistBuddy -c "Print com.apple.developer.team-identifier" "$PROFILE_ENTITLEMENTS" | grep -E '^[A-Z0-9]*' -o | tr -d '\n')
673
+ NEW_TEAM_ID=$(PlistBuddy -c "Print :com.apple.developer.team-identifier" "$PROFILE_ENTITLEMENTS" 2>/dev/null | grep -E '^[A-Z0-9]*' -o | tr -d '\n')
674
+ if [ "$NEW_TEAM_ID" == "" ]; then
675
+ NEW_TEAM_ID="$TEAM_IDENTIFIER"
676
+ fi
677
+ if [ "$NEW_TEAM_ID" == "" ]; then
678
+ NEW_TEAM_ID="$NEW_APP_ID"
679
+ fi
671
680
 
672
681
  log "Patching profile entitlements with values from app entitlements"
673
682
  PATCHED_ENTITLEMENTS="$TEMP_DIR/patchedEntitlements"
@@ -866,13 +875,16 @@ function resign {
866
875
  OLD_BUNDLE_ID="$(PlistBuddy -c "Print :CFBundleIdentifier" "$TEMP_DIR/oldInfo.plist")"
867
876
  NEW_BUNDLE_ID="$(bundle_id_for_provision "$NEW_PROVISION")"
868
877
  log "Replacing old bundle ID '$OLD_BUNDLE_ID' with new bundle ID '$NEW_BUNDLE_ID' in patched entitlements"
869
- # Note: ideally we'd match against the opening <string> tag too, but this isn't possible
870
- # because $OLD_BUNDLE_ID and $NEW_BUNDLE_ID do not include the team ID prefix which is
871
- # present in the entitlements file.
872
- # e.g. <string>AB1GP98Q19.com.example.foo</string>
873
- # vs
874
- # com.example.foo
875
- /usr/bin/sed -i .bak "s!${OLD_BUNDLE_ID}</string>!${NEW_BUNDLE_ID}</string>!g" "$PATCHED_ENTITLEMENTS"
878
+ # Anchor the replacement to OLD_TEAM_ID prefix, app group prefix, or the opening <string> tag
879
+ # so that if NEW_BUNDLE_ID contains OLD_BUNDLE_ID as a suffix (e.g. enterprise.com.example.foo),
880
+ # the already-correct values (like <TEAM_ID>.enterprise.com.example.foo) do not have their
881
+ # suffix duplicated.
882
+ ESCAPED_OLD_BUNDLE_ID="${OLD_BUNDLE_ID//./\\.}"
883
+ if [ -n "$OLD_TEAM_ID" ] && [ -n "$NEW_TEAM_ID" ]; then
884
+ /usr/bin/sed -i .bak "s!<string>${OLD_TEAM_ID}\.${ESCAPED_OLD_BUNDLE_ID}</string>!<string>${NEW_TEAM_ID}.${NEW_BUNDLE_ID}</string>!g" "$PATCHED_ENTITLEMENTS"
885
+ fi
886
+ /usr/bin/sed -i .bak "s!<string>group\.${ESCAPED_OLD_BUNDLE_ID}</string>!<string>group.${NEW_BUNDLE_ID}</string>!g" "$PATCHED_ENTITLEMENTS"
887
+ /usr/bin/sed -i .bak "s!<string>${ESCAPED_OLD_BUNDLE_ID}</string>!<string>${NEW_BUNDLE_ID}</string>!g" "$PATCHED_ENTITLEMENTS"
876
888
 
877
889
  log "Resigning application using certificate: '$CERTIFICATE'"
878
890
  log "and patched entitlements:"
@@ -268,6 +268,11 @@ module Snapshot
268
268
  description: "Skips resolution of Swift Package Manager dependencies",
269
269
  type: Boolean,
270
270
  default_value: false),
271
+ FastlaneCore::ConfigItem.new(key: :disallow_xcodebuild_settings_lookup,
272
+ env_name: "SNAPSHOT_DISALLOW_XCODEBUILD_SETTINGS_LOOKUP",
273
+ description: "Raises an error instead of fetching build settings by running `xcodebuild -showBuildSettings`, which can take a long time on large projects. The error names the required build setting, so the corresponding option can be specified manually",
274
+ type: Boolean,
275
+ default_value: false),
271
276
  FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
272
277
  env_name: "SNAPSHOT_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
273
278
  description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file. This translates in the option `-disableAutomaticPackageResolution` being passed to xcodebuild",