fastlane 2.162.0 → 2.167.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +78 -78
  3. data/cert/lib/cert/runner.rb +2 -2
  4. data/deliver/lib/deliver/app_screenshot.rb +6 -2
  5. data/deliver/lib/deliver/module.rb +2 -0
  6. data/deliver/lib/deliver/options.rb +3 -3
  7. data/deliver/lib/deliver/queue_worker.rb +14 -29
  8. data/deliver/lib/deliver/upload_metadata.rb +19 -5
  9. data/deliver/lib/deliver/upload_screenshots.rb +3 -5
  10. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  11. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/add_git_tag.rb +9 -2
  13. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +39 -3
  14. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +9 -0
  15. data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
  16. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
  17. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +5 -1
  18. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +9 -0
  19. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
  20. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
  21. data/fastlane/lib/fastlane/actions/import_from_git.rb +9 -1
  22. data/fastlane/lib/fastlane/actions/is_ci.rb +1 -1
  23. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
  24. data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
  25. data/fastlane/lib/fastlane/actions/register_devices.rb +50 -16
  26. data/fastlane/lib/fastlane/actions/set_changelog.rb +31 -3
  27. data/fastlane/lib/fastlane/actions/spm.rb +6 -0
  28. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -0
  29. data/fastlane/lib/fastlane/actions/update_fastlane.rb +29 -8
  30. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -2
  31. data/fastlane/lib/fastlane/cli_tools_distributor.rb +2 -2
  32. data/fastlane/lib/fastlane/fast_file.rb +74 -23
  33. data/fastlane/lib/fastlane/features.rb +1 -1
  34. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +2 -0
  35. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  36. data/fastlane/lib/fastlane/version.rb +1 -1
  37. data/fastlane/swift/Deliverfile.swift +1 -1
  38. data/fastlane/swift/DeliverfileProtocol.swift +4 -4
  39. data/fastlane/swift/Fastfile.swift +1 -1
  40. data/fastlane/swift/Fastlane.swift +73 -22
  41. data/fastlane/swift/Gymfile.swift +1 -1
  42. data/fastlane/swift/GymfileProtocol.swift +1 -1
  43. data/fastlane/swift/LaneFileProtocol.swift +15 -19
  44. data/fastlane/swift/MainProcess.swift +3 -1
  45. data/fastlane/swift/Matchfile.swift +1 -1
  46. data/fastlane/swift/MatchfileProtocol.swift +6 -2
  47. data/fastlane/swift/Precheckfile.swift +1 -1
  48. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  49. data/fastlane/swift/Runner.swift +1 -1
  50. data/fastlane/swift/Scanfile.swift +1 -1
  51. data/fastlane/swift/ScanfileProtocol.swift +5 -1
  52. data/fastlane/swift/Screengrabfile.swift +1 -1
  53. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  54. data/fastlane/swift/Snapshotfile.swift +1 -1
  55. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  56. data/fastlane/swift/SocketClient.swift +1 -1
  57. data/fastlane/swift/main.swift +1 -1
  58. data/fastlane_core/lib/fastlane_core/cert_checker.rb +12 -7
  59. data/fastlane_core/lib/fastlane_core/device_manager.rb +8 -4
  60. data/fastlane_core/lib/fastlane_core/helper.rb +10 -2
  61. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -3
  62. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -1
  63. data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +3 -1
  64. data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +8 -0
  65. data/gym/lib/gym/code_signing_mapping.rb +1 -1
  66. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  67. data/match/lib/match/importer.rb +33 -21
  68. data/match/lib/match/nuke.rb +9 -5
  69. data/match/lib/match/options.rb +7 -1
  70. data/pilot/lib/pilot/build_manager.rb +9 -3
  71. data/scan/lib/scan/detect_values.rb +8 -9
  72. data/scan/lib/scan/module.rb +4 -0
  73. data/scan/lib/scan/options.rb +9 -0
  74. data/scan/lib/scan/runner.rb +2 -1
  75. data/sigh/lib/assets/resign.sh +1 -1
  76. data/sigh/lib/sigh/download_all.rb +16 -4
  77. data/sigh/lib/sigh/runner.rb +4 -4
  78. data/snapshot/lib/assets/SnapshotHelper.swift +4 -0
  79. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  80. data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
  81. data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
  82. data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +1 -1
  83. data/spaceship/lib/spaceship/client.rb +7 -3
  84. data/spaceship/lib/spaceship/connect_api.rb +26 -0
  85. data/spaceship/lib/spaceship/connect_api/api_client.rb +9 -0
  86. data/spaceship/lib/spaceship/connect_api/client.rb +7 -4
  87. data/spaceship/lib/spaceship/connect_api/models/app.rb +51 -0
  88. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +9 -0
  89. data/spaceship/lib/spaceship/connect_api/models/custom_app_organization.rb +43 -0
  90. data/spaceship/lib/spaceship/connect_api/models/custom_app_user.rb +41 -0
  91. data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
  92. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +17 -0
  93. data/spaceship/lib/spaceship/connect_api/spaceship.rb +7 -4
  94. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  95. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  96. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +71 -0
  97. data/supply/lib/supply.rb +1 -1
  98. data/supply/lib/supply/uploader.rb +1 -1
  99. metadata +21 -18
@@ -82,29 +82,41 @@ module Match
82
82
  output_dir_certs = File.join(storage.prefixed_working_directory, "certs", cert_type.to_s)
83
83
  output_dir_profiles = File.join(storage.prefixed_working_directory, "profiles", prov_type.to_s)
84
84
 
85
- # Need to get the cert id by comparing base64 encoded cert content with certificate content from the API responses
86
- token = api_token(params)
87
- if token
88
- UI.message("Creating authorization token for App Store Connect API")
89
- Spaceship::ConnectAPI.token = token
85
+ should_skip_certificate_matching = params[:skip_certificate_matching]
86
+ # In case there is no access to Apple Developer portal but we have the certificates, keys and profiles
87
+ if should_skip_certificate_matching
88
+ cert_name = File.basename(cert_path, ".*")
89
+ p12_name = File.basename(p12_path, ".*")
90
+
91
+ # Make dir if doesn't exist
92
+ FileUtils.mkdir_p(output_dir_certs)
93
+ dest_cert_path = File.join(output_dir_certs, "#{cert_name}.cer")
94
+ dest_p12_path = File.join(output_dir_certs, "#{p12_name}.p12")
90
95
  else
91
- UI.message("Login to App Store Connect (#{params[:username]})")
92
- Spaceship::ConnectAPI.login(params[:username], use_portal: true, use_tunes: false, portal_team_id: params[:team_id], team_name: params[:team_name])
96
+ # Need to get the cert id by comparing base64 encoded cert content with certificate content from the API responses
97
+ token = api_token(params)
98
+ if token
99
+ UI.message("Creating authorization token for App Store Connect API")
100
+ Spaceship::ConnectAPI.token = token
101
+ else
102
+ UI.message("Login to App Store Connect (#{params[:username]})")
103
+ Spaceship::ConnectAPI.login(params[:username], use_portal: true, use_tunes: false, portal_team_id: params[:team_id], team_name: params[:team_name])
104
+ end
105
+ certs = Spaceship::ConnectAPI::Certificate.all(filter: { certificateType: certificate_type })
106
+
107
+ # Base64 encode contents to find match from API to find a cert ID
108
+ cert_contents_base_64 = Base64.strict_encode64(File.binread(cert_path))
109
+ matching_cert = certs.find do |cert|
110
+ cert.certificate_content == cert_contents_base_64
111
+ end
112
+
113
+ UI.user_error!("This certificate cannot be imported - the certificate contents did not match with any available on the Developer Portal") if matching_cert.nil?
114
+
115
+ # Make dir if doesn't exist
116
+ FileUtils.mkdir_p(output_dir_certs)
117
+ dest_cert_path = File.join(output_dir_certs, "#{matching_cert.id}.cer")
118
+ dest_p12_path = File.join(output_dir_certs, "#{matching_cert.id}.p12")
93
119
  end
94
- certs = Spaceship::ConnectAPI::Certificate.all(filter: { certificateType: certificate_type })
95
-
96
- # Base64 encode contents to find match from API to find a cert ID
97
- cert_contents_base_64 = Base64.strict_encode64(File.binread(cert_path))
98
- matching_cert = certs.find do |cert|
99
- cert.certificate_content == cert_contents_base_64
100
- end
101
-
102
- UI.user_error!("This certificate cannot be imported - the certificate contents did not match with any available on the Developer Portal") if matching_cert.nil?
103
-
104
- # Make dir if doesn't exist
105
- FileUtils.mkdir_p(output_dir_certs)
106
- dest_cert_path = File.join(output_dir_certs, "#{matching_cert.id}.cer")
107
- dest_p12_path = File.join(output_dir_certs, "#{matching_cert.id}.p12")
108
120
 
109
121
  files_to_commit = [dest_cert_path, dest_p12_path]
110
122
 
@@ -252,11 +252,15 @@ module Match
252
252
 
253
253
  self.encryption.encrypt_files if self.encryption
254
254
 
255
- # Now we need to commit and push all this too
256
- message = ["[fastlane]", "Nuked", "files", "for", type.to_s].join(" ")
257
- self.storage.save_changes!(files_to_commit: [],
258
- files_to_delete: files_to_delete,
259
- custom_message: message)
255
+ if files_to_delete.count > 0
256
+ # Now we need to save all this to the storage too, if needed
257
+ message = ["[fastlane]", "Nuked", "files", "for", type.to_s].join(" ")
258
+ self.storage.save_changes!(files_to_commit: [],
259
+ files_to_delete: files_to_delete,
260
+ custom_message: message)
261
+ else
262
+ UI.message("Your storage had no files to be deleted. This happens when you run `nuke` with an empty storage. Nothing to be worried about!")
263
+ end
260
264
  end
261
265
 
262
266
  private
@@ -65,7 +65,7 @@ module Match
65
65
  FastlaneCore::ConfigItem.new(key: :app_identifier,
66
66
  short_option: "-a",
67
67
  env_name: "MATCH_APP_IDENTIFIER",
68
- description: "The bundle identifier(s) of your app (comma-separated)",
68
+ description: "The bundle identifier(s) of your app (comma-separated string or array of strings)",
69
69
  type: Array, # we actually allow String and Array here
70
70
  skip_type_validation: true,
71
71
  code_gen_sensitive: true,
@@ -283,6 +283,12 @@ module Match
283
283
  optional: true,
284
284
  type: Boolean,
285
285
  default_value: false),
286
+ FastlaneCore::ConfigItem.new(key: :skip_certificate_matching,
287
+ env_name: "MATCH_SKIP_CERTIFICATE_MATCHING",
288
+ description: "Set to true if there is no access to Apple developer portal but there are certificates, keys and profiles provided. Only works with match import action",
289
+ optional: true,
290
+ type: Boolean,
291
+ default_value: false),
286
292
  FastlaneCore::ConfigItem.new(key: :output_path,
287
293
  env_name: "MATCH_OUTPUT_PATH",
288
294
  description: "Path in which to export certificates, key and profile",
@@ -192,7 +192,7 @@ module Pilot
192
192
  [
193
193
  build.app_version,
194
194
  build.version,
195
- (build.beta_build_metrics || []).map(&:install_count).reduce(:+)
195
+ (build.beta_build_metrics || []).map(&:install_count).compact.reduce(:+)
196
196
  ]
197
197
  end
198
198
 
@@ -273,9 +273,15 @@ module Pilot
273
273
  changelog
274
274
  end
275
275
 
276
+ def self.emoji_regex
277
+ # EmojiRegex::RGIEmoji is now preferred over EmojiRegex::Regex which is deprecated as of 3.2.0
278
+ # https://github.com/ticky/ruby-emoji-regex/releases/tag/v3.2.0
279
+ return defined?(EmojiRegex::RGIEmoji) ? EmojiRegex::RGIEmoji : EmojiRegex::Regex
280
+ end
281
+
276
282
  def self.strip_emoji(changelog)
277
- if changelog && changelog =~ EmojiRegex::Regex
278
- changelog.gsub!(EmojiRegex::Regex, "")
283
+ if changelog && changelog =~ emoji_regex
284
+ changelog.gsub!(emoji_regex, "")
279
285
  UI.important("Emoji symbols have been removed from the changelog, since they're not allowed by Apple.")
280
286
  end
281
287
  changelog
@@ -187,15 +187,12 @@ module Scan
187
187
  end
188
188
  end
189
189
 
190
+ # Convert array to lazy enumerable (evaluate map only when needed)
190
191
  # grab the first unempty evaluated array
191
- if default
192
- Scan.devices = [matches, default].lazy.map { |x|
193
- arr = x.call
194
- arr unless arr.empty?
195
- }.reject(&:nil?).first
196
- else
197
- Scan.devices = []
198
- end
192
+ Scan.devices = [matches, default].lazy.reject(&:nil?).map { |x|
193
+ arr = x.call
194
+ arr unless arr.empty?
195
+ }.reject(&:nil?).first
199
196
  end
200
197
 
201
198
  def self.min_xcode8?
@@ -212,7 +209,9 @@ module Scan
212
209
  end
213
210
 
214
211
  # building up the destination now
215
- if Scan.devices && Scan.devices.count > 0
212
+ if Scan.building_mac_catalyst_for_mac?
213
+ Scan.config[:destination] = ["platform=macOS,variant=Mac Catalyst"]
214
+ elsif Scan.devices && Scan.devices.count > 0
216
215
  Scan.config[:destination] = Scan.devices.map { |d| "platform=#{d.os_type} Simulator,id=#{d.udid}" }
217
216
  elsif Scan.project.mac_app?
218
217
  Scan.config[:destination] = min_xcode8? ? ["platform=macOS"] : ["platform=OS X"]
@@ -21,6 +21,10 @@ module Scan
21
21
  def scanfile_name
22
22
  "Scanfile"
23
23
  end
24
+
25
+ def building_mac_catalyst_for_mac?
26
+ Scan.project.supports_mac_catalyst? && Scan.config[:catalyst_platform] == "macos"
27
+ end
24
28
  end
25
29
 
26
30
  Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
@@ -419,6 +419,15 @@ module Scan
419
419
  description: "Use only if you're a pro, use the other options instead",
420
420
  is_string: false,
421
421
  optional: true),
422
+ FastlaneCore::ConfigItem.new(key: :catalyst_platform,
423
+ env_name: "SCAN_CATALYST_PLATFORM",
424
+ description: "Platform to build when using a Catalyst enabled app. Valid values are: ios, macos",
425
+ type: String,
426
+ optional: true,
427
+ verify_block: proc do |value|
428
+ av = %w(ios macos)
429
+ UI.user_error!("Unsupported export_method '#{value}', must be: #{av}") unless av.include?(value)
430
+ end),
422
431
  FastlaneCore::ConfigItem.new(key: :custom_report_file_name,
423
432
  env_name: "SCAN_CUSTOM_REPORT_FILE_NAME",
424
433
  description: "Sets custom full report file name when generating a single report",
@@ -16,6 +16,7 @@ module Scan
16
16
  class Runner
17
17
  def initialize
18
18
  @test_command_generator = TestCommandGenerator.new
19
+ @device_boot_datetime = DateTime.now
19
20
  end
20
21
 
21
22
  def run
@@ -184,7 +185,7 @@ module Scan
184
185
  UI.header("Collecting system logs")
185
186
  Scan.devices.each do |device|
186
187
  log_identity = "#{device.name}_#{device.os_type}_#{device.os_version}"
187
- FastlaneCore::Simulator.copy_logs(device, log_identity, Scan.config[:output_directory])
188
+ FastlaneCore::Simulator.copy_logs(device, log_identity, Scan.config[:output_directory], @device_boot_datetime)
188
189
  end
189
190
  end
190
191
 
@@ -535,7 +535,7 @@ function resign {
535
535
  fi
536
536
 
537
537
  # Check for and resign OnDemandResource folders
538
- ODR_DIR="$(dirname $APP_PATH)/OnDemandResources"
538
+ ODR_DIR="$(dirname "$APP_PATH")/OnDemandResources"
539
539
  if [ -d "$ODR_DIR" ]; then
540
540
  for assetpack in "$ODR_DIR"/*
541
541
  do
@@ -9,10 +9,16 @@ module Sigh
9
9
  class DownloadAll
10
10
  # Download all valid provisioning profiles
11
11
  def download_all(download_xcode_profiles: false)
12
- UI.message("Starting login with user '#{Sigh.config[:username]}'")
13
- Spaceship.login(Sigh.config[:username], nil)
14
- Spaceship.select_team
15
- UI.message("Successfully logged in")
12
+ if (token = api_token)
13
+ UI.message("Creating authorization token for App Store Connect API")
14
+ Spaceship::ConnectAPI.token = token
15
+ else
16
+ # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
17
+ # Prompts select team if multiple teams and none specified
18
+ UI.message("Starting login with user '#{Sigh.config[:username]}'")
19
+ Spaceship::ConnectAPI.login(Sigh.config[:username], nil, use_portal: true, use_tunes: false)
20
+ UI.message("Successfully logged in")
21
+ end
16
22
 
17
23
  if download_xcode_profiles
18
24
  UI.deprecated("The App Store Connect API does not support querying for Xcode managed profiles: --download_code_profiles is deprecated")
@@ -53,6 +59,12 @@ module Sigh
53
59
  download_profiles(profiles)
54
60
  end
55
61
 
62
+ def api_token
63
+ api_token ||= Spaceship::ConnectAPI::Token.create(Sigh.config[:api_key]) if Sigh.config[:api_key]
64
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(Sigh.config[:api_key_path]) if Sigh.config[:api_key_path]
65
+ return api_token
66
+ end
67
+
56
68
  # @param profiles [Array] Array of all the provisioning profiles we want to download
57
69
  def download_profiles(profiles)
58
70
  UI.important("No profiles available for download") if profiles.empty?
@@ -139,7 +139,7 @@ module Sigh
139
139
  # Skip certificates that failed to download
140
140
  next unless current_cert[:downloaded]
141
141
  file = Tempfile.new('cert')
142
- file.write(current_cert[:downloaded])
142
+ file.write(current_cert[:downloaded].force_encoding('UTF-8'))
143
143
  file.close
144
144
  if FastlaneCore::CertChecker.installed?(file.path)
145
145
  installed = true
@@ -303,7 +303,7 @@ module Sigh
303
303
  end
304
304
 
305
305
  if Sigh.config[:cert_owner_name]
306
- next unless c.owner_name.strip == Sigh.config[:cert_owner_name].strip
306
+ next unless c.display_name.strip == Sigh.config[:cert_owner_name].strip
307
307
  end
308
308
 
309
309
  true
@@ -315,7 +315,7 @@ module Sigh
315
315
  certificates = certificates.find_all do |c|
316
316
  file = Tempfile.new('cert')
317
317
  raw_data = Base64.decode64(c.certificate_content)
318
- file.write(raw_data)
318
+ file.write(raw_data.force_encoding("UTF-8"))
319
319
  file.close
320
320
 
321
321
  FastlaneCore::CertChecker.installed?(file.path)
@@ -327,7 +327,7 @@ module Sigh
327
327
  UI.important("Found more than one code signing identity. Choosing the first one. Check out `fastlane sigh --help` to see all available options.")
328
328
  UI.important("Available Code Signing Identities for current filters:")
329
329
  certificates.each do |c|
330
- str = ["\t- Name:", c.owner_name, "- ID:", c.id + " - Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
330
+ str = ["\t- Name:", c.display_name, "- ID:", c.id + " - Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
331
331
  UI.message(str.green)
332
332
  end
333
333
  end
@@ -165,7 +165,11 @@ open class Snapshot: NSObject {
165
165
  }
166
166
 
167
167
  let screenshot = XCUIScreen.main.screenshot()
168
+ #if os(iOS)
168
169
  let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image
170
+ #else
171
+ let image = screenshot.image
172
+ #endif
169
173
 
170
174
  guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
171
175
 
@@ -18,6 +18,7 @@ module Snapshot
18
18
 
19
19
  def initialize(launcher_configuration: nil)
20
20
  @launcher_config = launcher_configuration
21
+ @device_boot_datetime = DateTime.now
21
22
  end
22
23
 
23
24
  def collected_errors
@@ -192,7 +193,7 @@ module Snapshot
192
193
 
193
194
  UI.header("Collecting system logs #{device_name} - #{language}")
194
195
  log_identity = Digest::MD5.hexdigest(components.join("-"))
195
- FastlaneCore::Simulator.copy_logs(device, log_identity, language_folder)
196
+ FastlaneCore::Simulator.copy_logs(device, log_identity, language_folder, @device_boot_datetime)
196
197
  end
197
198
  end
198
199
  end
@@ -13,7 +13,7 @@ module Snapshot
13
13
  parts << "xcodebuild"
14
14
  parts += options(language, locale)
15
15
  parts += destination(devices)
16
- parts += build_settings
16
+ parts += build_settings(language, locale)
17
17
  parts += actions
18
18
  parts += suffix
19
19
  parts += pipe(log_path: log_path)
@@ -40,11 +40,13 @@ module Snapshot
40
40
  return options
41
41
  end
42
42
 
43
- def build_settings
43
+ def build_settings(language, locale)
44
44
  config = Snapshot.config
45
45
 
46
46
  build_settings = []
47
47
  build_settings << "FASTLANE_SNAPSHOT=YES"
48
+ build_settings << "FASTLANE_LANGUAGE=#{language}" if language
49
+ build_settings << "FASTLANE_LOCALE=#{locale}" if locale
48
50
  build_settings << "TEST_TARGET_NAME=#{config[:test_target_name].shellescape}" if config[:test_target_name]
49
51
 
50
52
  return build_settings
@@ -14,7 +14,7 @@ module Snapshot
14
14
  parts << "xcodebuild"
15
15
  parts += options(language, locale)
16
16
  parts += destination(device_type)
17
- parts += build_settings
17
+ parts += build_settings(language, locale)
18
18
  parts += actions
19
19
  parts += suffix
20
20
  parts += pipe(device_type, language, locale)
@@ -858,9 +858,7 @@ module Spaceship
858
858
 
859
859
  resp_hash = response.to_hash
860
860
  if resp_hash[:status] == 401
861
- msg = "Auth lost"
862
- logger.warn(msg)
863
- raise UnauthorizedAccessError.new, "Unauthorized Access"
861
+ handle_401(response)
864
862
  end
865
863
 
866
864
  if response.body.to_s.include?("<title>302 Found</title>")
@@ -881,6 +879,12 @@ module Spaceship
881
879
  end
882
880
  end
883
881
 
882
+ def handle_401(response)
883
+ msg = "Auth lost"
884
+ logger.warn(msg)
885
+ raise UnauthorizedAccessError.new, "Unauthorized Access"
886
+ end
887
+
884
888
  def send_request_auto_paginate(method, url_or_path, params, headers, &block)
885
889
  response = send_request(method, url_or_path, params, headers, &block)
886
890
  return response unless should_process_next_rel?(response)
@@ -31,6 +31,8 @@ require 'spaceship/connect_api/models/beta_tester_metric'
31
31
  require 'spaceship/connect_api/models/build'
32
32
  require 'spaceship/connect_api/models/build_delivery'
33
33
  require 'spaceship/connect_api/models/build_beta_detail'
34
+ require 'spaceship/connect_api/models/custom_app_organization'
35
+ require 'spaceship/connect_api/models/custom_app_user'
34
36
  require 'spaceship/connect_api/models/pre_release_version'
35
37
 
36
38
  require 'spaceship/connect_api/models/age_rating_declaration'
@@ -86,5 +88,29 @@ module Spaceship
86
88
  end
87
89
  end
88
90
  end
91
+
92
+ # Defined in the App Store Connect API docs:
93
+ #
94
+ # Used for creating BundleId and Device
95
+ module BundleIdPlatform
96
+ IOS = "IOS"
97
+ MAC_OS = "MAC_OS"
98
+
99
+ ALL = [IOS, MAC_OS]
100
+
101
+ def self.map(platform)
102
+ return platform if ALL.include?(platform)
103
+
104
+ # Map from fastlane input and Spaceship::TestFlight platform values
105
+ case platform.to_sym
106
+ when :osx, :macos, :mac
107
+ return Spaceship::ConnectAPI::Platform::MAC_OS
108
+ when :ios
109
+ return Spaceship::ConnectAPI::Platform::IOS
110
+ else
111
+ raise "Cannot find a matching platform for '#{platform}' - valid values are #{ALL.join(', ')}"
112
+ end
113
+ end
114
+ end
89
115
  end
90
116
  end
@@ -152,6 +152,7 @@ module Spaceship
152
152
 
153
153
  def with_asc_retry(tries = 5, &_block)
154
154
  tries = 1 if Object.const_defined?("SpecHelper")
155
+
155
156
  response = yield
156
157
 
157
158
  status = response.status if response
@@ -162,6 +163,10 @@ module Spaceship
162
163
  end
163
164
 
164
165
  return response
166
+ rescue UnauthorizedAccessError => error
167
+ # Catch unathorized access and re-raising
168
+ # There is no need to try again
169
+ raise error
165
170
  rescue => error
166
171
  tries -= 1
167
172
  puts(error) if Spaceship::Globals.verbose?
@@ -194,6 +199,10 @@ module Spaceship
194
199
  return Spaceship::ConnectAPI::Response.new(body: response.body, status: response.status, client: self)
195
200
  end
196
201
 
202
+ def handle_401(response)
203
+ raise UnauthorizedAccessError, handle_errors(response) if response && (response.body || {})['errors']
204
+ end
205
+
197
206
  def handle_errors(response)
198
207
  # Example error format
199
208
  # {