fastlane 2.154.0 → 2.156.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +74 -74
  3. data/deliver/lib/deliver/app_screenshot_iterator.rb +98 -0
  4. data/deliver/lib/deliver/html_generator.rb +8 -1
  5. data/deliver/lib/deliver/queue_worker.rb +64 -0
  6. data/deliver/lib/deliver/upload_screenshots.rb +122 -125
  7. data/fastlane/lib/fastlane/actions/create_keychain.rb +5 -1
  8. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +5 -0
  9. data/fastlane/lib/fastlane/version.rb +1 -1
  10. data/fastlane/swift/Deliverfile.swift +1 -1
  11. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  12. data/fastlane/swift/Fastlane.swift +375 -182
  13. data/fastlane/swift/Gymfile.swift +1 -1
  14. data/fastlane/swift/GymfileProtocol.swift +1 -1
  15. data/fastlane/swift/Matchfile.swift +1 -1
  16. data/fastlane/swift/MatchfileProtocol.swift +6 -2
  17. data/fastlane/swift/Precheckfile.swift +1 -1
  18. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  19. data/fastlane/swift/Scanfile.swift +1 -1
  20. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  21. data/fastlane/swift/Screengrabfile.swift +1 -1
  22. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  23. data/fastlane/swift/Snapshotfile.swift +1 -1
  24. data/fastlane/swift/SnapshotfileProtocol.swift +5 -1
  25. data/fastlane_core/lib/fastlane_core/project.rb +1 -0
  26. data/gym/lib/gym/detect_values.rb +6 -3
  27. data/gym/lib/gym/generators/build_command_generator.rb +0 -1
  28. data/gym/lib/gym/module.rb +22 -0
  29. data/gym/lib/gym/runner.rb +8 -10
  30. data/match/lib/match/generator.rb +6 -0
  31. data/match/lib/match/options.rb +7 -2
  32. data/match/lib/match/runner.rb +12 -5
  33. data/match/lib/match/spaceship_ensure.rb +7 -9
  34. data/match/lib/match/storage/google_cloud_storage.rb +1 -1
  35. data/scan/lib/scan/test_command_generator.rb +3 -1
  36. data/screengrab/lib/screengrab/runner.rb +7 -7
  37. data/sigh/lib/sigh/download_all.rb +42 -27
  38. data/sigh/lib/sigh/module.rb +26 -0
  39. data/sigh/lib/sigh/options.rb +2 -2
  40. data/sigh/lib/sigh/runner.rb +100 -35
  41. data/snapshot/lib/snapshot/options.rb +5 -0
  42. data/snapshot/lib/snapshot/test_command_generator.rb +3 -2
  43. data/snapshot/lib/snapshot/test_command_generator_base.rb +3 -1
  44. data/snapshot/lib/snapshot/test_command_generator_xcode_8.rb +4 -1
  45. data/spaceship/lib/spaceship/.client.rb.swp +0 -0
  46. data/spaceship/lib/spaceship/.spaceauth_runner.rb.swp +0 -0
  47. data/spaceship/lib/spaceship/.two_step_or_factor_client.rb.swp +0 -0
  48. data/spaceship/lib/spaceship/connect_api/client.rb +2 -0
  49. data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
  50. data/spaceship/lib/spaceship/connect_api/models/app.rb +3 -1
  51. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +17 -5
  52. data/spaceship/lib/spaceship/connect_api/models/bundle_id_capability.rb +41 -7
  53. data/spaceship/lib/spaceship/connect_api/models/profile.rb +32 -1
  54. data/spaceship/lib/spaceship/connect_api/provisioning/client.rb +46 -4
  55. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +41 -0
  56. data/supply/lib/supply/client.rb +2 -1
  57. data/supply/lib/supply/options.rb +8 -1
  58. metadata +24 -19
@@ -14,4 +14,4 @@ class Gymfile: GymfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.154.0
17
+ // Generated with fastlane 2.156.0
@@ -181,4 +181,4 @@ extension GymfileProtocol {
181
181
 
182
182
  // Please don't remove the lines below
183
183
  // They are used to detect outdated files
184
- // FastlaneRunnerAPIVersion [0.9.31]
184
+ // FastlaneRunnerAPIVersion [0.9.36]
@@ -14,4 +14,4 @@ class Matchfile: MatchfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.154.0
17
+ // Generated with fastlane 2.156.0
@@ -98,9 +98,12 @@ protocol MatchfileProtocol: class {
98
98
  /// Skip generation of a README.md for the created git repository
99
99
  var skipDocs: Bool { get }
100
100
 
101
- /// Set the provisioning profile's platform to work with (i.e. ios, tvos, macos)
101
+ /// Set the provisioning profile's platform to work with (i.e. ios, tvos, macos, catalyst)
102
102
  var platform: String { get }
103
103
 
104
+ /// Enable this if you have the Mac Catalyst capability enabled and your project was created with Xcode 11.3 or earlier. Prepends 'maccatalyst.' to the app identifier for the provisioning profile mapping
105
+ var deriveCatalystAppIdentifier: Bool { get }
106
+
104
107
  /// The name of provisioning profile template. If the developer account has provisioning profile templates (aka: custom entitlements), the template name can be found by inspecting the Entitlements drop-down while creating/editing a provisioning profile (e.g. "Apple Pay Pass Suppression Development")
105
108
  var templateName: String? { get }
106
109
 
@@ -152,6 +155,7 @@ extension MatchfileProtocol {
152
155
  var skipConfirmation: Bool { return false }
153
156
  var skipDocs: Bool { return false }
154
157
  var platform: String { return "ios" }
158
+ var deriveCatalystAppIdentifier: Bool { return false }
155
159
  var templateName: String? { return nil }
156
160
  var profileName: String? { return nil }
157
161
  var failOnNameTaken: Bool { return false }
@@ -161,4 +165,4 @@ extension MatchfileProtocol {
161
165
 
162
166
  // Please don't remove the lines below
163
167
  // They are used to detect outdated files
164
- // FastlaneRunnerAPIVersion [0.9.25]
168
+ // FastlaneRunnerAPIVersion [0.9.30]
@@ -14,4 +14,4 @@ class Precheckfile: PrecheckfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.154.0
17
+ // Generated with fastlane 2.156.0
@@ -33,4 +33,4 @@ extension PrecheckfileProtocol {
33
33
 
34
34
  // Please don't remove the lines below
35
35
  // They are used to detect outdated files
36
- // FastlaneRunnerAPIVersion [0.9.24]
36
+ // FastlaneRunnerAPIVersion [0.9.29]
@@ -14,4 +14,4 @@ class Scanfile: ScanfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.154.0
17
+ // Generated with fastlane 2.156.0
@@ -257,4 +257,4 @@ extension ScanfileProtocol {
257
257
 
258
258
  // Please don't remove the lines below
259
259
  // They are used to detect outdated files
260
- // FastlaneRunnerAPIVersion [0.9.36]
260
+ // FastlaneRunnerAPIVersion [0.9.41]
@@ -14,4 +14,4 @@ class Screengrabfile: ScreengrabfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.154.0
17
+ // Generated with fastlane 2.156.0
@@ -93,4 +93,4 @@ extension ScreengrabfileProtocol {
93
93
 
94
94
  // Please don't remove the lines below
95
95
  // They are used to detect outdated files
96
- // FastlaneRunnerAPIVersion [0.9.26]
96
+ // FastlaneRunnerAPIVersion [0.9.31]
@@ -14,4 +14,4 @@ class Snapshotfile: SnapshotfileProtocol {
14
14
  // during the `init` process, and you won't see this message
15
15
  }
16
16
 
17
- // Generated with fastlane 2.154.0
17
+ // Generated with fastlane 2.156.0
@@ -127,6 +127,9 @@ protocol SnapshotfileProtocol: class {
127
127
 
128
128
  /// Disable xcpretty formatting of build
129
129
  var disableXcpretty: Bool? { get }
130
+
131
+ /// Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path
132
+ var suppressXcodeOutput: Bool? { get }
130
133
  }
131
134
 
132
135
  extension SnapshotfileProtocol {
@@ -173,8 +176,9 @@ extension SnapshotfileProtocol {
173
176
  var onlyTesting: String? { return nil }
174
177
  var skipTesting: String? { return nil }
175
178
  var disableXcpretty: Bool? { return nil }
179
+ var suppressXcodeOutput: Bool? { return nil }
176
180
  }
177
181
 
178
182
  // Please don't remove the lines below
179
183
  // They are used to detect outdated files
180
- // FastlaneRunnerAPIVersion [0.9.20]
184
+ // FastlaneRunnerAPIVersion [0.9.25]
@@ -320,6 +320,7 @@ module FastlaneCore
320
320
  proj << "-scheme #{options[:scheme].shellescape}" if options[:scheme]
321
321
  proj << "-project #{options[:project].shellescape}" if options[:project]
322
322
  proj << "-configuration #{options[:configuration].shellescape}" if options[:configuration]
323
+ proj << "-derivedDataPath #{options[:derived_data_path].shellescape}" if options[:derived_data_path]
323
324
  proj << "-xcconfig #{options[:xcconfig].shellescape}" if options[:xcconfig]
324
325
 
325
326
  if FastlaneCore::Helper.xcode_at_least?('11.0') && options[:cloned_source_packages_path]
@@ -144,10 +144,13 @@ module Gym
144
144
  # Is it an iOS device or a Mac?
145
145
  def self.detect_platform
146
146
  return if Gym.config[:destination]
147
- platform = if Gym.project.mac? || Gym.building_mac_catalyst_for_mac?
148
- min_xcode8? ? "macOS" : "OS X"
149
- elsif Gym.project.tvos?
147
+
148
+ platform = if Gym.project.tvos?
150
149
  "tvOS"
150
+ elsif Gym.building_for_ios?
151
+ "iOS"
152
+ elsif Gym.building_for_mac?
153
+ min_xcode8? ? "macOS" : "OS X"
151
154
  else
152
155
  "iOS"
153
156
  end
@@ -38,7 +38,6 @@ module Gym
38
38
  options << "-toolchain '#{config[:toolchain]}'" if config[:toolchain]
39
39
  options << "-destination '#{config[:destination]}'" if config[:destination]
40
40
  options << "-archivePath #{archive_path.shellescape}" unless config[:skip_archive]
41
- options << "-derivedDataPath '#{config[:derived_data_path]}'" if config[:derived_data_path]
42
41
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
43
42
  options << config[:xcargs] if config[:xcargs]
44
43
  options << "OTHER_SWIFT_FLAGS=\"-Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
@@ -25,6 +25,28 @@ module Gym
25
25
  require 'gym/xcodebuild_fixes/generic_archive_fix'
26
26
  end
27
27
 
28
+ def building_for_ios?
29
+ if Gym.project.mac?
30
+ # Can be building for iOS if mac project and catalyst
31
+ return building_mac_catalyst_for_ios?
32
+ else
33
+ # Can be iOS project and build for mac if catalyst
34
+ return false if building_mac_catalyst_for_mac?
35
+
36
+ # Can be iOS project if iOS, tvOS, or watchOS
37
+ return Gym.project.ios? || Gym.project.tvos? || Gym.project.watchos?
38
+ end
39
+ end
40
+
41
+ def building_for_mac?
42
+ if Gym.project.supports_mac_catalyst?
43
+ # Can be a mac project and not build mac if catalyst
44
+ return building_mac_catalyst_for_mac?
45
+ else
46
+ return Gym.project.mac?
47
+ end
48
+ end
49
+
28
50
  def building_mac_catalyst_for_ios?
29
51
  Gym.project.supports_mac_catalyst? && Gym.config[:catalyst_platform] == "ios"
30
52
  end
@@ -13,7 +13,6 @@ require_relative 'error_handler'
13
13
  module Gym
14
14
  class Runner
15
15
  # @return (String) The path to the resulting ipa
16
- # rubocop:disable Metrics/PerceivedComplexity
17
16
  def run
18
17
  unless Gym.config[:skip_build_archive]
19
18
  build_app
@@ -24,12 +23,8 @@ module Gym
24
23
 
25
24
  FileUtils.mkdir_p(File.expand_path(Gym.config[:output_directory]))
26
25
 
27
- # Determine platform to archive
28
- is_mac = Gym.project.mac? || Gym.building_mac_catalyst_for_mac?
29
- is_ios = !is_mac && (Gym.project.ios? || Gym.project.tvos? || Gym.project.watchos?)
30
-
31
26
  # Archive
32
- if is_ios
27
+ if Gym.building_for_ios?
33
28
  fix_generic_archive unless Gym.project.watchos? # See https://github.com/fastlane/fastlane/pull/4325
34
29
  return BuildCommandGenerator.archive_path if Gym.config[:skip_package_ipa]
35
30
 
@@ -45,7 +40,7 @@ module Gym
45
40
  move_asset_packs
46
41
  move_appstore_info
47
42
  end
48
- elsif is_mac
43
+ elsif Gym.building_for_mac?
49
44
  path = File.expand_path(Gym.config[:output_directory])
50
45
  compress_and_move_dsym
51
46
  if Gym.project.mac_app? || Gym.building_mac_catalyst_for_mac?
@@ -280,11 +275,14 @@ module Gym
280
275
  app_path = File.join(BuildCommandGenerator.archive_path, "Products/Applications/#{exe_name}.app")
281
276
 
282
277
  UI.crash!("Couldn't find application in '#{BuildCommandGenerator.archive_path}'") unless File.exist?(app_path)
278
+
279
+ joined_app_path = File.join(Gym.config[:output_directory], File.basename(app_path))
280
+ FileUtils.rm_rf(joined_app_path)
283
281
  FileUtils.cp_r(app_path, File.expand_path(Gym.config[:output_directory]), remove_destination: true)
284
- app_path = File.join(Gym.config[:output_directory], File.basename(app_path))
282
+
285
283
  UI.success("Successfully exported the .app file:")
286
- UI.message(app_path)
287
- app_path
284
+ UI.message(joined_app_path)
285
+ joined_app_path
288
286
  end
289
287
 
290
288
  # Move the manifest.plist if exists into the output directory
@@ -14,7 +14,13 @@ module Match
14
14
  specific_cert_type = cert_type.to_s
15
15
  end
16
16
 
17
+ platform = params[:platform]
18
+ if platform.to_s == :catalyst.to_s
19
+ platform = :macos.to_s
20
+ end
21
+
17
22
  arguments = FastlaneCore::Configuration.create(Cert::Options.available_options, {
23
+ platform: platform,
18
24
  development: params[:type] == "development",
19
25
  type: specific_cert_type,
20
26
  generate_apple_certs: params[:generate_apple_certs],
@@ -235,14 +235,19 @@ module Match
235
235
  FastlaneCore::ConfigItem.new(key: :platform,
236
236
  short_option: '-o',
237
237
  env_name: "MATCH_PLATFORM",
238
- description: "Set the provisioning profile's platform to work with (i.e. ios, tvos, macos)",
238
+ description: "Set the provisioning profile's platform to work with (i.e. ios, tvos, macos, catalyst)",
239
239
  default_value: default_platform,
240
240
  default_value_dynamic: true,
241
241
  verify_block: proc do |value|
242
242
  value = value.to_s
243
- pt = %w(tvos ios macos)
243
+ pt = %w(tvos ios macos catalyst)
244
244
  UI.user_error!("Unsupported platform, must be: #{pt}") unless pt.include?(value)
245
245
  end),
246
+ FastlaneCore::ConfigItem.new(key: :derive_catalyst_app_identifier,
247
+ env_name: "MATCH_DERIVE_CATALYST_APP_IDENTIFIER",
248
+ description: "Enable this if you have the Mac Catalyst capability enabled and your project was created with Xcode 11.3 or earlier. Prepends 'maccatalyst.' to the app identifier for the provisioning profile mapping",
249
+ type: Boolean,
250
+ default_value: false),
246
251
  FastlaneCore::ConfigItem.new(key: :template_name,
247
252
  env_name: "MATCH_PROVISIONING_PROFILE_TEMPLATE_NAME",
248
253
  description: "The name of provisioning profile template. If the developer account has provisioning profile templates (aka: custom entitlements), the template name can be found by inspecting the Entitlements drop-down while creating/editing a provisioning profile (e.g. \"Apple Pay Pass Suppression Development\")",
@@ -207,20 +207,26 @@ module Match
207
207
  return File.basename(cert_path).gsub(".cer", "") # Certificate ID
208
208
  end
209
209
 
210
+ # rubocop:disable Metrics/PerceivedComplexity
210
211
  # @return [String] The UUID of the provisioning profile so we can verify it with the Apple Developer Portal
211
212
  def fetch_provisioning_profile(params: nil, certificate_id: nil, app_identifier: nil, working_directory: nil)
212
213
  prov_type = Match.profile_type_sym(params[:type])
213
214
 
214
215
  names = [Match::Generator.profile_type_name(prov_type), app_identifier]
215
- if params[:platform].to_s == :tvos.to_s
216
+ if params[:platform].to_s == :tvos.to_s || params[:platform].to_s == :catalyst.to_s
216
217
  names.push(params[:platform])
217
218
  end
218
219
 
219
220
  profile_name = names.join("_").gsub("*", '\*') # this is important, as it shouldn't be a wildcard
220
221
  base_dir = File.join(prefixed_working_directory, "profiles", prov_type.to_s)
221
222
 
222
- extension = params[:platform].to_s == :macos.to_s ? ".provisionprofile" : ".mobileprovision"
223
- profiles = Dir[File.join(base_dir, "#{profile_name}#{extension}")]
223
+ extension = ".mobileprovision"
224
+ if [:macos.to_s, :catalyst.to_s].include?(params[:platform].to_s)
225
+ extension = ".provisionprofile"
226
+ end
227
+
228
+ profile_file = "#{profile_name}#{extension}"
229
+ profiles = Dir[File.join(base_dir, profile_file)]
224
230
  if Helper.mac?
225
231
  keychain_path = FastlaneCore::Helper.keychain_path(params[:keychain_name]) unless params[:keychain_name].nil?
226
232
  end
@@ -242,7 +248,7 @@ module Match
242
248
 
243
249
  if profile.nil? || force
244
250
  if params[:readonly]
245
- UI.error("No matching provisioning profiles found for '#{profile_name}'")
251
+ UI.error("No matching provisioning profiles found for '#{profile_file}'")
246
252
  UI.error("A new one cannot be created because you enabled `readonly`")
247
253
  if Dir.exist?(base_dir) # folder for `prov_type` does not exist on first match use for that type
248
254
  all_profiles = Dir.entries(base_dir).reject { |f| f.start_with?(".") }
@@ -303,6 +309,7 @@ module Match
303
309
 
304
310
  return uuid
305
311
  end
312
+ # rubocop:enable Metrics/PerceivedComplexity
306
313
 
307
314
  def device_count_different?(profile: nil, keychain_path: nil, platform: nil)
308
315
  return false unless profile
@@ -320,7 +327,7 @@ module Match
320
327
  Spaceship.device.all_ios_profile_devices.count
321
328
  when :tvos
322
329
  Spaceship.device.all_apple_tvs.count
323
- when :mac
330
+ when :mac, :catalyst
324
331
  Spaceship.device.all_macs.count
325
332
  else
326
333
  Spaceship.device.all.count
@@ -46,6 +46,10 @@ module Match
46
46
  end
47
47
 
48
48
  def certificates_exists(username: nil, certificate_ids: [], platform: nil)
49
+ if platform == :catalyst.to_s
50
+ platform = :macos.to_s
51
+ end
52
+
49
53
  Spaceship.certificate.all(mac: platform == "macos").each do |cert|
50
54
  certificate_ids.delete(cert.id)
51
55
  end
@@ -61,18 +65,12 @@ module Match
61
65
  end
62
66
 
63
67
  def profile_exists(username: nil, uuid: nil, platform: nil)
64
- is_mac = platform == "macos"
65
- found = Spaceship.provisioning_profile.all(mac: is_mac).find do |profile|
68
+ # App Store Connect API does not allow filter of profile by platform or uuid (as of 2020-07-30)
69
+ # Need to fetch all profiles and search for uuid on client side
70
+ found = Spaceship::ConnectAPI::Profile.all.find do |profile|
66
71
  profile.uuid == uuid
67
72
  end
68
73
 
69
- # Look for iOS after looking for macOS (needed for Catalyst apps)
70
- if !found && is_mac
71
- found = Spaceship.provisioning_profile.all(mac: false).find do |profile|
72
- profile.uuid == uuid
73
- end
74
- end
75
-
76
74
  unless found
77
75
  UI.error("Provisioning profile '#{uuid}' is not available on the Developer Portal for the user #{username}, fixing this now for you 🔨")
78
76
  return false
@@ -213,7 +213,7 @@ module Match
213
213
 
214
214
  return DEFAULT_KEYS_FILE_NAME if File.exist?(DEFAULT_KEYS_FILE_NAME)
215
215
 
216
- fastlane_folder_gc_keys_path = File.join(FastlaneCore::FastlaneFolder.path, DEFAULT_KEYS_FILE_NAME)
216
+ fastlane_folder_gc_keys_path = File.join(FastlaneCore::FastlaneFolder.path || Dir.pwd, DEFAULT_KEYS_FILE_NAME)
217
217
  return fastlane_folder_gc_keys_path if File.exist?(fastlane_folder_gc_keys_path)
218
218
 
219
219
  if google_cloud_project_id.to_s.length > 0
@@ -35,7 +35,9 @@ module Scan
35
35
  options << "-sdk '#{config[:sdk]}'" if config[:sdk]
36
36
  options << destination # generated in `detect_values`
37
37
  options << "-toolchain '#{config[:toolchain]}'" if config[:toolchain]
38
- options << "-derivedDataPath '#{config[:derived_data_path]}'" if config[:derived_data_path]
38
+ if config[:derived_data_path] && !options.include?("-derivedDataPath #{config[:derived_data_path].shellescape}")
39
+ options << "-derivedDataPath #{config[:derived_data_path].shellescape}"
40
+ end
39
41
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
40
42
  if FastlaneCore::Helper.xcode_at_least?(10)
41
43
  options << "-parallel-testing-worker-count #{config[:concurrent_workers]}" if config[:concurrent_workers]
@@ -66,7 +66,7 @@ module Screengrab
66
66
  run_adb_command("-s #{device_serial} root", print_all: false, print_command: true)
67
67
  end
68
68
 
69
- clear_device_previous_screenshots(device_serial, device_screenshots_paths)
69
+ clear_device_previous_screenshots(@config[:app_package_name], device_serial, device_screenshots_paths)
70
70
 
71
71
  app_apk_path ||= select_app_apk(discovered_apk_paths)
72
72
  tests_apk_path ||= select_tests_apk(discovered_apk_paths)
@@ -157,12 +157,12 @@ module Screengrab
157
157
  end.flatten
158
158
  end
159
159
 
160
- def clear_device_previous_screenshots(device_serial, device_screenshots_paths)
160
+ def clear_device_previous_screenshots(app_package_name, device_serial, device_screenshots_paths)
161
161
  UI.message('Cleaning screenshots on device')
162
162
 
163
163
  device_screenshots_paths.each do |device_path|
164
- if_device_path_exists(device_serial, device_path) do |path|
165
- run_adb_command("-s #{device_serial} shell rm -rf #{path}",
164
+ if_device_path_exists(app_package_name, device_serial, device_path) do |path|
165
+ run_adb_command("-s #{device_serial} shell run-as #{app_package_name} rm -rf #{path}",
166
166
  print_all: true,
167
167
  print_command: true)
168
168
  end
@@ -296,7 +296,7 @@ module Screengrab
296
296
 
297
297
  Dir.mktmpdir do |tempdir|
298
298
  device_screenshots_paths.each do |device_path|
299
- if_device_path_exists(device_serial, device_path) do |path|
299
+ if_device_path_exists(@config[:app_package_name], device_serial, device_path) do |path|
300
300
  next unless path.include?(locale)
301
301
  run_adb_command("-s #{device_serial} pull #{path} #{tempdir}",
302
302
  print_all: false,
@@ -361,8 +361,8 @@ module Screengrab
361
361
 
362
362
  # Some device commands fail if executed against a device path that does not exist, so this helper method
363
363
  # provides a way to conditionally execute a block only if the provided path exists on the device.
364
- def if_device_path_exists(device_serial, device_path)
365
- return if run_adb_command("-s #{device_serial} shell ls #{device_path}",
364
+ def if_device_path_exists(app_package_name, device_serial, device_path)
365
+ return if run_adb_command("-s #{device_serial} shell run-as #{app_package_name} ls #{device_path}",
366
366
  print_all: false,
367
367
  print_command: false).include?('No such file')
368
368
 
@@ -1,5 +1,7 @@
1
1
  require 'spaceship'
2
2
 
3
+ require 'base64'
4
+
3
5
  require_relative 'manager'
4
6
  require_relative 'module'
5
7
 
@@ -12,35 +14,43 @@ module Sigh
12
14
  Spaceship.select_team
13
15
  UI.message("Successfully logged in")
14
16
 
17
+ if download_xcode_profiles
18
+ UI.deprecated("The App Store Connect API does not support querying for Xcode managed profiles: --download_code_profiles is deprecated")
19
+ end
20
+
15
21
  case Sigh.config[:platform].to_s
16
22
  when 'ios'
17
- download_profiles(Spaceship.provisioning_profile.all(xcode: download_xcode_profiles))
18
- xcode_profiles_downloaded?(xcode: download_xcode_profiles, supported: true)
23
+ profile_types = [
24
+ Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_STORE,
25
+ Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_INHOUSE,
26
+ Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_ADHOC,
27
+ Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_DEVELOPMENT
28
+ ]
19
29
  when 'macos'
20
- download_profiles(Spaceship.provisioning_profile.all(mac: true, xcode: download_xcode_profiles))
21
- xcode_profiles_downloaded?(xcode: download_xcode_profiles, supported: true)
30
+ profile_types = [
31
+ Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_STORE,
32
+ Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DEVELOPMENT,
33
+ Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT
34
+ ]
35
+ when 'catalyst'
36
+ profile_types = [
37
+ Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_STORE,
38
+ Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DEVELOPMENT,
39
+ Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT
40
+ ]
22
41
  when 'tvos'
23
- download_profiles(Spaceship.provisioning_profile.all_tvos)
24
- xcode_profiles_downloaded?(xcode: download_xcode_profiles, supported: false)
42
+ profile_types = [
43
+ Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_STORE,
44
+ Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_INHOUSE,
45
+ Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_ADHOC,
46
+ Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_DEVELOPMENT
47
+ ]
25
48
  end
26
- end
27
-
28
- # @param xcode [Bool] Whether or not the user passed the download_xcode_profiles flag
29
- # @param supported [Bool] Whether or not this platform supports downloading xcode profiles at all
30
- def xcode_profiles_downloaded?(xcode: false, supported: false)
31
- if supported
32
- if xcode
33
- UI.message("This run also included all Xcode managed provisioning profiles, as you used the `--download_xcode_profiles` flag")
34
- elsif !xcode
35
- UI.message("All Xcode managed provisioning profiles were ignored on this, to include them use the `--download_xcode_profiles` flag")
36
- end
37
49
 
38
- elsif !supported
39
- if xcode
40
- UI.important("Downloading Xcode managed profiles is not supported for platform #{Sigh.config[:platform]}")
41
- return
42
- end
43
- end
50
+ # Filtering on 'profileType' seems to be undocumented as of 2020-07-30
51
+ # but works on both web session and official API
52
+ profiles = Spaceship::ConnectAPI::Profile.all(filter: { profileType: profile_types.join(",") }, includes: "bundleId")
53
+ download_profiles(profiles)
44
54
  end
45
55
 
46
56
  # @param profiles [Array] Array of all the provisioning profiles we want to download
@@ -57,18 +67,22 @@ module Sigh
57
67
  end
58
68
  end
59
69
 
70
+ def pretty_type(profile_type)
71
+ return Sigh.profile_pretty_type(profile_type)
72
+ end
73
+
60
74
  # @param profile [ProvisioningProfile] A profile we plan to download and store
61
75
  def download_profile(profile)
62
76
  FileUtils.mkdir_p(Sigh.config[:output_path])
63
77
 
64
- type_name = profile.class.pretty_type
65
- profile_name = "#{type_name}_#{profile.uuid}_#{profile.app.bundle_id}"
78
+ type_name = pretty_type(profile.profile_type)
79
+ profile_name = "#{type_name}_#{profile.uuid}_#{profile.bundle_id.identifier}"
66
80
 
67
81
  if Sigh.config[:platform].to_s == 'tvos'
68
82
  profile_name += "_tvos"
69
83
  end
70
84
 
71
- if Sigh.config[:platform].to_s == 'macos'
85
+ if ['macos', 'catalyst'].include?(Sigh.config[:platform].to_s)
72
86
  profile_name += '.provisionprofile'
73
87
  else
74
88
  profile_name += '.mobileprovision'
@@ -76,7 +90,8 @@ module Sigh
76
90
 
77
91
  output_path = File.join(Sigh.config[:output_path], profile_name)
78
92
  File.open(output_path, "wb") do |f|
79
- f.write(profile.download)
93
+ content = Base64.decode64(profile.profile_content)
94
+ f.write(content)
80
95
  end
81
96
 
82
97
  Manager.install_profile(output_path) unless Sigh.config[:skip_install]