fastlane 2.168.0 → 2.173.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +68 -68
  3. data/cert/lib/cert/options.rb +2 -2
  4. data/deliver/lib/deliver/app_screenshot.rb +5 -7
  5. data/deliver/lib/deliver/app_screenshot_validator.rb +108 -0
  6. data/deliver/lib/deliver/commands_generator.rb +1 -1
  7. data/deliver/lib/deliver/loader.rb +123 -21
  8. data/deliver/lib/deliver/setup.rb +8 -3
  9. data/deliver/lib/deliver/upload_metadata.rb +6 -10
  10. data/deliver/lib/deliver/upload_screenshots.rb +1 -64
  11. data/fastlane/lib/fastlane/actions/add_git_tag.rb +12 -3
  12. data/fastlane/lib/fastlane/actions/artifactory.rb +36 -3
  13. data/fastlane/lib/fastlane/actions/build_app.rb +3 -1
  14. data/fastlane/lib/fastlane/actions/create_pull_request.rb +16 -1
  15. data/fastlane/lib/fastlane/actions/create_xcframework.rb +118 -0
  16. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +4 -0
  19. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +5 -1
  20. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +142 -0
  21. data/fastlane/lib/fastlane/actions/download_dsyms.rb +0 -1
  22. data/fastlane/lib/fastlane/actions/git_commit.rb +6 -2
  23. data/fastlane/lib/fastlane/actions/github_api.rb +14 -3
  24. data/fastlane/lib/fastlane/actions/nexus_upload.rb +1 -0
  25. data/fastlane/lib/fastlane/actions/onesignal.rb +13 -3
  26. data/fastlane/lib/fastlane/actions/pod_push.rb +9 -0
  27. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +9 -1
  28. data/fastlane/lib/fastlane/actions/register_device.rb +1 -1
  29. data/fastlane/lib/fastlane/actions/register_devices.rb +2 -1
  30. data/fastlane/lib/fastlane/actions/set_github_release.rb +21 -8
  31. data/fastlane/lib/fastlane/actions/slack.rb +4 -5
  32. data/fastlane/lib/fastlane/actions/spm.rb +2 -2
  33. data/fastlane/lib/fastlane/actions/swiftlint.rb +4 -4
  34. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +291 -0
  35. data/fastlane/lib/fastlane/actions/xcode_install.rb +8 -5
  36. data/fastlane/lib/fastlane/cli_tools_distributor.rb +3 -0
  37. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -1
  38. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -0
  39. data/fastlane/lib/fastlane/version.rb +1 -1
  40. data/fastlane/swift/Deliverfile.swift +2 -2
  41. data/fastlane/swift/DeliverfileProtocol.swift +2 -2
  42. data/fastlane/swift/Fastlane.swift +267 -45
  43. data/fastlane/swift/Gymfile.swift +2 -2
  44. data/fastlane/swift/GymfileProtocol.swift +15 -3
  45. data/fastlane/swift/Matchfile.swift +2 -2
  46. data/fastlane/swift/MatchfileProtocol.swift +2 -2
  47. data/fastlane/swift/Precheckfile.swift +2 -2
  48. data/fastlane/swift/PrecheckfileProtocol.swift +6 -2
  49. data/fastlane/swift/Scanfile.swift +2 -2
  50. data/fastlane/swift/ScanfileProtocol.swift +18 -2
  51. data/fastlane/swift/Screengrabfile.swift +2 -2
  52. data/fastlane/swift/ScreengrabfileProtocol.swift +2 -2
  53. data/fastlane/swift/Snapshotfile.swift +2 -2
  54. data/fastlane/swift/SnapshotfileProtocol.swift +15 -3
  55. data/fastlane_core/lib/fastlane_core/helper.rb +2 -2
  56. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +41 -16
  57. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +3 -4
  58. data/fastlane_core/lib/fastlane_core/project.rb +19 -6
  59. data/frameit/lib/frameit/device_types.rb +7 -1
  60. data/gym/lib/gym/error_handler.rb +8 -0
  61. data/gym/lib/gym/generators/build_command_generator.rb +3 -0
  62. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  63. data/gym/lib/gym/options.rb +19 -3
  64. data/match/lib/match/encryption/openssl.rb +4 -2
  65. data/match/lib/match/runner.rb +1 -1
  66. data/match/lib/match/storage/git_storage.rb +14 -10
  67. data/precheck/lib/precheck/options.rb +6 -1
  68. data/precheck/lib/precheck/rule_processor.rb +1 -1
  69. data/precheck/lib/precheck/runner.rb +1 -1
  70. data/scan/lib/scan/options.rb +22 -1
  71. data/scan/lib/scan/runner.rb +6 -1
  72. data/scan/lib/scan/slack_poster.rb +4 -1
  73. data/scan/lib/scan/test_command_generator.rb +3 -0
  74. data/screengrab/lib/screengrab/runner.rb +2 -0
  75. data/sigh/lib/sigh/runner.rb +1 -1
  76. data/snapshot/lib/assets/SnapshotHelper.swift +6 -2
  77. data/snapshot/lib/snapshot/options.rb +17 -2
  78. data/snapshot/lib/snapshot/update.rb +1 -1
  79. data/spaceship/lib/spaceship/client.rb +28 -1
  80. data/spaceship/lib/spaceship/connect_api.rb +6 -0
  81. data/spaceship/lib/spaceship/connect_api/api_client.rb +1 -1
  82. data/spaceship/lib/spaceship/connect_api/models/app.rb +19 -4
  83. data/spaceship/lib/spaceship/connect_api/models/app_data_usage.rb +59 -0
  84. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_category.rb +65 -0
  85. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_data_protection.rb +27 -0
  86. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_grouping.rb +18 -0
  87. data/spaceship/lib/spaceship/connect_api/models/app_data_usage_purposes.rb +37 -0
  88. data/spaceship/lib/spaceship/connect_api/models/app_data_usages_publish_state.rb +36 -0
  89. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  90. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +2 -0
  91. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +8 -1
  92. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +9 -0
  93. data/spaceship/lib/spaceship/connect_api/models/device.rb +30 -0
  94. data/spaceship/lib/spaceship/connect_api/response.rb +3 -1
  95. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +12 -0
  96. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +103 -0
  97. data/spaceship/lib/spaceship/errors.rb +19 -0
  98. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +19 -6
  99. data/spaceship/lib/spaceship/upgrade_2fa_later_client.rb +91 -0
  100. metadata +44 -23
  101. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  102. data/spaceship/lib/spaceship/connect_api/models/.app.rb.swp +0 -0
  103. data/spaceship/lib/spaceship/connect_api/models/.app_screenshot.rb.swp +0 -0
  104. data/spaceship/lib/spaceship/connect_api/models/.build.rb.swp +0 -0
@@ -45,6 +45,8 @@ module Frameit
45
45
  GREEN ||= "Green"
46
46
  PINK ||= "Pink"
47
47
  PURPLE ||= "Purple"
48
+ GRAPHITE ||= "Graphite"
49
+ PACIFIC_BLUE ||= "Pacific Blue"
48
50
 
49
51
  def self.all_colors
50
52
  Color.constants.map { |c| Color.const_get(c).upcase.gsub(' ', '_') }
@@ -110,7 +112,7 @@ module Frameit
110
112
  IPHONE_7 ||= Frameit::Device.new("iphone-7", "Apple iPhone 7", 5, [[750, 1334], [1334, 750]], 326, Color::MATTE_BLACK, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_47, :use_legacy_iphone7)
111
113
  IPHONE_7_PLUS ||= Frameit::Device.new("iphone-7-plus", "Apple iPhone 7 Plus", 5, [[1242, 2208], [2208, 1242]], 401, Color::MATTE_BLACK, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_55, :use_legacy_iphone7)
112
114
  IPHONE_8 ||= Frameit::Device.new("iphone-8", "Apple iPhone 8", 6, [[750, 1334], [1334, 750]], 326, Color::SPACE_GRAY)
113
- IPHONE_8_PLUS ||= Frameit::Device.new("iphone-8-plus", "Apple iPhone 8 Plus", 6, [[1080, 1920], [1920, 1080]], 401, Color::SPACE_GRAY)
115
+ IPHONE_8_PLUS ||= Frameit::Device.new("iphone-8-plus", "Apple iPhone 8 Plus", 6, [[1242, 2208], [2208, 1242]], 401, Color::SPACE_GRAY)
114
116
  IPHONE_X ||= Frameit::Device.new("iphone-X", "Apple iPhone X", 7, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_58, :use_legacy_iphonex)
115
117
  IPHONE_XS ||= Frameit::Device.new("iphone-XS", "Apple iPhone XS", 8, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_58, :use_legacy_iphonexs)
116
118
  IPHONE_XR ||= Frameit::Device.new("iphone-XR", "Apple iPhone XR", 8, [[828, 1792], [1792, 828]], 326, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_61, :use_legacy_iphonexr)
@@ -118,6 +120,10 @@ module Frameit
118
120
  IPHONE_11 ||= Frameit::Device.new("iphone-11", "Apple iPhone 11", 9, [[828, 1792], [1792, 828]], 326, Color::BLACK, Platform::IOS)
119
121
  IPHONE_11_PRO ||= Frameit::Device.new("iphone-11-pro", "Apple iPhone 11 Pro", 9, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS)
120
122
  IPHONE_11_PRO_MAX ||= Frameit::Device.new("iphone11-pro-max", "Apple iPhone 11 Pro Max", 9, [[1242, 2688], [2688, 1242]], 458, Color::SPACE_GRAY, Platform::IOS)
123
+ IPHONE_12 ||= Frameit::Device.new("iphone-12", "Apple iPhone 12", 10, [[1170, 2532], [2532, 1170]], 460, Color::BLACK, Platform::IOS)
124
+ IPHONE_12_PRO ||= Frameit::Device.new("iphone-12-pro", "Apple iPhone 12 Pro", 10, [[1170, 2532], [2532, 1170]], 460, Color::SPACE_GRAY, Platform::IOS)
125
+ IPHONE_12_PRO_MAX ||= Frameit::Device.new("iphone12-pro-max", "Apple iPhone 12 Pro Max", 10, [[1284, 2778], [2778, 1284]], 458, Color::GRAPHITE, Platform::IOS)
126
+ IPHONE_12_MINI ||= Frameit::Device.new("iphone-12-mini", "Apple iPhone 12 Mini", 10, [[1125, 2436], [2436, 1125]], 476, Color::BLACK, Platform::IOS)
121
127
  IPAD_10_2 ||= Frameit::Device.new("ipad-10-2", "Apple iPad 10.2", 1, [[1620, 2160], [2160, 1620]], 264, Color::SPACE_GRAY, Platform::IOS)
122
128
  IPAD_AIR_2 ||= Frameit::Device.new("ipad-air-2", "Apple iPad Air 2", 1, [[1536, 2048], [2048, 1536]], 264, Color::SPACE_GRAY, Platform::IOS, Deliver::AppScreenshot::ScreenSize::IOS_IPAD)
123
129
  IPAD_AIR_2019 ||= Frameit::Device.new("ipad-air-2019", "Apple iPad Air (2019)", 2, [[1668, 2224], [2224, 1668]], 265, Color::SPACE_GRAY, Platform::IOS)
@@ -127,6 +127,14 @@ module Gym
127
127
  UI.build_failure!("Archive invalid")
128
128
  end
129
129
 
130
+ def handle_empty_ipa
131
+ UI.build_failure!("IPA invalid")
132
+ end
133
+
134
+ def handle_empty_pkg
135
+ UI.build_failure!("PKG invalid")
136
+ end
137
+
130
138
  private
131
139
 
132
140
  # Just to make things easier
@@ -39,6 +39,9 @@ module Gym
39
39
  options << "-destination '#{config[:destination]}'" if config[:destination]
40
40
  options << "-archivePath #{archive_path.shellescape}" unless config[:skip_archive]
41
41
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
42
+ if config[:use_system_scm] && !options.include?("-scmProvider system")
43
+ options << "-scmProvider system"
44
+ end
42
45
  options << config[:xcargs] if config[:xcargs]
43
46
  options << "OTHER_SWIFT_FLAGS=\"-Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
44
47
 
@@ -75,7 +75,7 @@ module Gym
75
75
  Gym.cache[:ipa_path] = File.join(temporary_output_path, "#{Gym.config[:output_name]}.ipa")
76
76
  FileUtils.cp(path, Gym.cache[:ipa_path]) unless File.expand_path(path).casecmp?(File.expand_path(Gym.cache[:ipa_path]).downcase)
77
77
  else
78
- ErrorHandler.handle_empty_archive unless path
78
+ ErrorHandler.handle_empty_ipa unless path
79
79
  end
80
80
 
81
81
  Gym.cache[:ipa_path]
@@ -99,7 +99,7 @@ module Gym
99
99
  Gym.cache[:pkg_path] = File.join(temporary_output_path, "#{Gym.config[:output_name]}.pkg")
100
100
  FileUtils.cp(path, Gym.cache[:pkg_path]) unless File.expand_path(path).casecmp(File.expand_path(Gym.cache[:pkg_path]).downcase).zero?
101
101
  else
102
- ErrorHandler.handle_empty_archive unless path
102
+ ErrorHandler.handle_empty_pkg unless path
103
103
  end
104
104
 
105
105
  Gym.cache[:pkg_path]
@@ -105,11 +105,11 @@ module Gym
105
105
  FastlaneCore::ConfigItem.new(key: :export_method,
106
106
  short_option: "-j",
107
107
  env_name: "GYM_EXPORT_METHOD",
108
- description: "Method used to export the archive. Valid values are: app-store, ad-hoc, package, enterprise, development, developer-id",
108
+ description: "Method used to export the archive. Valid values are: app-store, validation, ad-hoc, package, enterprise, development, developer-id and mac-application",
109
109
  type: String,
110
110
  optional: true,
111
111
  verify_block: proc do |value|
112
- av = %w(app-store ad-hoc package enterprise development developer-id)
112
+ av = %w(app-store validation ad-hoc package enterprise development developer-id mac-application)
113
113
  UI.user_error!("Unsupported export_method '#{value}', must be: #{av}") unless av.include?(value)
114
114
  end),
115
115
  FastlaneCore::ConfigItem.new(key: :export_options,
@@ -279,7 +279,23 @@ module Gym
279
279
  env_name: "GYM_CLONED_SOURCE_PACKAGES_PATH",
280
280
  description: "Sets a custom path for Swift Package Manager dependencies",
281
281
  type: String,
282
- optional: true)
282
+ optional: true),
283
+ FastlaneCore::ConfigItem.new(key: :skip_package_dependencies_resolution,
284
+ env_name: "GYM_SKIP_PACKAGE_DEPENDENCIES_RESOLUTION",
285
+ description: "Skips resolution of Swift Package Manager dependencies",
286
+ type: Boolean,
287
+ default_value: false),
288
+ FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
289
+ env_name: "GYM_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
290
+ description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file",
291
+ type: Boolean,
292
+ default_value: false),
293
+ FastlaneCore::ConfigItem.new(key: :use_system_scm,
294
+ env_name: "GYM_USE_SYSTEM_SCM",
295
+ description: "Lets xcodebuild use system's scm configuration",
296
+ optional: true,
297
+ type: Boolean,
298
+ default_value: false)
283
299
  ]
284
300
  end
285
301
  end
@@ -30,6 +30,7 @@ module Match
30
30
 
31
31
  def encrypt_files
32
32
  files = []
33
+ password = fetch_password!
33
34
  iterate(self.working_directory) do |current|
34
35
  files << current
35
36
  encrypt_specific_file(path: current, password: password)
@@ -41,6 +42,7 @@ module Match
41
42
 
42
43
  def decrypt_files
43
44
  files = []
45
+ password = fetch_password!
44
46
  iterate(self.working_directory) do |current|
45
47
  files << current
46
48
  begin
@@ -50,7 +52,7 @@ module Match
50
52
  UI.error("Couldn't decrypt the repo, please make sure you enter the right password!")
51
53
  UI.user_error!("Invalid password passed via 'MATCH_PASSWORD'") if ENV["MATCH_PASSWORD"]
52
54
  clear_password
53
- self.decrypt_files # call itself
55
+ self.decrypt_files # Call itself
54
56
  return
55
57
  end
56
58
  UI.success("🔓 Decrypted '#{File.basename(current)}'") if FastlaneCore::Globals.verbose?
@@ -83,7 +85,7 @@ module Match
83
85
  end
84
86
 
85
87
  # Access the MATCH_PASSWORD, either from ENV variable, Keychain or user input
86
- def password
88
+ def fetch_password!
87
89
  password = ENV["MATCH_PASSWORD"]
88
90
  unless password
89
91
  item = Security::InternetPassword.find(server: server_name(self.keychain_name))
@@ -355,7 +355,7 @@ module Match
355
355
  devices = Spaceship::ConnectAPI::Device.all
356
356
  unless device_classes.empty?
357
357
  devices = devices.select do |device|
358
- device_classes.include?(device.device_class)
358
+ device_classes.include?(device.device_class) && device.enabled?
359
359
  end
360
360
  end
361
361
 
@@ -89,15 +89,7 @@ module Match
89
89
  command += " -b #{self.branch.shellescape} --single-branch"
90
90
  end
91
91
 
92
- unless self.git_private_key.nil?
93
- if File.file?(self.git_private_key)
94
- ssh_add = File.expand_path(self.git_private_key).shellescape.to_s
95
- else
96
- UI.message("Private key file does not exist, will continue by using it as a raw key.")
97
- ssh_add = "- <<< \"#{self.git_private_key}\""
98
- end
99
- command = "ssh-agent bash -c 'ssh-add #{ssh_add}; #{command}'"
100
- end
92
+ command = command_from_private_key(command) unless self.git_private_key.nil?
101
93
 
102
94
  UI.message("Cloning remote git repo...")
103
95
  if self.branch && !self.clone_branch_directly
@@ -170,6 +162,16 @@ module Match
170
162
  Dir[File.join(working_directory, "**", file_name, "*.#{file_ext}")]
171
163
  end
172
164
 
165
+ def command_from_private_key(command)
166
+ if File.file?(self.git_private_key)
167
+ ssh_add = File.expand_path(self.git_private_key).shellescape.to_s
168
+ else
169
+ UI.message("Private key file does not exist, will continue by using it as a raw key.")
170
+ ssh_add = "- <<< \"#{self.git_private_key}\""
171
+ end
172
+ return "ssh-agent bash -c 'ssh-add #{ssh_add}; #{command}'"
173
+ end
174
+
173
175
  private
174
176
 
175
177
  # Create and checkout an specific branch in the git repo
@@ -231,7 +233,9 @@ module Match
231
233
  def git_push(commands: [], commit_message: nil)
232
234
  commit_message ||= generate_commit_message
233
235
  commands << "git commit -m #{commit_message.shellescape}"
234
- commands << "git push origin #{self.branch.shellescape}"
236
+ git_push_command = "git push origin #{self.branch.shellescape}"
237
+ git_push_command = command_from_private_key(git_push_command) unless self.git_private_key.nil?
238
+ commands << git_push_command
235
239
 
236
240
  UI.message("Pushing changes to remote git repo...")
237
241
  Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
@@ -97,7 +97,12 @@ module Precheck
97
97
  description: "Should check in-app purchases?",
98
98
  is_string: false,
99
99
  optional: true,
100
- default_value: true)
100
+ default_value: true),
101
+ FastlaneCore::ConfigItem.new(key: :use_live,
102
+ env_name: "PRECHECK_USE_LIVE",
103
+ description: "Should force check live app?",
104
+ is_string: false,
105
+ default_value: false)
101
106
  ] + rules
102
107
  end
103
108
  end
@@ -130,7 +130,7 @@ module Precheck
130
130
  items = []
131
131
 
132
132
  # App info localizations
133
- app_info = app.fetch_edit_app_info
133
+ app_info = Precheck.config[:use_live] ? app.fetch_live_app_info : app.fetch_latest_app_info
134
134
  app_info_localizations = app_info.get_app_info_localizations
135
135
  app_info_localizations.each do |localization|
136
136
  items << collect_text_items_from_language_item(locale: localization.locale,
@@ -185,7 +185,7 @@ module Precheck
185
185
 
186
186
  def latest_app_version
187
187
  platform = Spaceship::ConnectAPI::Platform.map(Precheck.config[:platform])
188
- @latest_version ||= app.get_edit_app_store_version(platform: platform)
188
+ @latest_version ||= Precheck.config[:use_live] ? app.get_live_app_store_version(platform: platform) : app.get_latest_app_store_version(platform: platform)
189
189
  end
190
190
 
191
191
  # Makes sure the current App ID exists. If not, it will show an appropriate error message
@@ -411,6 +411,11 @@ module Scan
411
411
  description: "Only post on Slack if the tests fail",
412
412
  is_string: false,
413
413
  default_value: false),
414
+ FastlaneCore::ConfigItem.new(key: :slack_default_payloads,
415
+ env_name: "SCAN_SLACK_DEFAULT_PAYLOADS",
416
+ description: "Specifies default payloads to include in Slack messages. For more info visit https://docs.fastlane.tools/actions/slack",
417
+ optional: true,
418
+ type: Array),
414
419
 
415
420
  # misc
416
421
  FastlaneCore::ConfigItem.new(key: :destination,
@@ -445,7 +450,23 @@ module Scan
445
450
  env_name: "SCAN_CLONED_SOURCE_PACKAGES_PATH",
446
451
  description: "Sets a custom path for Swift Package Manager dependencies",
447
452
  type: String,
448
- optional: true)
453
+ optional: true),
454
+ FastlaneCore::ConfigItem.new(key: :skip_package_dependencies_resolution,
455
+ env_name: "SCAN_SKIP_PACKAGE_DEPENDENCIES_RESOLUTION",
456
+ description: "Skips resolution of Swift Package Manager dependencies",
457
+ type: Boolean,
458
+ default_value: false),
459
+ FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
460
+ env_name: "SCAN_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
461
+ description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file",
462
+ type: Boolean,
463
+ default_value: false),
464
+ FastlaneCore::ConfigItem.new(key: :use_system_scm,
465
+ env_name: "SCAN_USE_SYSTEM_SCM",
466
+ description: "Lets xcodebuild use system's scm configuration",
467
+ optional: true,
468
+ type: Boolean,
469
+ default_value: false)
449
470
 
450
471
  ]
451
472
  end
@@ -83,7 +83,12 @@ module Scan
83
83
  end
84
84
 
85
85
  def handle_results(tests_exit_status)
86
- return if Scan.config[:disable_xcpretty]
86
+ if Scan.config[:disable_xcpretty]
87
+ unless tests_exit_status == 0
88
+ UI.test_failure!("Test execution failed. Exit status: #{tests_exit_status}")
89
+ end
90
+ return
91
+ end
87
92
 
88
93
  result = TestResultParser.new.parse_result(test_results)
89
94
  SlackPoster.new.run(result)
@@ -1,5 +1,6 @@
1
1
  require 'fastlane/action'
2
2
  require 'fastlane/actions/slack'
3
+ require 'fastlane_core/configuration/configuration'
3
4
 
4
5
  require_relative 'module'
5
6
 
@@ -43,7 +44,7 @@ module Scan
43
44
  }
44
45
  end
45
46
 
46
- Fastlane::Actions::SlackAction.run({
47
+ options = FastlaneCore::Configuration.create(Fastlane::Actions::SlackAction.available_options, {
47
48
  message: "#{Scan.config[:app_name] || Scan.project.app_name} Tests:\n#{Scan.config[:slack_message]}",
48
49
  channel: channel,
49
50
  slack_url: Scan.config[:slack_url].to_s,
@@ -51,10 +52,12 @@ module Scan
51
52
  username: username,
52
53
  icon_url: icon_url,
53
54
  payload: {},
55
+ default_payloads: Scan.config[:slack_default_payloads],
54
56
  attachment_properties: {
55
57
  fields: fields
56
58
  }
57
59
  })
60
+ Fastlane::Actions::SlackAction.run(options)
58
61
  end
59
62
  end
60
63
  end
@@ -38,6 +38,9 @@ module Scan
38
38
  if config[:derived_data_path] && !options.include?("-derivedDataPath #{config[:derived_data_path].shellescape}")
39
39
  options << "-derivedDataPath #{config[:derived_data_path].shellescape}"
40
40
  end
41
+ if config[:use_system_scm] && !options.include?("-scmProvider system")
42
+ options << "-scmProvider system"
43
+ end
41
44
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
42
45
  if FastlaneCore::Helper.xcode_at_least?(10)
43
46
  options << "-parallel-testing-worker-count #{config[:concurrent_workers]}" if config[:concurrent_workers]
@@ -24,6 +24,8 @@ module Screengrab
24
24
  end
25
25
 
26
26
  def run
27
+ # Standardize the locales
28
+ @config[:locales].map! { |locale| locale.gsub("_", "-") }
27
29
  FastlaneCore::PrintTable.print_values(config: @config, hide_keys: [], title: "Summary for screengrab #{Fastlane::VERSION}")
28
30
 
29
31
  app_apk_path = @config.fetch(:app_apk_path, ask: false)
@@ -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.display_name, "- ID:", c.id + " - Expires", c.expires.strftime("%d/%m/%Y")].join(" ")
330
+ str = ["\t- Name:", c.display_name, "- ID:", c.id + " - Expires", Time.parse(c.expiration_date).strftime("%Y-%m-%d")].join(" ")
331
331
  UI.message(str.green)
332
332
  end
333
333
  end
@@ -180,7 +180,11 @@ open class Snapshot: NSObject {
180
180
  simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "")
181
181
 
182
182
  let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
183
- try image.pngData()?.write(to: path, options: .atomic)
183
+ #if swift(<5.0)
184
+ UIImagePNGRepresentation(image)?.write(to: path, options: .atomic)
185
+ #else
186
+ try image.pngData()?.write(to: path, options: .atomic)
187
+ #endif
184
188
  } catch let error {
185
189
  NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png")
186
190
  NSLog(error.localizedDescription)
@@ -223,7 +227,7 @@ open class Snapshot: NSObject {
223
227
  #if os(OSX)
224
228
  let homeDir = URL(fileURLWithPath: NSHomeDirectory())
225
229
  return homeDir.appendingPathComponent(cachePath)
226
- #elseif arch(i386) || arch(x86_64)
230
+ #elseif arch(i386) || arch(x86_64) || arch(arm64)
227
231
  guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else {
228
232
  throw SnapshotError.cannotFindSimulatorHomeDirectory
229
233
  }
@@ -123,7 +123,7 @@ module Snapshot
123
123
  type: Boolean),
124
124
  FastlaneCore::ConfigItem.new(key: :override_status_bar,
125
125
  env_name: 'SNAPSHOT_OVERRIDE_STATUS_BAR',
126
- description: "Enabling this option wil automatically override the status bar to show 9:41 AM, full battery, and full reception",
126
+ description: "Enabling this option will automatically override the status bar to show 9:41 AM, full battery, and full reception",
127
127
  default_value: false,
128
128
  is_string: false),
129
129
  FastlaneCore::ConfigItem.new(key: :localize_simulator,
@@ -253,6 +253,16 @@ module Snapshot
253
253
  description: "Sets a custom path for Swift Package Manager dependencies",
254
254
  type: String,
255
255
  optional: true),
256
+ FastlaneCore::ConfigItem.new(key: :skip_package_dependencies_resolution,
257
+ env_name: "SNAPSHOT_SKIP_PACKAGE_DEPENDENCIES_RESOLUTION",
258
+ description: "Skips resolution of Swift Package Manager dependencies",
259
+ type: Boolean,
260
+ default_value: false),
261
+ FastlaneCore::ConfigItem.new(key: :disable_package_automatic_updates,
262
+ env_name: "SNAPSHOT_DISABLE_PACKAGE_AUTOMATIC_UPDATES",
263
+ description: "Prevents packages from automatically being resolved to versions other than those recorded in the `Package.resolved` file",
264
+ type: Boolean,
265
+ default_value: false),
256
266
  FastlaneCore::ConfigItem.new(key: :testplan,
257
267
  env_name: "SNAPSHOT_TESTPLAN",
258
268
  description: "The testplan associated with the scheme that should be used for testing",
@@ -283,7 +293,12 @@ module Snapshot
283
293
  env_name: "SNAPSHOT_SUPPRESS_XCODE_OUTPUT",
284
294
  description: "Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path",
285
295
  type: Boolean,
286
- optional: true)
296
+ optional: true),
297
+ FastlaneCore::ConfigItem.new(key: :use_system_scm,
298
+ env_name: "SNAPSHOT_USE_SYSTEM_SCM",
299
+ description: "Lets xcodebuild use system's scm configuration",
300
+ type: Boolean,
301
+ default_value: false)
287
302
  ]
288
303
  end
289
304
  end
@@ -8,7 +8,7 @@ module Snapshot
8
8
  def self.find_helper
9
9
  paths = Dir["./**/SnapshotHelper.swift"] + Dir["./**/SnapshotHelperXcode8.swift"]
10
10
  # exclude assets in gym
11
- paths.reject { |p| p.include?("snapshot/lib/assets/") }
11
+ paths.reject { |p| p.include?("snapshot/lib/assets/") || p.include?("DerivedData") }
12
12
  end
13
13
 
14
14
  def update(force: false)
@@ -57,6 +57,7 @@ module Spaceship
57
57
  InternalServerError = Spaceship::InternalServerError
58
58
  BadGatewayError = Spaceship::BadGatewayError
59
59
  AccessForbiddenError = Spaceship::AccessForbiddenError
60
+ TooManyRequestsError = Spaceship::TooManyRequestsError
60
61
 
61
62
  def self.hostname
62
63
  raise "You must implement self.hostname"
@@ -402,6 +403,7 @@ module Spaceship
402
403
  # This will also handle 2 step verification and 2 factor authentication
403
404
  #
404
405
  # It is called in `send_login_request` of sub classes (which the method `login`, above, transferred over to via `do_login`)
406
+ # rubocop:disable Metrics/PerceivedComplexity
405
407
  def send_shared_login_request(user, password)
406
408
  # Check if we have a cached/valid session
407
409
  #
@@ -505,9 +507,19 @@ module Spaceship
505
507
  # User Credentials are wrong
506
508
  raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
507
509
  elsif response.status == 412 && AUTH_TYPES.include?(response.body["authType"])
510
+
511
+ if try_upgrade_2fa_later(response)
512
+ store_cookie
513
+ fetch_olympus_session
514
+ return true
515
+ end
516
+
508
517
  # Need to acknowledge Apple ID and Privacy statement - https://github.com/fastlane/fastlane/issues/12577
509
518
  # Looking for status of 412 might be enough but might be safer to keep looking only at what is being reported
510
- raise AppleIDAndPrivacyAcknowledgementNeeded.new, "Need to acknowledge to Apple's Apple ID and Privacy statement. Please manually log into https://appleid.apple.com (or https://appstoreconnect.apple.com) to acknowledge the statement."
519
+ raise AppleIDAndPrivacyAcknowledgementNeeded.new, "Need to acknowledge to Apple's Apple ID and Privacy statement. " \
520
+ "Please manually log into https://appleid.apple.com (or https://appstoreconnect.apple.com) to acknowledge the statement. " \
521
+ "Your account might also be asked to upgrade to 2FA. " \
522
+ "Set SPACESHIP_SKIP_2FA_UPGRADE=1 for fastlane to automaticaly bypass 2FA upgrade if possible."
511
523
  elsif (response['Set-Cookie'] || "").include?("itctx")
512
524
  raise "Looks like your Apple ID is not enabled for App Store Connect, make sure to be able to login online"
513
525
  else
@@ -516,6 +528,7 @@ module Spaceship
516
528
  end
517
529
  end
518
530
  end
531
+ # rubocop:enable Metrics/PerceivedComplexity
519
532
 
520
533
  # Get the `itctx` from the new (22nd May 2017) API endpoint "olympus"
521
534
  # Update (29th March 2019) olympus migrates to new appstoreconnect API
@@ -645,6 +658,17 @@ module Spaceship
645
658
  retry
646
659
  end
647
660
  raise ex # re-raise the exception
661
+ rescue TooManyRequestsError => ex
662
+ tries -= 1
663
+ unless tries.zero?
664
+ msg = "Timeout received: '#{ex.class}', '#{ex.message}'. Retrying after #{ex.retry_after} seconds (remaining: #{tries})..."
665
+ puts(msg) if Spaceship::Globals.verbose?
666
+ logger.warn(msg)
667
+
668
+ sleep(ex.retry_after) unless Object.const_defined?("SpecHelper")
669
+ retry
670
+ end
671
+ raise ex # re-raise the exception
648
672
  rescue \
649
673
  Faraday::ParsingError, # <h2>Internal Server Error</h2> with content type json
650
674
  InternalServerError => ex
@@ -873,6 +897,8 @@ module Spaceship
873
897
  msg = "Access forbidden"
874
898
  logger.warn(msg)
875
899
  raise AccessForbiddenError.new, msg
900
+ elsif resp_hash[:status] == 429
901
+ raise TooManyRequestsError, resp_hash
876
902
  end
877
903
 
878
904
  return response
@@ -911,3 +937,4 @@ module Spaceship
911
937
  end
912
938
 
913
939
  require 'spaceship/two_step_or_factor_client'
940
+ require 'spaceship/upgrade_2fa_later_client'