fastlane 2.196.0 → 2.212.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +88 -81
  4. data/cert/lib/cert/runner.rb +19 -8
  5. data/deliver/lib/assets/ScreenshotsHelp +29 -6
  6. data/deliver/lib/deliver/app_screenshot.rb +30 -4
  7. data/deliver/lib/deliver/app_screenshot_iterator.rb +1 -1
  8. data/deliver/lib/deliver/options.rb +6 -2
  9. data/deliver/lib/deliver/runner.rb +88 -24
  10. data/deliver/lib/deliver/submit_for_review.rb +25 -3
  11. data/deliver/lib/deliver/upload_price_tier.rb +3 -1
  12. data/deliver/lib/deliver/upload_screenshots.rb +2 -2
  13. data/fastlane/lib/assets/AppfileTemplate +1 -1
  14. data/fastlane/lib/assets/AppfileTemplate.swift +1 -1
  15. data/fastlane/lib/fastlane/actions/badge.rb +1 -1
  16. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/danger.rb +14 -0
  18. data/fastlane/lib/fastlane/actions/docs/build_app.md +5 -5
  19. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +19 -2
  20. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  21. data/fastlane/lib/fastlane/actions/docs/run_tests.md +1 -1
  22. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +1 -1
  23. data/fastlane/lib/fastlane/actions/download_dsyms.rb +62 -46
  24. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +15 -4
  25. data/fastlane/lib/fastlane/actions/ensure_xcode_version.rb +1 -1
  26. data/fastlane/lib/fastlane/actions/get_push_certificate.rb +1 -1
  27. data/fastlane/lib/fastlane/actions/get_version_number.rb +8 -3
  28. data/fastlane/lib/fastlane/actions/git_commit.rb +4 -6
  29. data/fastlane/lib/fastlane/actions/import_certificate.rb +1 -1
  30. data/fastlane/lib/fastlane/actions/notarize.rb +29 -11
  31. data/fastlane/lib/fastlane/actions/pod_lib_lint.rb +1 -1
  32. data/fastlane/lib/fastlane/actions/pod_push.rb +19 -1
  33. data/fastlane/lib/fastlane/actions/read_podspec.rb +1 -1
  34. data/fastlane/lib/fastlane/actions/run_tests.rb +19 -9
  35. data/fastlane/lib/fastlane/actions/set_github_release.rb +11 -5
  36. data/fastlane/lib/fastlane/actions/setup_ci.rb +13 -4
  37. data/fastlane/lib/fastlane/actions/trainer.rb +49 -0
  38. data/fastlane/lib/fastlane/actions/update_code_signing_settings.rb +31 -4
  39. data/fastlane/lib/fastlane/actions/update_info_plist.rb +1 -1
  40. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +10 -1
  41. data/fastlane/lib/fastlane/actions/upload_symbols_to_sentry.rb +1 -1
  42. data/fastlane/lib/fastlane/actions/verify_build.rb +1 -1
  43. data/fastlane/lib/fastlane/actions/xcode_install.rb +5 -1
  44. data/fastlane/lib/fastlane/actions/xcode_select.rb +1 -1
  45. data/fastlane/lib/fastlane/actions/xcodebuild.rb +8 -2
  46. data/fastlane/lib/fastlane/actions/xcodes.rb +152 -0
  47. data/fastlane/lib/fastlane/actions/xcov.rb +5 -0
  48. data/fastlane/lib/fastlane/actions/xcversion.rb +17 -7
  49. data/fastlane/lib/fastlane/cli_tools_distributor.rb +5 -0
  50. data/fastlane/lib/fastlane/commands_generator.rb +2 -1
  51. data/fastlane/lib/fastlane/documentation/docs_generator.rb +17 -12
  52. data/fastlane/lib/fastlane/fast_file.rb +18 -5
  53. data/fastlane/lib/fastlane/features.rb +3 -0
  54. data/fastlane/lib/fastlane/helper/xcodebuild_formatter_helper.rb +9 -0
  55. data/fastlane/lib/fastlane/helper/xcodes_helper.rb +28 -0
  56. data/fastlane/lib/fastlane/helper/xcversion_helper.rb +0 -9
  57. data/fastlane/lib/fastlane/lane_manager.rb +1 -1
  58. data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +1 -1
  59. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +5 -1
  60. data/fastlane/lib/fastlane/setup/setup_ios.rb +1 -1
  61. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +1 -1
  62. data/fastlane/lib/fastlane/swift_lane_manager.rb +11 -3
  63. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +54 -1
  64. data/fastlane/lib/fastlane/tools.rb +18 -1
  65. data/fastlane/lib/fastlane/version.rb +1 -1
  66. data/fastlane/swift/Actions.swift +1 -1
  67. data/fastlane/swift/Appfile.swift +2 -2
  68. data/fastlane/swift/ArgumentProcessor.swift +1 -1
  69. data/fastlane/swift/Atomic.swift +150 -0
  70. data/fastlane/swift/ControlCommand.swift +1 -1
  71. data/fastlane/swift/Deliverfile.swift +2 -2
  72. data/fastlane/swift/DeliverfileProtocol.swift +8 -4
  73. data/fastlane/swift/Fastlane.swift +570 -239
  74. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +30 -20
  75. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/xcshareddata/xcschemes/FastlaneRunner.xcscheme +1 -1
  76. data/fastlane/swift/Gymfile.swift +2 -2
  77. data/fastlane/swift/GymfileProtocol.swift +20 -8
  78. data/fastlane/swift/LaneFileProtocol.swift +2 -2
  79. data/fastlane/swift/MainProcess.swift +3 -3
  80. data/fastlane/swift/Matchfile.swift +2 -2
  81. data/fastlane/swift/MatchfileProtocol.swift +21 -5
  82. data/fastlane/swift/OptionalConfigValue.swift +1 -1
  83. data/fastlane/swift/Plugins.swift +1 -1
  84. data/fastlane/swift/Precheckfile.swift +2 -2
  85. data/fastlane/swift/PrecheckfileProtocol.swift +3 -3
  86. data/fastlane/swift/RubyCommand.swift +1 -1
  87. data/fastlane/swift/RubyCommandable.swift +1 -1
  88. data/fastlane/swift/Runner.swift +13 -9
  89. data/fastlane/swift/RunnerArgument.swift +1 -1
  90. data/fastlane/swift/Scanfile.swift +2 -2
  91. data/fastlane/swift/ScanfileProtocol.swift +31 -11
  92. data/fastlane/swift/Screengrabfile.swift +2 -2
  93. data/fastlane/swift/ScreengrabfileProtocol.swift +3 -3
  94. data/fastlane/swift/Snapshotfile.swift +2 -2
  95. data/fastlane/swift/SnapshotfileProtocol.swift +12 -8
  96. data/fastlane/swift/SocketClient.swift +9 -5
  97. data/fastlane/swift/SocketClientDelegateProtocol.swift +2 -2
  98. data/fastlane/swift/SocketResponse.swift +1 -1
  99. data/fastlane/swift/formatting/Brewfile.lock.json +46 -23
  100. data/fastlane/swift/main.swift +1 -1
  101. data/fastlane/swift/upgrade_manifest.json +1 -1
  102. data/fastlane_core/README.md +1 -0
  103. data/fastlane_core/lib/fastlane_core/cert_checker.rb +79 -17
  104. data/fastlane_core/lib/fastlane_core/device_manager.rb +5 -1
  105. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +10 -5
  106. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +409 -26
  107. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -0
  108. data/fastlane_core/lib/fastlane_core/project.rb +19 -2
  109. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +7 -0
  110. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +4 -2
  111. data/frameit/lib/frameit/device.rb +1 -1
  112. data/frameit/lib/frameit/device_types.rb +9 -0
  113. data/frameit/lib/frameit/editor.rb +16 -18
  114. data/frameit/lib/frameit/frame_downloader.rb +1 -1
  115. data/frameit/lib/frameit/trim_box.rb +6 -0
  116. data/gym/lib/gym/generators/build_command_generator.rb +70 -23
  117. data/gym/lib/gym/options.rb +30 -5
  118. data/match/lib/match/change_password.rb +2 -0
  119. data/match/lib/match/commands_generator.rb +2 -1
  120. data/match/lib/match/encryption/openssl.rb +1 -1
  121. data/match/lib/match/encryption.rb +3 -0
  122. data/match/lib/match/generator.rb +1 -0
  123. data/match/lib/match/importer.rb +10 -1
  124. data/match/lib/match/migrate.rb +4 -3
  125. data/match/lib/match/module.rb +54 -2
  126. data/match/lib/match/nuke.rb +114 -47
  127. data/match/lib/match/options.rb +22 -1
  128. data/match/lib/match/runner.rb +25 -6
  129. data/match/lib/match/setup.rb +1 -1
  130. data/match/lib/match/spaceship_ensure.rb +5 -2
  131. data/match/lib/match/storage/gitlab/client.rb +102 -0
  132. data/match/lib/match/storage/gitlab/secure_file.rb +65 -0
  133. data/match/lib/match/storage/gitlab_secure_files.rb +182 -0
  134. data/match/lib/match/storage/google_cloud_storage.rb +7 -6
  135. data/match/lib/match/storage/s3_storage.rb +3 -3
  136. data/match/lib/match/storage.rb +4 -0
  137. data/match/lib/match/table_printer.rb +2 -1
  138. data/match/lib/match/utils.rb +15 -2
  139. data/pem/lib/pem/manager.rb +30 -7
  140. data/pem/lib/pem/options.rb +9 -0
  141. data/pilot/lib/pilot/build_manager.rb +34 -14
  142. data/pilot/lib/pilot/options.rb +6 -1
  143. data/scan/lib/scan/detect_values.rb +6 -0
  144. data/scan/lib/scan/error_handler.rb +9 -0
  145. data/scan/lib/scan/options.rb +49 -9
  146. data/scan/lib/scan/runner.rb +171 -25
  147. data/scan/lib/scan/test_command_generator.rb +65 -5
  148. data/sigh/lib/sigh/download_all.rb +14 -2
  149. data/sigh/lib/sigh/module.rb +3 -1
  150. data/sigh/lib/sigh/options.rb +5 -0
  151. data/sigh/lib/sigh/runner.rb +12 -2
  152. data/snapshot/lib/assets/SnapshotHelper.swift +3 -3
  153. data/snapshot/lib/snapshot/latest_os_version.rb +2 -5
  154. data/snapshot/lib/snapshot/options.rb +24 -8
  155. data/snapshot/lib/snapshot/reports_generator.rb +1 -0
  156. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +10 -3
  157. data/snapshot/lib/snapshot/test_command_generator.rb +37 -2
  158. data/spaceship/lib/spaceship/client.rb +71 -40
  159. data/spaceship/lib/spaceship/commands_generator.rb +1 -1
  160. data/spaceship/lib/spaceship/connect_api/api_client.rb +10 -5
  161. data/spaceship/lib/spaceship/connect_api/models/actor.rb +26 -0
  162. data/spaceship/lib/spaceship/connect_api/models/app.rb +52 -6
  163. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  164. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +5 -0
  165. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +7 -0
  166. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +1 -1
  167. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +27 -10
  168. data/spaceship/lib/spaceship/connect_api/models/build.rb +4 -2
  169. data/spaceship/lib/spaceship/connect_api/models/build_bundle.rb +68 -0
  170. data/spaceship/lib/spaceship/connect_api/models/build_bundle_file_sizes.rb +34 -0
  171. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +2 -1
  172. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +4 -0
  173. data/spaceship/lib/spaceship/connect_api/models/device.rb +47 -4
  174. data/spaceship/lib/spaceship/connect_api/models/profile.rb +4 -0
  175. data/spaceship/lib/spaceship/connect_api/models/resolution_center_message.rb +29 -0
  176. data/spaceship/lib/spaceship/connect_api/models/resolution_center_thread.rb +67 -0
  177. data/spaceship/lib/spaceship/connect_api/models/review_rejection.rb +19 -0
  178. data/spaceship/lib/spaceship/connect_api/models/review_submission.rb +86 -0
  179. data/spaceship/lib/spaceship/connect_api/models/review_submission_item.rb +40 -0
  180. data/spaceship/lib/spaceship/connect_api/models/user.rb +5 -0
  181. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +19 -0
  182. data/spaceship/lib/spaceship/connect_api/response.rb +23 -6
  183. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +33 -2
  184. data/spaceship/lib/spaceship/connect_api/token.rb +5 -2
  185. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +124 -8
  186. data/spaceship/lib/spaceship/connect_api.rb +9 -0
  187. data/spaceship/lib/spaceship/errors.rb +34 -0
  188. data/spaceship/lib/spaceship/globals.rb +9 -0
  189. data/spaceship/lib/spaceship/hashcash.rb +52 -0
  190. data/spaceship/lib/spaceship/portal/certificate.rb +4 -3
  191. data/spaceship/lib/spaceship/spaceauth_runner.rb +1 -1
  192. data/spaceship/lib/spaceship/tunes/app_ratings.rb +6 -6
  193. data/spaceship/lib/spaceship/tunes/iap_families.rb +1 -1
  194. data/spaceship/lib/spaceship/tunes/tunes.rb +0 -1
  195. data/spaceship/lib/spaceship/tunes/tunes_client.rb +79 -21
  196. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +11 -3
  197. data/spaceship/lib/spaceship.rb +1 -0
  198. data/supply/lib/supply/client.rb +2 -7
  199. data/supply/lib/supply/options.rb +8 -0
  200. data/supply/lib/supply/uploader.rb +6 -2
  201. data/trainer/lib/assets/junit.xml.erb +28 -0
  202. data/trainer/lib/trainer/commands_generator.rb +51 -0
  203. data/trainer/lib/trainer/junit_generator.rb +31 -0
  204. data/trainer/lib/trainer/module.rb +10 -0
  205. data/trainer/lib/trainer/options.rb +66 -0
  206. data/trainer/lib/trainer/test_parser.rb +398 -0
  207. data/trainer/lib/trainer/xcresult.rb +403 -0
  208. data/trainer/lib/trainer.rb +7 -0
  209. metadata +49 -24
  210. data/spaceship/lib/spaceship/connect_api/testflight/.testflight.rb.swp +0 -0
  211. data/spaceship/lib/spaceship/tunes/user_detail.rb +0 -15
@@ -9,7 +9,7 @@ require_relative 'errors'
9
9
  require_relative 'iap_subscription_pricing_tier'
10
10
  require_relative 'pricing_tier'
11
11
  require_relative 'territory'
12
- require_relative 'user_detail'
12
+ require_relative '../connect_api/response'
13
13
  module Spaceship
14
14
  # rubocop:disable Metrics/ClassLength
15
15
  class TunesClient < Spaceship::Client
@@ -72,13 +72,13 @@ module Spaceship
72
72
  puts("Looking for App Store Connect Team with name #{t_name}") if Spaceship::Globals.verbose?
73
73
 
74
74
  teams.each do |t|
75
- t_id = t['contentProvider']['contentProviderId'].to_s if t['contentProvider']['name'].casecmp(t_name).zero?
75
+ t_id = t['providerId'].to_s if t['name'].casecmp(t_name).zero?
76
76
  end
77
77
 
78
78
  puts("Could not find team with name '#{t_name}', trying to fallback to default team") if t_id.length.zero?
79
79
  end
80
80
 
81
- t_id = teams.first['contentProvider']['contentProviderId'].to_s if teams.count == 1
81
+ t_id = teams.first['providerId'].to_s if teams.count == 1
82
82
 
83
83
  if t_id.length > 0
84
84
  puts("Looking for App Store Connect Team with ID #{t_id}") if Spaceship::Globals.verbose?
@@ -92,11 +92,11 @@ module Spaceship
92
92
  loop do
93
93
  puts("Multiple #{'App Store Connect teams'.yellow} found, please enter the number of the team you want to use: ")
94
94
  if ENV["FASTLANE_HIDE_TEAM_INFORMATION"].to_s.length == 0
95
+ first_team = teams.first
95
96
  puts("Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile:")
96
97
  puts("Alternatively you can pass the team name or team ID using the `FASTLANE_ITC_TEAM_ID` or `FASTLANE_ITC_TEAM_NAME` environment variable")
97
- first_team = teams.first["contentProvider"]
98
98
  puts("")
99
- puts(" itc_team_id \"#{first_team['contentProviderId']}\"")
99
+ puts(" itc_team_id \"#{first_team['providerId']}\"")
100
100
  puts("")
101
101
  puts("or")
102
102
  puts("")
@@ -106,7 +106,7 @@ module Spaceship
106
106
 
107
107
  # We're not using highline here, as spaceship doesn't have a dependency to fastlane_core or highline
108
108
  teams.each_with_index do |team, i|
109
- puts("#{i + 1}) \"#{team['contentProvider']['name']}\" (#{team['contentProvider']['contentProviderId']})")
109
+ puts("#{i + 1}) \"#{team['name']}\" (#{team['providerId']})")
110
110
  end
111
111
 
112
112
  unless Spaceship::Client::UserInterface.interactive?
@@ -119,7 +119,7 @@ module Spaceship
119
119
  team_to_use = teams[selected] if selected >= 0
120
120
 
121
121
  if team_to_use
122
- self.team_id = team_to_use['contentProvider']['contentProviderId'].to_s # actually set the team id here
122
+ self.team_id = team_to_use['providerId'].to_s # actually set the team id here
123
123
  return self.team_id
124
124
  end
125
125
  end
@@ -255,8 +255,68 @@ module Spaceship
255
255
  #####################################################
256
256
 
257
257
  def applications
258
- r = request(:get, 'ra/apps/manageyourapps/summary/v2')
259
- parse_response(r, 'data')['summaries']
258
+ # Doing this real bad puts for now until a more formal deprecation logic can get made
259
+ puts("Spaceship::Tunes::Application.all is deprecated")
260
+ puts(" It's using a temporary patch to keep it from raising an error but things may not work correctly")
261
+ puts(" Please consider switching to Spaceship::ConnectAPI if you can")
262
+ puts(" For more details - https://github.com/fastlane/fastlane/pull/20480")
263
+
264
+ # This legacy endpoint went offline around July 7th, 2022. This is a rough attempt
265
+ # at retrofitting using the newer App Store Connect API endpoints
266
+ #
267
+ # This could all be done easily with Spaceship::ConnectAPI::App.find but there were a lot of
268
+ # circular dependency issues that were very difficult to solve because. Spaceship::Tunes would be
269
+ # using Spaceship::ConnectAPI which uses Spaceship::Tunes
270
+ #
271
+ # However, using Spaceship::ConnectAPI::Response works. This will fetch multiple pages of app
272
+ # if it needs to
273
+ #
274
+ # https://github.com/fastlane/fastlane/pull/20480
275
+ r = request(:get, "https://appstoreconnect.apple.com/iris/v1/apps?include=appStoreVersions")
276
+ response = Spaceship::ConnectAPI::Response.new(
277
+ body: r.body,
278
+ status: r.status,
279
+ headers: r.headers,
280
+ client: nil
281
+ )
282
+
283
+ apps = response.all_pages do |url|
284
+ r = request(:get, url)
285
+ Spaceship::ConnectAPI::Response.new(
286
+ body: r.body,
287
+ status: r.status,
288
+ headers: r.headers,
289
+ client: nil
290
+ )
291
+ end.flat_map(&:to_models)
292
+
293
+ apps.map do |asc_app|
294
+ platforms = (asc_app.app_store_versions || []).map(&:platform).uniq.map do |asc_platform|
295
+ case asc_platform
296
+ when "TV_OS"
297
+ "appletvos"
298
+ when "MAC_OS"
299
+ "osx"
300
+ when "IOS"
301
+ "ios"
302
+ else
303
+ raise "Cannot find a matching platform for '#{asc_platform}'}"
304
+ end
305
+ end
306
+
307
+ {
308
+ 'adamId' => asc_app.id,
309
+ 'name' => asc_app.name,
310
+ 'vendorId' => "",
311
+ 'bundleId' => asc_app.bundle_id,
312
+ 'lastModifiedDate' => nil,
313
+ 'issuesCount' => nil,
314
+ 'iconUrl' => nil,
315
+ 'versionSets' => platforms.map do |platform|
316
+ { 'type' => 'app', 'platformString' => platform }
317
+ end
318
+ }
319
+ end
260
320
  end
261
321
 
262
322
  def app_details(app_id)
@@ -950,13 +1010,6 @@ module Spaceship
950
1010
  Spaceship::Tunes::AppVersionRef.factory(data)
951
1011
  end
952
1012
 
953
- # Fetches the User Detail information from ITC. This gets called often and almost never changes
954
- # so we cache it
955
- # @return [UserDetail] the response
956
- def user_detail_data
957
- @_cached_user_detail_data ||= Spaceship::Tunes::UserDetail.factory(user_details_data, self)
958
- end
959
-
960
1013
  #####################################################
961
1014
  # @!group CandiateBuilds
962
1015
  #####################################################
@@ -992,7 +1045,7 @@ module Spaceship
992
1045
  tries -= 1
993
1046
  if tries > 0
994
1047
  logger.warn("Received temporary server error from App Store Connect. Retrying the request...")
995
- sleep(3) unless Object.const_defined?("SpecHelper")
1048
+ sleep(3) unless Object.const_defined?(:SpecHelper)
996
1049
  retry
997
1050
  end
998
1051
  end
@@ -1560,7 +1613,7 @@ module Spaceship
1560
1613
  msg = "App Store Connect temporary error received: '#{ex.message}'. Retrying after #{seconds_to_sleep} seconds (remaining: #{tries})..."
1561
1614
  puts(msg)
1562
1615
  logger.warn(msg)
1563
- sleep(seconds_to_sleep) unless Object.const_defined?("SpecHelper")
1616
+ sleep(seconds_to_sleep) unless Object.const_defined?(:SpecHelper)
1564
1617
  retry
1565
1618
  end
1566
1619
  raise ex # re-raise the exception
@@ -1570,7 +1623,7 @@ module Spaceship
1570
1623
  msg = "Potential server error received: '#{ex.message}'. Retrying after 10 seconds (remaining: #{potential_server_error_tries})..."
1571
1624
  puts(msg)
1572
1625
  logger.warn(msg)
1573
- sleep(seconds_to_sleep) unless Object.const_defined?("SpecHelper")
1626
+ sleep(seconds_to_sleep) unless Object.const_defined?(:SpecHelper)
1574
1627
  retry
1575
1628
  end
1576
1629
  raise ex
@@ -1582,9 +1635,14 @@ module Spaceship
1582
1635
  @sso_token_for_video = nil
1583
1636
  end
1584
1637
 
1585
- # the contentProviderIr found in the UserDetail instance
1638
+ # the contentProviderId found in the user details data
1586
1639
  def content_provider_id
1587
- @content_provider_id ||= user_detail_data.content_provider_id
1640
+ return @content_provider_id if @content_provider_id
1641
+
1642
+ provider = user_details_data["provider"]["providerId"]
1643
+ @content_provider_id ||= provider.to_s if provider
1644
+
1645
+ return @content_provider_id
1588
1646
  end
1589
1647
 
1590
1648
  # the ssoTokenForImage found in the AppVersionRef instance
@@ -61,9 +61,17 @@ module Spaceship
61
61
 
62
62
  # Send token to server to get a valid session
63
63
  r = request(:post) do |req|
64
- req.url("https://idmsa.apple.com/appleauth/auth/verify/device/#{device_id}/securitycode")
64
+ req.url("https://idmsa.apple.com/appleauth/auth/verify/phone/securitycode")
65
65
  req.headers['Content-Type'] = 'application/json'
66
- req.body = { "code" => code.to_s }.to_json
66
+ req.body = {
67
+ "phoneNumber": {
68
+ "id": device_id
69
+ },
70
+ "securityCode": {
71
+ "code" => code.to_s
72
+ },
73
+ "mode": "sms"
74
+ }.to_json
67
75
  update_request_headers(req)
68
76
  end
69
77
 
@@ -164,7 +172,7 @@ module Spaceship
164
172
  body = { "securityCode" => { "code" => code.to_s } }.to_json
165
173
 
166
174
  # User exited by entering `sms` and wants to choose phone number for SMS
167
- if code == 'sms'
175
+ if code.casecmp?("sms")
168
176
  code_type = 'phone'
169
177
  body = request_two_factor_code_from_phone_choose(response.body["trustedPhoneNumbers"], code_length)
170
178
  end
@@ -3,6 +3,7 @@ require_relative 'spaceship/base'
3
3
  require_relative 'spaceship/client'
4
4
  require_relative 'spaceship/provider'
5
5
  require_relative 'spaceship/launcher'
6
+ require_relative 'spaceship/hashcash'
6
7
 
7
8
  # Middleware
8
9
  require_relative 'spaceship/stats_middleware'
@@ -266,14 +266,9 @@ module Supply
266
266
  filtered_tracks = tracks.select { |t| !t.releases.nil? && t.releases.any? { |r| r.name == version } }
267
267
 
268
268
  if filtered_tracks.length > 1
269
- # Production track takes precedence if version is present in multiple tracks
269
+ # Prefer tracks in production, beta, alpha, internal order
270
270
  # E.g.: A release might've been promoted from Alpha/Beta track. This means the release will be present in two or more tracks
271
- if filtered_tracks.any? { |t| t.track == Supply::Tracks::DEFAULT }
272
- filtered_tracks = filtered_tracks.select { |t| t.track == Supply::Tracks::DEFAULT }
273
- else
274
- # E.g.: A release might be in both Alpha & Beta (not sure if this is possible, just catching if it ever happens), giving Beta precedence.
275
- filtered_tracks = filtered_tracks.select { |t| t.track == Supply::Tracks::BETA }
276
- end
271
+ filtered_tracks = filtered_tracks.sort_by { |t| Supply::Tracks::DEFAULTS.index(t.track) || Float::INFINITY }
277
272
  end
278
273
 
279
274
  filtered_track = filtered_tracks.first
@@ -217,6 +217,14 @@ module Supply
217
217
  verify_block: proc do |value|
218
218
  UI.user_error!("'rollout' is no longer a valid track name - please use 'production' instead") if value.casecmp('rollout').zero?
219
219
  end),
220
+ FastlaneCore::ConfigItem.new(key: :track_promote_release_status,
221
+ env_name: "SUPPLY_TRACK_PROMOTE_RELEASE_STATUS",
222
+ optional: true,
223
+ description: "Promoted track release status (used when promoting a track) - valid values are #{Supply::ReleaseStatus::ALL.join(', ')}",
224
+ default_value: Supply::ReleaseStatus::COMPLETED,
225
+ verify_block: proc do |value|
226
+ UI.user_error!("Value must be one of '#{Supply::RELEASE_STATUS}'") unless Supply::ReleaseStatus::ALL.include?(value)
227
+ end),
220
228
  FastlaneCore::ConfigItem.new(key: :validate_only,
221
229
  env_name: "SUPPLY_VALIDATE_ONLY",
222
230
  optional: true,
@@ -164,6 +164,10 @@ module Supply
164
164
  UI.user_error!(%(Cannot specify rollout percentage when the release status is set to 'draft'))
165
165
  end
166
166
 
167
+ if Supply.config[:track_promote_release_status] == Supply::ReleaseStatus::DRAFT && Supply.config[:rollout]
168
+ UI.user_error!(%(Cannot specify rollout percentage when the track promote release status is set to 'draft'))
169
+ end
170
+
167
171
  unless Supply.config[:version_codes_to_retain].nil?
168
172
  Supply.config[:version_codes_to_retain] = Supply.config[:version_codes_to_retain].map(&:to_i)
169
173
  end
@@ -182,7 +186,7 @@ module Supply
182
186
  end
183
187
  else
184
188
  releases = releases.select do |release|
185
- release.status == Supply::ReleaseStatus::COMPLETED
189
+ release.status == Supply.config[:release_status]
186
190
  end
187
191
  end
188
192
 
@@ -200,7 +204,7 @@ module Supply
200
204
  release.status = Supply::ReleaseStatus::IN_PROGRESS
201
205
  release.user_fraction = rollout
202
206
  else
203
- release.status = Supply::ReleaseStatus::COMPLETED
207
+ release.status = Supply.config[:track_promote_release_status]
204
208
  release.user_fraction = nil
205
209
  end
206
210
 
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <% number_of_tests = 0 %>
3
+ <% number_of_failures = 0 %>
4
+ <% @results.each { |a| number_of_tests += a[:number_of_tests_excluding_retries] } %>
5
+ <% @results.each { |a| number_of_failures += a[:number_of_failures_excluding_retries] } %>
6
+
7
+ <testsuites tests="<%= number_of_tests %>" failures="<%= number_of_failures %>">
8
+ <% @results.each do |testsuite| %>
9
+ <testsuite name=<%= (testsuite[:target_name].nil? ? testsuite[:test_name] : testsuite[:target_name]).encode(:xml => :attr) %> tests="<%= testsuite[:number_of_tests_excluding_retries] %>" failures="<%= testsuite[:number_of_failures_excluding_retries] %>" <% if testsuite[:number_of_skipped] %>skipped="<%= testsuite[:number_of_skipped] %>" <% end %>time="<%= testsuite[:duration] %>">
10
+ <% unless testsuite[:configuration_name].nil? %>
11
+ <properties>
12
+ <property name="Configuration" value="<%= testsuite[:configuration_name] %>"/>
13
+ </properties>
14
+ <% end %>
15
+ <% testsuite[:tests].each do |test| %>
16
+ <testcase classname=<%= test[:test_group].encode(:xml => :attr) %> name=<%= test[:name].encode(:xml => :attr) %> time="<%= test[:duration] %>">
17
+ <% (test[:failures] || []).each do |failure| %>
18
+ <failure message=<%= failure[:failure_message].encode(:xml => :attr) %>>
19
+ </failure>
20
+ <% end %>
21
+ <% if test[:skipped] %>
22
+ <skipped/>
23
+ <% end %>
24
+ </testcase>
25
+ <% end %>
26
+ </testsuite>
27
+ <% end %>
28
+ </testsuites>
@@ -0,0 +1,51 @@
1
+ require 'commander'
2
+
3
+ require 'fastlane_core/configuration/configuration'
4
+ require 'fastlane_core/ui/help_formatter'
5
+
6
+ require_relative 'options'
7
+ require_relative 'test_parser'
8
+
9
+ require_relative 'module'
10
+
11
+ HighLine.track_eof = false
12
+
13
+ module Trainer
14
+ class CommandsGenerator
15
+ include Commander::Methods
16
+
17
+ def self.start
18
+ self.new.run
19
+ end
20
+
21
+ def run
22
+ program :version, Fastlane::VERSION
23
+ program :description, Trainer::DESCRIPTION
24
+ program :help, 'Author', 'Felix Krause <trainer@krausefx.com>'
25
+ program :help, 'Website', 'https://fastlane.tools'
26
+ program :help, 'GitHub', 'https://github.com/KrauseFx/trainer'
27
+ program :help_formatter, :compact
28
+
29
+ global_option('--verbose', 'Shows a more verbose output') { $verbose = true }
30
+
31
+ always_trace!
32
+
33
+ FastlaneCore::CommanderGenerator.new.generate(Trainer::Options.available_options)
34
+
35
+ command :run do |c|
36
+ c.syntax = 'trainer'
37
+ c.description = Trainer::DESCRIPTION
38
+
39
+ c.action do |args, options|
40
+ options = FastlaneCore::Configuration.create(Trainer::Options.available_options, options.__hash__)
41
+ FastlaneCore::PrintTable.print_values(config: options, title: "Summary for trainer #{Fastlane::VERSION}") if $verbose
42
+ Trainer::TestParser.auto_convert(options)
43
+ end
44
+ end
45
+
46
+ default_command(:run)
47
+
48
+ run!
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,31 @@
1
+ require_relative 'module'
2
+
3
+ module Trainer
4
+ class JunitGenerator
5
+ attr_accessor :results
6
+
7
+ def initialize(results)
8
+ self.results = results
9
+ end
10
+
11
+ def generate
12
+ # JUnit file documentation: http://llg.cubic.org/docs/junit/
13
+ # And http://nelsonwells.net/2012/09/how-jenkins-ci-parses-and-displays-junit-output/
14
+ # And http://windyroad.com.au/dl/Open%20Source/JUnit.xsd
15
+
16
+ lib_path = Trainer::ROOT
17
+ xml_path = File.join(lib_path, "lib/assets/junit.xml.erb")
18
+ xml = ERB.new(File.read(xml_path), trim_mode: '<>').result(binding) # http://www.rrn.dk/rubys-erb-templating-system
19
+
20
+ xml = xml.gsub('system_', 'system-').delete("\e") # Jenkins can not parse 'ESC' symbol
21
+
22
+ # We have to manually clear empty lines
23
+ # They may contain white spaces
24
+ clean_xml = []
25
+ xml.each_line do |row|
26
+ clean_xml << row.delete("\n") if row.strip.to_s.length > 0
27
+ end
28
+ return clean_xml.join("\n")
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ require 'fastlane_core/helper'
2
+ require 'fastlane/boolean'
3
+
4
+ module Trainer
5
+ Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
6
+ UI = FastlaneCore::UI
7
+ Boolean = Fastlane::Boolean
8
+ ROOT = Pathname.new(File.expand_path('../../..', __FILE__))
9
+ DESCRIPTION = "Convert xcodebuild plist and xcresult files to JUnit reports"
10
+ end
@@ -0,0 +1,66 @@
1
+ require 'fastlane_core/configuration/config_item'
2
+
3
+ require_relative 'module'
4
+
5
+ module Trainer
6
+ class Options
7
+ def self.available_options
8
+ @options ||= [
9
+ FastlaneCore::ConfigItem.new(key: :path,
10
+ short_option: "-p",
11
+ env_name: "TRAINER_PATH",
12
+ default_value: ".",
13
+ description: "Path to the directory that should be converted",
14
+ verify_block: proc do |value|
15
+ v = File.expand_path(value.to_s)
16
+ if v.end_with?(".plist")
17
+ UI.user_error!("Can't find file at path #{v}") unless File.exist?(v)
18
+ else
19
+ UI.user_error!("Path '#{v}' is not a directory or can't be found") unless File.directory?(v)
20
+ end
21
+ end),
22
+ FastlaneCore::ConfigItem.new(key: :extension,
23
+ short_option: "-e",
24
+ env_name: "TRAINER_EXTENSION",
25
+ default_value: ".xml",
26
+ description: "The extension for the newly created file. Usually .xml or .junit",
27
+ verify_block: proc do |value|
28
+ UI.user_error!("extension must contain a `.`") unless value.include?(".")
29
+ end),
30
+ FastlaneCore::ConfigItem.new(key: :output_directory,
31
+ short_option: "-o",
32
+ env_name: "TRAINER_OUTPUT_DIRECTORY",
33
+ default_value: nil,
34
+ optional: true,
35
+ description: "Directory in which the xml files should be written to. Same directory as source by default"),
36
+ FastlaneCore::ConfigItem.new(key: :output_filename,
37
+ short_option: "-f",
38
+ env_name: "TRAINER_OUTPUT_FILENAME",
39
+ default_value: nil,
40
+ optional: true,
41
+ description: "Filename the xml file should be written to. Defaults to name of input file. (Only works if one input file is used)"),
42
+ FastlaneCore::ConfigItem.new(key: :fail_build,
43
+ env_name: "TRAINER_FAIL_BUILD",
44
+ description: "Should this step stop the build if the tests fail? Set this to false if you're handling this with a test reporter",
45
+ is_string: false,
46
+ default_value: true),
47
+ FastlaneCore::ConfigItem.new(key: :xcpretty_naming,
48
+ short_option: "-x",
49
+ env_name: "TRAINER_XCPRETTY_NAMING",
50
+ description: "Produces class name and test name identical to xcpretty naming in junit file",
51
+ is_string: false,
52
+ default_value: false),
53
+ FastlaneCore::ConfigItem.new(key: :silent,
54
+ env_name: "TRAINER_SILENT",
55
+ description: "Silences all output",
56
+ is_string: false,
57
+ default_value: false),
58
+ FastlaneCore::ConfigItem.new(key: :output_remove_retry_attempts,
59
+ env_name: "TRAINER_OUTPUT_REMOVE_RETRY_ATTEMPTS",
60
+ description: "Doesn't include retry attempts in the output",
61
+ is_string: false,
62
+ default_value: false)
63
+ ]
64
+ end
65
+ end
66
+ end