fastlane 2.160.0 → 2.165.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +78 -78
  3. data/cert/lib/cert/options.rb +28 -1
  4. data/cert/lib/cert/runner.rb +51 -34
  5. data/deliver/lib/deliver/app_screenshot_iterator.rb +4 -4
  6. data/deliver/lib/deliver/module.rb +2 -0
  7. data/deliver/lib/deliver/options.rb +5 -5
  8. data/deliver/lib/deliver/queue_worker.rb +14 -29
  9. data/deliver/lib/deliver/upload_metadata.rb +20 -5
  10. data/deliver/lib/deliver/upload_screenshots.rb +28 -13
  11. data/fastlane/lib/fastlane/actions/.download_dsyms.rb.swp +0 -0
  12. data/fastlane/lib/fastlane/actions/actions_helper.rb +20 -1
  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 +15 -1
  15. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +1 -0
  16. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +2 -2
  17. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +2 -2
  18. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  19. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +2 -2
  20. data/fastlane/lib/fastlane/actions/docs/run_tests.md +2 -2
  21. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +12 -3
  22. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -2
  23. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +1 -1
  24. data/fastlane/lib/fastlane/actions/download_dsyms.rb +1 -0
  25. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +13 -2
  26. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -0
  27. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -0
  28. data/fastlane/lib/fastlane/actions/import_from_git.rb +9 -1
  29. data/fastlane/lib/fastlane/actions/is_ci.rb +1 -1
  30. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +15 -0
  31. data/fastlane/lib/fastlane/actions/register_device.rb +46 -5
  32. data/fastlane/lib/fastlane/actions/register_devices.rb +50 -16
  33. data/fastlane/lib/fastlane/actions/set_changelog.rb +31 -3
  34. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -0
  35. data/fastlane/lib/fastlane/actions/upload_to_app_store.rb +3 -2
  36. data/fastlane/lib/fastlane/fast_file.rb +74 -23
  37. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -0
  38. data/fastlane/lib/fastlane/version.rb +1 -1
  39. data/fastlane/swift/Deliverfile.swift +1 -1
  40. data/fastlane/swift/DeliverfileProtocol.swift +4 -4
  41. data/fastlane/swift/Fastlane.swift +120 -27
  42. data/fastlane/swift/Gymfile.swift +1 -1
  43. data/fastlane/swift/GymfileProtocol.swift +1 -1
  44. data/fastlane/swift/LaneFileProtocol.swift +28 -36
  45. data/fastlane/swift/MainProcess.swift +1 -1
  46. data/fastlane/swift/Matchfile.swift +1 -1
  47. data/fastlane/swift/MatchfileProtocol.swift +21 -5
  48. data/fastlane/swift/Precheckfile.swift +1 -1
  49. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  50. data/fastlane/swift/Scanfile.swift +1 -1
  51. data/fastlane/swift/ScanfileProtocol.swift +1 -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/main.swift +1 -1
  57. data/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb +6 -7
  58. data/fastlane_core/lib/fastlane_core/device_manager.rb +8 -4
  59. data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
  60. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +3 -3
  61. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +2 -2
  62. data/match/lib/match/generator.rb +6 -1
  63. data/match/lib/match/importer.rb +63 -18
  64. data/match/lib/match/migrate.rb +13 -2
  65. data/match/lib/match/nuke.rb +65 -22
  66. data/match/lib/match/options.rb +34 -3
  67. data/match/lib/match/runner.rb +38 -10
  68. data/match/lib/match/spaceship_ensure.rb +27 -21
  69. data/match/lib/match/storage/google_cloud_storage.rb +20 -3
  70. data/match/lib/match/storage/s3_storage.rb +19 -3
  71. data/scan/lib/scan/detect_values.rb +5 -8
  72. data/scan/lib/scan/runner.rb +2 -1
  73. data/sigh/lib/assets/resign.sh +1 -1
  74. data/sigh/lib/sigh/download_all.rb +16 -4
  75. data/sigh/lib/sigh/options.rb +21 -0
  76. data/sigh/lib/sigh/runner.rb +83 -41
  77. data/snapshot/lib/assets/SnapshotHelper.swift +4 -0
  78. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  79. data/spaceship/README.md +1 -1
  80. data/spaceship/lib/spaceship/client.rb +9 -4
  81. data/spaceship/lib/spaceship/connect_api.rb +27 -0
  82. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -3
  83. data/spaceship/lib/spaceship/connect_api/client.rb +20 -7
  84. data/spaceship/lib/spaceship/connect_api/models/app.rb +51 -0
  85. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +3 -1
  86. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +2 -1
  87. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +42 -0
  88. data/spaceship/lib/spaceship/connect_api/models/custom_app_organization.rb +43 -0
  89. data/spaceship/lib/spaceship/connect_api/models/custom_app_user.rb +41 -0
  90. data/spaceship/lib/spaceship/connect_api/models/device.rb +5 -0
  91. data/spaceship/lib/spaceship/connect_api/models/profile.rb +7 -1
  92. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +59 -0
  93. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +45 -2
  94. data/spaceship/lib/spaceship/connect_api/spaceship.rb +7 -4
  95. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  96. data/spaceship/lib/spaceship/connect_api/token.rb +6 -1
  97. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +75 -1
  98. data/spaceship/lib/spaceship/connect_api/users/users.rb +40 -0
  99. data/spaceship/lib/spaceship/helper/net_http_generic_request.rb +11 -5
  100. data/supply/lib/supply/uploader.rb +1 -1
  101. metadata +19 -15
@@ -19,6 +19,8 @@ module Match
19
19
  attr_reader :username
20
20
  attr_reader :team_id
21
21
  attr_reader :team_name
22
+ attr_reader :api_key_path
23
+ attr_reader :api_key
22
24
 
23
25
  def self.configure(params)
24
26
  s3_region = params[:s3_region]
@@ -43,7 +45,9 @@ module Match
43
45
  readonly: params[:readonly],
44
46
  username: params[:username],
45
47
  team_id: params[:team_id],
46
- team_name: params[:team_name]
48
+ team_name: params[:team_name],
49
+ api_key_path: params[:api_key_path],
50
+ api_key: params[:api_key]
47
51
  )
48
52
  end
49
53
 
@@ -55,7 +59,9 @@ module Match
55
59
  readonly: nil,
56
60
  username: nil,
57
61
  team_id: nil,
58
- team_name: nil)
62
+ team_name: nil,
63
+ api_key_path: nil,
64
+ api_key: nil)
59
65
  @s3_bucket = s3_bucket
60
66
  @s3_region = s3_region
61
67
  @s3_client = Fastlane::Helper::S3ClientHelper.new(access_key: s3_access_key, secret_access_key: s3_secret_access_key, region: s3_region)
@@ -64,6 +70,8 @@ module Match
64
70
  @username = username
65
71
  @team_id = team_id
66
72
  @team_name = team_name
73
+ @api_key_path = api_key_path
74
+ @api_key = api_key
67
75
  end
68
76
 
69
77
  # To make debugging easier, we have a custom exception here
@@ -180,10 +188,18 @@ module Match
180
188
  # see `prefixed_working_directory` comments for more details
181
189
  return self.team_id
182
190
  else
183
- spaceship = SpaceshipEnsure.new(self.username, self.team_id, self.team_name)
191
+ UI.user_error!("The `team_id` option is required. fastlane cannot automatically determine portal team id via the App Store Connect API (yet)") if self.team_id.to_s.empty?
192
+
193
+ spaceship = SpaceshipEnsure.new(self.username, self.team_id, self.team_name, api_token)
184
194
  return spaceship.team_id
185
195
  end
186
196
  end
197
+
198
+ def api_token
199
+ api_token ||= Spaceship::ConnectAPI::Token.create(self.api_key) if self.api_key
200
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(self.api_key_path) if self.api_key_path
201
+ return api_token
202
+ end
187
203
  end
188
204
  end
189
205
  end
@@ -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?
@@ -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?
@@ -54,6 +54,25 @@ module Sigh
54
54
  code_gen_sensitive: true,
55
55
  default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
56
56
  default_value_dynamic: true),
57
+
58
+ # App Store Connect API
59
+ FastlaneCore::ConfigItem.new(key: :api_key_path,
60
+ env_name: "SIGH_API_KEY_PATH",
61
+ description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
62
+ optional: true,
63
+ conflicting_options: [:api_key],
64
+ verify_block: proc do |value|
65
+ UI.user_error!("Couldn't find API key JSON file at path '#{value}'") unless File.exist?(value)
66
+ end),
67
+ FastlaneCore::ConfigItem.new(key: :api_key,
68
+ env_name: "SIGH_API_KEY",
69
+ description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#use-return-value-and-pass-in-as-an-option)",
70
+ type: Hash,
71
+ optional: true,
72
+ sensitive: true,
73
+ conflicting_options: [:api_key_path]),
74
+
75
+ # Apple ID
57
76
  FastlaneCore::ConfigItem.new(key: :username,
58
77
  short_option: "-u",
59
78
  env_name: "SIGH_USERNAME",
@@ -82,6 +101,8 @@ module Sigh
82
101
  verify_block: proc do |value|
83
102
  ENV["FASTLANE_TEAM_NAME"] = value.to_s
84
103
  end),
104
+
105
+ # Other options
85
106
  FastlaneCore::ConfigItem.new(key: :provisioning_name,
86
107
  short_option: "-n",
87
108
  env_name: "SIGH_PROVISIONING_PROFILE_NAME",
@@ -17,11 +17,16 @@ module Sigh
17
17
  hide_keys: [:output_path],
18
18
  title: "Summary for sigh #{Fastlane::VERSION}")
19
19
 
20
- # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
21
- # Prompts select team if multiple teams and none specified
22
- UI.message("Starting login with user '#{Sigh.config[:username]}'")
23
- Spaceship::ConnectAPI.login(Sigh.config[:username], nil, use_portal: true, use_tunes: false)
24
- UI.message("Successfully logged in")
20
+ if api_token
21
+ UI.message("Creating authorization token for App Store Connect API")
22
+ Spaceship::ConnectAPI.token = api_token
23
+ else
24
+ # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
25
+ # Prompts select team if multiple teams and none specified
26
+ UI.message("Starting login with user '#{Sigh.config[:username]}'")
27
+ Spaceship::ConnectAPI.login(Sigh.config[:username], nil, use_portal: true, use_tunes: false)
28
+ UI.message("Successfully logged in")
29
+ end
25
30
 
26
31
  profiles = [] if Sigh.config[:skip_fetch_profiles]
27
32
  profiles ||= fetch_profiles # download the profile if it's there
@@ -54,6 +59,12 @@ module Sigh
54
59
  return download_profile(profile)
55
60
  end
56
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
+
57
68
  # The kind of provisioning profile we're interested in
58
69
  def profile_type
59
70
  return @profile_type if @profile_type
@@ -128,7 +139,7 @@ module Sigh
128
139
  # Skip certificates that failed to download
129
140
  next unless current_cert[:downloaded]
130
141
  file = Tempfile.new('cert')
131
- file.write(current_cert[:downloaded])
142
+ file.write(current_cert[:downloaded].force_encoding('UTF-8'))
132
143
  file.close
133
144
  if FastlaneCore::CertChecker.installed?(file.path)
134
145
  installed = true
@@ -190,65 +201,95 @@ module Sigh
190
201
  profiles
191
202
  end
192
203
 
204
+ def fetch_certificates(certificate_types)
205
+ filter = {
206
+ certificateType: certificate_types.join(',')
207
+ }
208
+ return Spaceship::ConnectAPI::Certificate.all(filter: filter)
209
+ end
210
+
193
211
  def certificates_for_profile_and_platform
212
+ types = []
213
+
194
214
  case Sigh.config[:platform].to_s
195
215
  when 'ios', 'tvos'
196
216
  if profile_type == Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_DEVELOPMENT || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_DEVELOPMENT
197
- certificates = Spaceship.certificate.development.all +
198
- Spaceship.certificate.apple_development.all
217
+ types = [
218
+ Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPMENT,
219
+ Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DEVELOPMENT
220
+ ]
199
221
  elsif profile_type == Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_INHOUSE || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_INHOUSE
200
222
  # Enterprise accounts don't have access to Apple Distribution certificates
201
- certificates = Spaceship.certificate.in_house.all
223
+ types = [
224
+ Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DISTRIBUTION
225
+ ]
202
226
  # handles case where the desired certificate type is adhoc but the account is an enterprise account
203
227
  # the apple dev portal api has a weird quirk in it where if you query for distribution certificates
204
228
  # for enterprise accounts, you get nothing back even if they exist.
205
- elsif (profile_type == Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_ADHOC || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_ADHOC) && Spaceship.client && Spaceship.client.in_house?
229
+ elsif (profile_type == Spaceship::ConnectAPI::Profile::ProfileType::IOS_APP_ADHOC || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::TVOS_APP_ADHOC) && Spaceship::ConnectAPI.client && Spaceship::ConnectAPI.client.in_house?
206
230
  # Enterprise accounts don't have access to Apple Distribution certificates
207
- certificates = Spaceship.certificate.in_house.all
231
+ types = [
232
+ Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DISTRIBUTION
233
+ ]
208
234
  else
209
- # Ad hoc or App Store
210
- certificates = Spaceship.certificate.production.all +
211
- Spaceship.certificate.apple_distribution.all
235
+ types = [
236
+ Spaceship::ConnectAPI::Certificate::CertificateType::DISTRIBUTION,
237
+ Spaceship::ConnectAPI::Certificate::CertificateType::IOS_DISTRIBUTION
238
+ ]
212
239
  end
213
240
 
214
241
  when 'macos', 'catalyst'
215
242
  if profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DEVELOPMENT || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DEVELOPMENT
216
- certificates = Spaceship.certificate.mac_development.all +
217
- Spaceship.certificate.apple_development.all
243
+ types = [
244
+ Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPMENT,
245
+ Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DEVELOPMENT
246
+ ]
218
247
  elsif profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_STORE || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_STORE
219
- certificates = Spaceship.certificate.mac_app_distribution.all +
220
- Spaceship.certificate.apple_distribution.all
248
+ types = [
249
+ Spaceship::ConnectAPI::Certificate::CertificateType::DISTRIBUTION,
250
+ Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DISTRIBUTION
251
+ ]
221
252
  elsif profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_APP_DIRECT || profile_type == Spaceship::ConnectAPI::Profile::ProfileType::MAC_CATALYST_APP_DIRECT
222
- certificates = Spaceship.certificate.developer_id_application.all
253
+ types = [
254
+ Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_APPLICATION
255
+ ]
223
256
  else
224
- certificates = Spaceship.certificate.mac_app_distribution.all +
225
- Spaceship.certificate.apple_distribution.all
257
+ types = [
258
+ Spaceship::ConnectAPI::Certificate::CertificateType::DISTRIBUTION,
259
+ Spaceship::ConnectAPI::Certificate::CertificateType::MAC_APP_DISTRIBUTION
260
+ ]
226
261
  end
227
262
  end
228
263
 
229
- certificates
264
+ fetch_certificates(types)
230
265
  end
231
266
 
232
267
  def devices_to_use
233
268
  # Only use devices if development or adhoc
234
269
  return [] if !Sigh.config[:development] && !Sigh.config[:adhoc]
235
270
 
236
- device_class = case Sigh.config[:platform].to_s
237
- when 'ios'
238
- [
239
- Spaceship::ConnectAPI::Device::DeviceClass::APPLE_WATCH,
240
- Spaceship::ConnectAPI::Device::DeviceClass::IPAD,
241
- Spaceship::ConnectAPI::Device::DeviceClass::IPHONE,
242
- Spaceship::ConnectAPI::Device::DeviceClass::IPOD
243
- ].join(",")
244
- when 'tvos'
245
- Spaceship::ConnectAPI::Device::DeviceClass::APPLE_TV
246
- when 'macos', 'catalyst'
247
- Spaceship::ConnectAPI::Device::DeviceClass::MAC
248
- end
249
-
250
- filter = { deviceClass: device_class }
251
- return Spaceship::ConnectAPI::Device.all(filter: filter)
271
+ device_classes = case Sigh.config[:platform].to_s
272
+ when 'ios'
273
+ [
274
+ Spaceship::ConnectAPI::Device::DeviceClass::APPLE_WATCH,
275
+ Spaceship::ConnectAPI::Device::DeviceClass::IPAD,
276
+ Spaceship::ConnectAPI::Device::DeviceClass::IPHONE,
277
+ Spaceship::ConnectAPI::Device::DeviceClass::IPOD
278
+ ]
279
+ when 'tvos'
280
+ [Spaceship::ConnectAPI::Device::DeviceClass::APPLE_TV]
281
+ when 'macos', 'catalyst'
282
+ [Spaceship::ConnectAPI::Device::DeviceClass::MAC]
283
+ end
284
+
285
+ if api_token
286
+ return Spaceship::ConnectAPI::Device.all.select do |device|
287
+ device_classes.include?(device.device_class)
288
+ end
289
+ else
290
+ filter = { deviceClass: device_classes.join(",") }
291
+ return Spaceship::ConnectAPI::Device.all(filter: filter)
292
+ end
252
293
  end
253
294
 
254
295
  # Certificate to use based on the current distribution mode
@@ -262,7 +303,7 @@ module Sigh
262
303
  end
263
304
 
264
305
  if Sigh.config[:cert_owner_name]
265
- 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
266
307
  end
267
308
 
268
309
  true
@@ -273,7 +314,8 @@ module Sigh
273
314
  unless Sigh.config[:skip_certificate_verification]
274
315
  certificates = certificates.find_all do |c|
275
316
  file = Tempfile.new('cert')
276
- file.write(c.download_raw)
317
+ raw_data = Base64.decode64(c.certificate_content)
318
+ file.write(raw_data.force_encoding("UTF-8"))
277
319
  file.close
278
320
 
279
321
  FastlaneCore::CertChecker.installed?(file.path)
@@ -285,7 +327,7 @@ module Sigh
285
327
  UI.important("Found more than one code signing identity. Choosing the first one. Check out `fastlane sigh --help` to see all available options.")
286
328
  UI.important("Available Code Signing Identities for current filters:")
287
329
  certificates.each do |c|
288
- 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(" ")
289
331
  UI.message(str.green)
290
332
  end
291
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
@@ -167,7 +167,7 @@ _spaceship_ uses all those API points to offer this seamless experience.
167
167
  _spaceship_ does a lot of magic to get everything working so neatly:
168
168
 
169
169
  - **Sensible Defaults**: You only have to provide the mandatory information (e.g. new provisioning profiles contain all devices by default)
170
- - **Local Validation**: When pushing changes back to the Apple Dev Portal _spaceship_ will make sure only valid data is sent to Apple (e.g. automatic repairing of provisioning profiles)
170
+ - **Local Validation**: When pushing changes back to the Apple Developer Portal _spaceship_ will make sure only valid data is sent to Apple (e.g. automatic repairing of provisioning profiles)
171
171
  - **Various request/response types**: When working with the different API endpoints, _spaceship_ has to deal with `JSON`, `XML`, `txt`, `plist` and sometimes even `HTML` responses and requests.
172
172
  - **Automatic Pagination**: Even if you have thousands of apps, profiles or certificates, _spaceship_ **can** handle your scale. It was heavily tested by first using _spaceship_ to create hundreds of profiles and then accessing them using _spaceship_.
173
173
  - **Session, Cookie and CSRF token**: All the security aspects are handled by _spaceship_.
@@ -196,7 +196,7 @@ module Spaceship
196
196
  self.new(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
197
197
  end
198
198
 
199
- def initialize(cookie: nil, current_team_id: nil, timeout: nil)
199
+ def initialize(cookie: nil, current_team_id: nil, csrf_tokens: nil, timeout: nil)
200
200
  options = {
201
201
  request: {
202
202
  timeout: (ENV["SPACESHIP_TIMEOUT"] || timeout || 300).to_i,
@@ -204,6 +204,7 @@ module Spaceship
204
204
  }
205
205
  }
206
206
  @current_team_id = current_team_id
207
+ @csrf_tokens = csrf_tokens
207
208
  @cookie = cookie || HTTP::CookieJar.new
208
209
 
209
210
  @client = Faraday.new(self.class.hostname, options) do |c|
@@ -857,9 +858,7 @@ module Spaceship
857
858
 
858
859
  resp_hash = response.to_hash
859
860
  if resp_hash[:status] == 401
860
- msg = "Auth lost"
861
- logger.warn(msg)
862
- raise UnauthorizedAccessError.new, "Unauthorized Access"
861
+ handle_401(response)
863
862
  end
864
863
 
865
864
  if response.body.to_s.include?("<title>302 Found</title>")
@@ -880,6 +879,12 @@ module Spaceship
880
879
  end
881
880
  end
882
881
 
882
+ def handle_401(response)
883
+ msg = "Auth lost"
884
+ logger.warn(msg)
885
+ raise UnauthorizedAccessError.new, "Unauthorized Access"
886
+ end
887
+
883
888
  def send_request_auto_paginate(method, url_or_path, params, headers, &block)
884
889
  response = send_request(method, url_or_path, params, headers, &block)
885
890
  return response unless should_process_next_rel?(response)