fastlane 2.157.1 → 2.159.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -80
  3. data/deliver/lib/deliver/runner.rb +4 -2
  4. data/deliver/lib/deliver/upload_metadata.rb +5 -1
  5. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +12 -8
  6. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +1 -1
  7. data/fastlane/lib/fastlane/actions/download_dsyms.rb +89 -68
  8. data/fastlane/lib/fastlane/actions/set_changelog.rb +2 -1
  9. data/fastlane/lib/fastlane/helper/git_helper.rb +2 -0
  10. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +6 -4
  11. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  12. data/fastlane/lib/fastlane/version.rb +1 -1
  13. data/fastlane/swift/Actions.swift +2 -1
  14. data/fastlane/swift/Appfile.swift +2 -4
  15. data/fastlane/swift/ArgumentProcessor.swift +2 -6
  16. data/fastlane/swift/ControlCommand.swift +2 -5
  17. data/fastlane/swift/Deliverfile.swift +5 -2
  18. data/fastlane/swift/DeliverfileProtocol.swift +6 -3
  19. data/fastlane/swift/Fastfile.swift +5 -1
  20. data/fastlane/swift/Fastlane.swift +2227 -2218
  21. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +5 -5
  22. data/fastlane/swift/Gymfile.swift +5 -2
  23. data/fastlane/swift/GymfileProtocol.swift +6 -3
  24. data/fastlane/swift/LaneFileProtocol.swift +36 -19
  25. data/fastlane/swift/MainProcess.swift +77 -0
  26. data/fastlane/swift/Matchfile.swift +5 -2
  27. data/fastlane/swift/MatchfileProtocol.swift +6 -3
  28. data/fastlane/swift/Plugins.swift +2 -1
  29. data/fastlane/swift/Precheckfile.swift +5 -2
  30. data/fastlane/swift/PrecheckfileProtocol.swift +10 -3
  31. data/fastlane/swift/RubyCommand.swift +2 -6
  32. data/fastlane/swift/RubyCommandable.swift +2 -6
  33. data/fastlane/swift/Runner.swift +5 -9
  34. data/fastlane/swift/RunnerArgument.swift +2 -6
  35. data/fastlane/swift/Scanfile.swift +5 -2
  36. data/fastlane/swift/ScanfileProtocol.swift +6 -3
  37. data/fastlane/swift/Screengrabfile.swift +5 -2
  38. data/fastlane/swift/ScreengrabfileProtocol.swift +6 -3
  39. data/fastlane/swift/Snapshotfile.swift +5 -2
  40. data/fastlane/swift/SnapshotfileProtocol.swift +6 -3
  41. data/fastlane/swift/SocketClient.swift +3 -7
  42. data/fastlane/swift/SocketClientDelegateProtocol.swift +2 -6
  43. data/fastlane/swift/SocketResponse.swift +2 -6
  44. data/fastlane/swift/formatting/Brewfile.lock.json +18 -10
  45. data/fastlane/swift/main.swift +4 -8
  46. data/fastlane/swift/upgrade_manifest.json +1 -1
  47. data/match/lib/match/importer.rb +5 -2
  48. data/match/lib/match/spaceship_ensure.rb +5 -5
  49. data/pilot/lib/pilot/build_manager.rb +0 -3
  50. data/pilot/lib/pilot/manager.rb +1 -2
  51. data/precheck/lib/precheck/options.rb +9 -0
  52. data/precheck/lib/precheck/rule_processor.rb +94 -60
  53. data/precheck/lib/precheck/runner.rb +6 -4
  54. data/produce/lib/produce/itunes_connect.rb +2 -1
  55. data/sigh/lib/assets/resign.sh +9 -6
  56. data/sigh/lib/sigh/runner.rb +2 -1
  57. data/snapshot/lib/assets/SnapshotHelper.swift +17 -2
  58. data/spaceship/lib/spaceship/client.rb +1 -0
  59. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  60. data/spaceship/lib/spaceship/connect_api/client.rb +37 -10
  61. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  62. data/spaceship/lib/spaceship/connect_api/models/.app.rb.swp +0 -0
  63. data/spaceship/lib/spaceship/connect_api/models/.app_store_version.rb.swp +0 -0
  64. data/spaceship/lib/spaceship/connect_api/models/.app_store_version_submission.rb.swp +0 -0
  65. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -5
  66. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  67. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  68. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +21 -0
  69. data/spaceship/lib/spaceship/connect_api/spaceship.rb +3 -2
  70. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +50 -50
  71. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +20 -0
  72. metadata +23 -18
@@ -1,3 +1,6 @@
1
+ // Scanfile.swift
2
+ // Copyright (c) 2020 FastlaneTools
3
+
1
4
  // This class is automatically included in FastlaneRunner during build
2
5
 
3
6
  // This autogenerated file will be overwritten or replaced during build time, or when you initialize `scan`
@@ -8,10 +11,10 @@
8
11
  // new group so that it won't be marked for upgrade
9
12
  //
10
13
 
11
- class Scanfile: ScanfileProtocol {
14
+ public class Scanfile: ScanfileProtocol {
12
15
  // If you want to enable `scan`, run `fastlane scan init`
13
16
  // After, this file will be replaced with a custom implementation that contains values you supplied
14
17
  // during the `init` process, and you won't see this message
15
18
  }
16
19
 
17
- // Generated with fastlane 2.157.1
20
+ // Generated with fastlane 2.159.0
@@ -1,4 +1,7 @@
1
- protocol ScanfileProtocol: class {
1
+ // ScanfileProtocol.swift
2
+ // Copyright (c) 2020 FastlaneTools
3
+
4
+ public protocol ScanfileProtocol: class {
2
5
  /// Path to the workspace file
3
6
  var workspace: String? { get }
4
7
 
@@ -189,7 +192,7 @@ protocol ScanfileProtocol: class {
189
192
  var failBuild: Bool { get }
190
193
  }
191
194
 
192
- extension ScanfileProtocol {
195
+ public extension ScanfileProtocol {
193
196
  var workspace: String? { return nil }
194
197
  var project: String? { return nil }
195
198
  var scheme: String? { return nil }
@@ -257,4 +260,4 @@ extension ScanfileProtocol {
257
260
 
258
261
  // Please don't remove the lines below
259
262
  // They are used to detect outdated files
260
- // FastlaneRunnerAPIVersion [0.9.44]
263
+ // FastlaneRunnerAPIVersion [0.9.50]
@@ -1,3 +1,6 @@
1
+ // Screengrabfile.swift
2
+ // Copyright (c) 2020 FastlaneTools
3
+
1
4
  // This class is automatically included in FastlaneRunner during build
2
5
 
3
6
  // This autogenerated file will be overwritten or replaced during build time, or when you initialize `screengrab`
@@ -8,10 +11,10 @@
8
11
  // new group so that it won't be marked for upgrade
9
12
  //
10
13
 
11
- class Screengrabfile: ScreengrabfileProtocol {
14
+ public class Screengrabfile: ScreengrabfileProtocol {
12
15
  // If you want to enable `screengrab`, run `fastlane screengrab init`
13
16
  // After, this file will be replaced with a custom implementation that contains values you supplied
14
17
  // during the `init` process, and you won't see this message
15
18
  }
16
19
 
17
- // Generated with fastlane 2.157.1
20
+ // Generated with fastlane 2.159.0
@@ -1,4 +1,7 @@
1
- protocol ScreengrabfileProtocol: class {
1
+ // ScreengrabfileProtocol.swift
2
+ // Copyright (c) 2020 FastlaneTools
3
+
4
+ public protocol ScreengrabfileProtocol: class {
2
5
  /// Path to the root of your Android SDK installation, e.g. ~/tools/android-sdk-macosx
3
6
  var androidHome: String? { get }
4
7
 
@@ -66,7 +69,7 @@ protocol ScreengrabfileProtocol: class {
66
69
  var adbHost: String? { get }
67
70
  }
68
71
 
69
- extension ScreengrabfileProtocol {
72
+ public extension ScreengrabfileProtocol {
70
73
  var androidHome: String? { return nil }
71
74
  var buildToolsVersion: String? { return nil }
72
75
  var locales: [String] { return ["en-US"] }
@@ -93,4 +96,4 @@ extension ScreengrabfileProtocol {
93
96
 
94
97
  // Please don't remove the lines below
95
98
  // They are used to detect outdated files
96
- // FastlaneRunnerAPIVersion [0.9.34]
99
+ // FastlaneRunnerAPIVersion [0.9.40]
@@ -1,3 +1,6 @@
1
+ // Snapshotfile.swift
2
+ // Copyright (c) 2020 FastlaneTools
3
+
1
4
  // This class is automatically included in FastlaneRunner during build
2
5
 
3
6
  // This autogenerated file will be overwritten or replaced during build time, or when you initialize `snapshot`
@@ -8,10 +11,10 @@
8
11
  // new group so that it won't be marked for upgrade
9
12
  //
10
13
 
11
- class Snapshotfile: SnapshotfileProtocol {
14
+ public class Snapshotfile: SnapshotfileProtocol {
12
15
  // If you want to enable `snapshot`, run `fastlane snapshot init`
13
16
  // After, this file will be replaced with a custom implementation that contains values you supplied
14
17
  // during the `init` process, and you won't see this message
15
18
  }
16
19
 
17
- // Generated with fastlane 2.157.1
20
+ // Generated with fastlane 2.159.0
@@ -1,4 +1,7 @@
1
- protocol SnapshotfileProtocol: class {
1
+ // SnapshotfileProtocol.swift
2
+ // Copyright (c) 2020 FastlaneTools
3
+
4
+ public protocol SnapshotfileProtocol: class {
2
5
  /// Path the workspace file
3
6
  var workspace: String? { get }
4
7
 
@@ -132,7 +135,7 @@ protocol SnapshotfileProtocol: class {
132
135
  var suppressXcodeOutput: Bool? { get }
133
136
  }
134
137
 
135
- extension SnapshotfileProtocol {
138
+ public extension SnapshotfileProtocol {
136
139
  var workspace: String? { return nil }
137
140
  var project: String? { return nil }
138
141
  var xcargs: String? { return nil }
@@ -181,4 +184,4 @@ extension SnapshotfileProtocol {
181
184
 
182
185
  // Please don't remove the lines below
183
186
  // They are used to detect outdated files
184
- // FastlaneRunnerAPIVersion [0.9.28]
187
+ // FastlaneRunnerAPIVersion [0.9.34]
@@ -1,9 +1,5 @@
1
- //
2
- // SocketClient.swift
3
- // FastlaneSwiftRunner
4
- //
5
- // Created by Joshua Liebowitz on 7/30/17.
6
- //
1
+ // SocketClient.swift
2
+ // Copyright (c) 2020 FastlaneTools
7
3
 
8
4
  //
9
5
  // ** NOTE **
@@ -40,7 +36,7 @@ class SocketClient: NSObject {
40
36
  fileprivate var inputStream: InputStream!
41
37
  fileprivate var outputStream: OutputStream!
42
38
  fileprivate var cleaningUpAfterDone = false
43
- fileprivate let dispatchGroup: DispatchGroup = DispatchGroup()
39
+ fileprivate let dispatchGroup = DispatchGroup()
44
40
  fileprivate let readSemaphore = DispatchSemaphore(value: 1)
45
41
  fileprivate let writeSemaphore = DispatchSemaphore(value: 1)
46
42
  fileprivate let commandTimeoutSeconds: Int
@@ -1,9 +1,5 @@
1
- //
2
- // SocketClientDelegateProtocol.swift
3
- // FastlaneSwiftRunner
4
- //
5
- // Created by Joshua Liebowitz on 8/12/17.
6
- //
1
+ // SocketClientDelegateProtocol.swift
2
+ // Copyright (c) 2020 FastlaneTools
7
3
 
8
4
  //
9
5
  // ** NOTE **
@@ -1,9 +1,5 @@
1
- //
2
- // SocketResponse.swift
3
- // FastlaneSwiftRunner
4
- //
5
- // Created by Joshua Liebowitz on 7/30/17.
6
- //
1
+ // SocketResponse.swift
2
+ // Copyright (c) 2020 FastlaneTools
7
3
 
8
4
  //
9
5
  // ** NOTE **
@@ -2,22 +2,22 @@
2
2
  "entries": {
3
3
  "brew": {
4
4
  "swiftformat": {
5
- "version": "0.44.8",
5
+ "version": "0.45.6",
6
6
  "bottle": {
7
7
  "cellar": ":any_skip_relocation",
8
8
  "prefix": "/usr/local",
9
9
  "files": {
10
10
  "catalina": {
11
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.44.8.catalina.bottle.tar.gz",
12
- "sha256": "9cbd2c21d4579c8c4ffc9df7b44593f7622d13f8517a3fed047c5e5f3f2560c6"
11
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.45.6.catalina.bottle.tar.gz",
12
+ "sha256": "7f23ff740679b30e313c91533c2f3e6fa4210bb68f8e383c29e7f922f87d8f66"
13
13
  },
14
14
  "mojave": {
15
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.44.8.mojave.bottle.tar.gz",
16
- "sha256": "a8f8b6fa977804c2d13f0cbc9ed223ddaa88e3c0684e91519e005784c8418b36"
15
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.45.6.mojave.bottle.tar.gz",
16
+ "sha256": "b5349b775ff60c73c284d5de8ad2c0fdfb35428cff92bb7a8e5fcc6536750b89"
17
17
  },
18
18
  "high_sierra": {
19
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.44.8.high_sierra.bottle.tar.gz",
20
- "sha256": "fd43d192d194a8bb02308714b691e6a7101f839889f749dff4a1facf8172b951"
19
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.45.6.high_sierra.bottle.tar.gz",
20
+ "sha256": "34d900217ca12736a112c31e54a5f4f7e64c1fe224f6e4ea76ad1d25b149f647"
21
21
  }
22
22
  }
23
23
  }
@@ -27,12 +27,20 @@
27
27
  "system": {
28
28
  "macos": {
29
29
  "catalina": {
30
- "HOMEBREW_VERSION": "2.2.14-62-g9befd55",
30
+ "HOMEBREW_VERSION": "2.4.9-133-g0fdf8f2",
31
31
  "HOMEBREW_PREFIX": "/usr/local",
32
- "Homebrew/homebrew-core": "0b738b77a5a13a66a52d76d34c4f608b719e0485",
32
+ "Homebrew/homebrew-core": "7141f37f3af0e6702f6dab2263852ddefbbbf8ed",
33
33
  "CLT": "11.0.28.3",
34
- "Xcode": "11.4.1",
34
+ "Xcode": "11.6",
35
35
  "macOS": "10.15.4"
36
+ },
37
+ "big_sur": {
38
+ "HOMEBREW_VERSION": "2.4.13-249-g6454504",
39
+ "HOMEBREW_PREFIX": "/usr/local",
40
+ "Homebrew/homebrew-core": "020491c34515c229d904e6e69e14157cb728d2fa",
41
+ "CLT": "11.0.28.3",
42
+ "Xcode": "12.0",
43
+ "macOS": "11.0"
36
44
  }
37
45
  }
38
46
  }
@@ -1,9 +1,5 @@
1
- //
2
- // main.swift
3
- // FastlaneSwiftRunner
4
- //
5
- // Created by Joshua Liebowitz on 8/26/17.
6
- //
1
+ // main.swift
2
+ // Copyright (c) 2020 FastlaneTools
7
3
 
8
4
  //
9
5
  // ** NOTE **
@@ -24,7 +20,7 @@ class MainProcess {
24
20
  @objc func connectToFastlaneAndRunLane() {
25
21
  runner.startSocketThread(port: argumentProcessor.port)
26
22
 
27
- let completedRun = Fastfile.runLane(named: argumentProcessor.currentLane, parameters: argumentProcessor.laneParameters())
23
+ let completedRun = Fastfile.runLane(from: nil, named: argumentProcessor.currentLane, parameters: argumentProcessor.laneParameters())
28
24
  if completedRun {
29
25
  runner.disconnectFromFastlaneProcess()
30
26
  }
@@ -39,7 +35,7 @@ class MainProcess {
39
35
  }
40
36
  }
41
37
 
42
- let process: MainProcess = MainProcess()
38
+ let process = MainProcess()
43
39
  process.startFastlaneThread()
44
40
 
45
41
  while !process.doneRunningLane, RunLoop.current.run(mode: RunLoopMode.defaultRunLoopMode, before: Date(timeIntervalSinceNow: 2)) {
@@ -1 +1 @@
1
- {"Actions.swift":"Autogenerated API","Fastlane.swift":"Autogenerated API","DeliverfileProtocol.swift":"Autogenerated API","GymfileProtocol.swift":"Autogenerated API","MatchfileProtocol.swift":"Autogenerated API","Plugins.swift":"Autogenerated API","PrecheckfileProtocol.swift":"Autogenerated API","ScanfileProtocol.swift":"Autogenerated API","ScreengrabfileProtocol.swift":"Autogenerated API","SnapshotfileProtocol.swift":"Autogenerated API","LaneFileProtocol.swift":"Fastfile Components","ControlCommand.swift":"Networking","RubyCommand.swift":"Networking","RubyCommandable.swift":"Networking","Runner.swift":"Networking","SocketClient.swift":"Networking","SocketClientDelegateProtocol.swift":"Networking","SocketResponse.swift":"Networking","ArgumentProcessor.swift":"Runner Code","main.swift":"Runner Code","RunnerArgument.swift":"Runner Code"}
1
+ {"Actions.swift":"Autogenerated API","Fastlane.swift":"Autogenerated API","DeliverfileProtocol.swift":"Autogenerated API","GymfileProtocol.swift":"Autogenerated API","MatchfileProtocol.swift":"Autogenerated API","Plugins.swift":"Autogenerated API","PrecheckfileProtocol.swift":"Autogenerated API","ScanfileProtocol.swift":"Autogenerated API","ScreengrabfileProtocol.swift":"Autogenerated API","SnapshotfileProtocol.swift":"Autogenerated API","LaneFileProtocol.swift":"Fastfile Components","ControlCommand.swift":"Networking","RubyCommand.swift":"Networking","RubyCommandable.swift":"Networking","Runner.swift":"Networking","SocketClient.swift":"Networking","SocketClientDelegateProtocol.swift":"Networking","SocketResponse.swift":"Networking","main.swift":"Runner Code","ArgumentProcessor.swift":"Runner Code","RunnerArgument.swift":"Runner Code"}
@@ -2,6 +2,7 @@ require_relative 'spaceship_ensure'
2
2
  require_relative 'encryption'
3
3
  require_relative 'storage'
4
4
  require_relative 'module'
5
+ require_relative 'generator'
5
6
  require 'fastlane_core/provisioning_profile'
6
7
  require 'fileutils'
7
8
 
@@ -56,8 +57,9 @@ module Match
56
57
  UI.user_error!("Cert type '#{cert_type}' is not supported")
57
58
  end
58
59
 
60
+ prov_type = Match.profile_type_sym(params[:type])
59
61
  output_dir_certs = File.join(storage.prefixed_working_directory, "certs", cert_type.to_s)
60
- output_dir_profiles = File.join(storage.prefixed_working_directory, "profiles", cert_type.to_s)
62
+ output_dir_profiles = File.join(storage.prefixed_working_directory, "profiles", prov_type.to_s)
61
63
 
62
64
  # Need to get the cert id by comparing base64 encoded cert content with certificate content from the API responses
63
65
  Spaceship::Portal.login(params[:username])
@@ -86,7 +88,8 @@ module Match
86
88
  FileUtils.mkdir_p(output_dir_profiles)
87
89
  bundle_id = FastlaneCore::ProvisioningProfile.bundle_id(profile_path)
88
90
  profile_extension = FastlaneCore::ProvisioningProfile.profile_extension(profile_path)
89
- dest_profile_path = File.join(output_dir_profiles, "#{cert_type.to_s.capitalize}_#{bundle_id}#{profile_extension}")
91
+ profile_type_name = Match::Generator.profile_type_name(prov_type)
92
+ dest_profile_path = File.join(output_dir_profiles, "#{profile_type_name}_#{bundle_id}#{profile_extension}")
90
93
  files_to_commit.push(dest_profile_path)
91
94
  IO.copy_stream(profile_path, dest_profile_path)
92
95
  end
@@ -18,18 +18,18 @@ module Match
18
18
  UI.important("More information https://docs.fastlane.tools/actions/match/#access-control")
19
19
  end
20
20
 
21
+ # Prompts select team if multiple teams and none specified
21
22
  UI.message("Verifying that the certificate and profile are still valid on the Dev Portal...")
22
- Spaceship.login(user)
23
- Spaceship.select_team(team_id: team_id, team_name: team_name)
23
+ Spaceship::ConnectAPI.login(user, use_portal: true, use_tunes: false, portal_team_id: team_id, team_name: team_name)
24
24
  end
25
25
 
26
26
  # The team ID of the currently logged in team
27
27
  def team_id
28
- return Spaceship.client.team_id
28
+ return Spaceship::ConnectAPI.client.portal_team_id
29
29
  end
30
30
 
31
31
  def bundle_identifier_exists(username: nil, app_identifier: nil, platform: nil)
32
- found = Spaceship.app.find(app_identifier, mac: platform == "macos")
32
+ found = Spaceship::ConnectAPI::BundleId.find(app_identifier)
33
33
  return if found
34
34
 
35
35
  require 'sigh/runner'
@@ -39,7 +39,7 @@ module Match
39
39
  })
40
40
  UI.error("An app with that bundle ID needs to exist in order to create a provisioning profile for it")
41
41
  UI.error("================================================================")
42
- available_apps = Spaceship.app.all.collect { |a| "#{a.bundle_id} (#{a.name})" }
42
+ available_apps = Spaceship::ConnectAPI::BundleId.all.collect { |a| "#{a.identifier} (#{a.name})" }
43
43
  UI.message("Available apps:\n- #{available_apps.join("\n- ")}")
44
44
  UI.error("Make sure to run `fastlane match` with the same user and team every time.")
45
45
  UI.user_error!("Couldn't find bundle identifier '#{app_identifier}' for the user '#{username}'")
@@ -364,10 +364,7 @@ module Pilot
364
364
  begin
365
365
  team = tunes_client.teams.find { |t| t['contentProvider']['contentProviderId'].to_s == tunes_client.team_id }
366
366
  name = team['contentProvider']['name']
367
- STDERR.puts("name: #{name}")
368
- STDERR.puts("id: #{generic_transporter.provider_ids}")
369
367
  provider_id = generic_transporter.provider_ids[name]
370
- STDERR.puts("provider_id: #{provider_id}")
371
368
  UI.verbose("Inferred provider id #{provider_id} for team #{name}.")
372
369
  return FastlaneCore::ItunesTransporter.new(options[:username], nil, false, provider_id)
373
370
  rescue => ex
@@ -24,8 +24,7 @@ module Pilot
24
24
  config[:username] ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
25
25
 
26
26
  UI.message("Login to App Store Connect (#{config[:username]})")
27
- Spaceship::ConnectAPI.login(config[:username], use_portal: false, use_tunes: true)
28
- Spaceship::ConnectAPI.select_team(tunes_team_id: config[:team_id], team_name: config[:team_name])
27
+ Spaceship::ConnectAPI.login(config[:username], use_portal: false, use_tunes: true, tunes_team_id: config[:team_id], team_name: config[:team_name])
29
28
  UI.message("Login successful")
30
29
  end
31
30
  end
@@ -60,6 +60,15 @@ module Precheck
60
60
  verify_block: proc do |value|
61
61
  ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s
62
62
  end),
63
+ FastlaneCore::ConfigItem.new(key: :platform,
64
+ short_option: "-j",
65
+ env_name: "PRECHECK_PLATFORM",
66
+ description: "The platform to use (optional)",
67
+ optional: true,
68
+ default_value: "ios",
69
+ verify_block: proc do |value|
70
+ UI.user_error!("The platform can only be ios, appletvos, or osx") unless %('ios', 'appletvos', 'osx').include?(value)
71
+ end),
63
72
  FastlaneCore::ConfigItem.new(key: :default_rule_level,
64
73
  short_option: "-r",
65
74
  env_name: "PRECHECK_DEFAULT_RULE_LEVEL",
@@ -1,4 +1,5 @@
1
1
  require 'spaceship/tunes/language_item'
2
+ require 'spaceship/tunes/iap_list'
2
3
  require 'fastlane/markdown_table_formatter'
3
4
 
4
5
  require_relative 'module'
@@ -43,8 +44,8 @@ module Precheck
43
44
  class RuleProcessor
44
45
  def self.process_app_and_version(app: nil, app_version: nil, rules: nil)
45
46
  items_to_check = []
46
- items_to_check += generate_text_items_to_check(app: app, app_version: app_version)
47
- items_to_check += generate_url_items_to_check(app: app, app_version: app_version)
47
+ items_to_check += generate_app_items_to_check(app: app)
48
+ items_to_check += generate_version_items_to_check(app_version: app_version)
48
49
 
49
50
  return process_rules(items_to_check: items_to_check, rules: rules)
50
51
  end
@@ -125,66 +126,41 @@ module Precheck
125
126
  return rule_hash
126
127
  end
127
128
 
128
- def self.generate_url_items_to_check(app: nil, app_version: nil)
129
+ def self.generate_app_items_to_check(app: nil)
129
130
  items = []
130
- items += collect_urls_from_hash(hash: app_version.support_url,
131
- item_name: :support_url,
132
- friendly_name_postfix: "support URL")
133
- items += collect_urls_from_hash(hash: app_version.marketing_url,
134
- item_name: :marketing_url,
135
- friendly_name_postfix: "marketing URL",
136
- is_optional: true)
137
-
138
- items += collect_urls_from_hash(hash: app.details.privacy_url,
139
- item_name: :privacy_url,
140
- friendly_name_postfix: "privacy URL",
141
- is_optional: true)
142
- return items
143
- end
144
131
 
145
- def self.collect_urls_from_hash(hash: nil, item_name: nil, friendly_name_postfix: nil, is_optional: false)
146
- items = []
147
- hash.each do |key, value|
148
- items << URLItemToCheck.new(value, item_name, "#{friendly_name_postfix}: (#{key})", is_optional)
132
+ # App info localizations
133
+ app_info = app.fetch_edit_app_info
134
+ app_info_localizations = app_info.get_app_info_localizations
135
+ app_info_localizations.each do |localization|
136
+ items << collect_text_items_from_language_item(locale: localization.locale,
137
+ value: localization.name,
138
+ item_name: :app_name,
139
+ friendly_name_postfix: "app name")
140
+
141
+ items << collect_text_items_from_language_item(locale: localization.locale,
142
+ value: localization.subtitle,
143
+ item_name: :app_subtitle,
144
+ friendly_name_postfix: "app name subtitle",
145
+ is_optional: true)
146
+
147
+ items << collect_text_items_from_language_item(locale: localization.locale,
148
+ value: localization.privacy_policy_text,
149
+ item_name: :privacy_policy_text,
150
+ friendly_name_postfix: " tv privacy policy")
151
+
152
+ items << collect_urls_from_language_item(locale: localization.locale,
153
+ value: localization.privacy_policy_url,
154
+ item_name: :privacy_policy_url,
155
+ friendly_name_postfix: "privacy URL",
156
+ is_optional: true)
149
157
  end
150
- return items
151
- end
152
-
153
- def self.generate_text_items_to_check(app: nil, app_version: nil)
154
- items = []
155
-
156
- items << TextItemToCheck.new(app_version.copyright, :copyright, "copyright")
157
-
158
- items += collect_text_items_from_language_item(hash: app_version.keywords,
159
- item_name: :keywords,
160
- friendly_name_postfix: "keywords")
161
-
162
- items += collect_text_items_from_language_item(hash: app_version.description,
163
- item_name: :description,
164
- friendly_name_postfix: "description")
165
-
166
- items += collect_text_items_from_language_item(hash: app_version.release_notes,
167
- item_name: :release_notes,
168
- friendly_name_postfix: "release notes")
169
-
170
- items += collect_text_items_from_language_item(hash: app.details.name,
171
- item_name: :app_name,
172
- friendly_name_postfix: "app name")
173
-
174
- items += collect_text_items_from_language_item(hash: app.details.apple_tv_privacy_policy,
175
- item_name: :app_subtitle,
176
- friendly_name_postfix: " tv privacy policy")
177
-
178
- items += collect_text_items_from_language_item(hash: app.details.subtitle,
179
- item_name: :app_subtitle,
180
- friendly_name_postfix: "app name subtitle",
181
- is_optional: true)
182
158
 
183
159
  should_include_iap = Precheck.config[:include_in_app_purchases]
184
160
  if should_include_iap
185
161
  UI.message("Reading in-app purchases. If you have a lot, this might take a while")
186
162
  UI.message("You can disable IAP checking by setting the `include_in_app_purchases` flag to `false`")
187
- in_app_purchases = app.in_app_purchases.all
163
+ in_app_purchases = get_iaps(app_id: app.id)
188
164
  in_app_purchases ||= []
189
165
  in_app_purchases.each do |purchase|
190
166
  items += collect_iap_language_items(purchase_edit_versions: purchase.edit.versions)
@@ -195,6 +171,64 @@ module Precheck
195
171
  return items
196
172
  end
197
173
 
174
+ def self.generate_version_items_to_check(app_version: nil)
175
+ items = []
176
+
177
+ items << TextItemToCheck.new(app_version.copyright, :copyright, "copyright")
178
+
179
+ # Version localizations
180
+ version_localizations = app_version.get_app_store_version_localizations
181
+ version_localizations.each do |localization|
182
+ items << collect_text_items_from_language_item(locale: localization.locale,
183
+ value: localization.keywords,
184
+ item_name: :keywords,
185
+ friendly_name_postfix: "keywords")
186
+
187
+ items << collect_text_items_from_language_item(locale: localization.locale,
188
+ value: localization.description,
189
+ item_name: :description,
190
+ friendly_name_postfix: "description")
191
+
192
+ items << collect_text_items_from_language_item(locale: localization.locale,
193
+ value: localization.whats_new,
194
+ item_name: :release_notes,
195
+ friendly_name_postfix: "what's new")
196
+
197
+ items << collect_urls_from_language_item(locale: localization.locale,
198
+ value: localization.support_url,
199
+ item_name: :support_url,
200
+ friendly_name_postfix: "support URL")
201
+
202
+ items << collect_urls_from_language_item(locale: localization.locale,
203
+ value: localization.marketing_url,
204
+ item_name: :marketing_url,
205
+ friendly_name_postfix: "marketing URL",
206
+ is_optional: true)
207
+ end
208
+
209
+ return items
210
+ end
211
+
212
+ # As of 2020-09-04, this is the only non App Store Connect call in prechecks
213
+ # This will need to get replaced when the API becomes available
214
+ def self.get_iaps(app_id: nil, include_deleted: false)
215
+ r = Spaceship::Tunes.client.iaps(app_id: app_id)
216
+ return_iaps = []
217
+ r.each do |product|
218
+ attrs = product
219
+
220
+ # This is not great but Spaceship::Tunes::IAPList.factory looks
221
+ # for `application.apple_id`
222
+ mock_application = OpenStruct.new({ apple_id: app_id })
223
+ attrs[:application] = mock_application
224
+
225
+ loaded_iap = Spaceship::Tunes::IAPList.factory(attrs)
226
+ next if loaded_iap.status == "deleted" && !include_deleted
227
+ return_iaps << loaded_iap
228
+ end
229
+ return return_iaps
230
+ end
231
+
198
232
  def self.collect_iap_language_items(purchase_edit_versions: nil, is_optional: false)
199
233
  items = []
200
234
  purchase_edit_versions.each do |language_key, hash|
@@ -207,12 +241,12 @@ module Precheck
207
241
  end
208
242
 
209
243
  # a few attributes are LanguageItem this method creates a TextItemToCheck for each pair
210
- def self.collect_text_items_from_language_item(hash: nil, item_name: nil, friendly_name_postfix: nil, is_optional: false)
211
- items = []
212
- hash.each do |key, value|
213
- items << TextItemToCheck.new(value, item_name, "#{friendly_name_postfix}: (#{key})", is_optional)
214
- end
215
- return items
244
+ def self.collect_text_items_from_language_item(locale: nil, value: nil, item_name: nil, friendly_name_postfix: nil, is_optional: false)
245
+ return TextItemToCheck.new(value, item_name, "#{friendly_name_postfix}: (#{locale})", is_optional)
246
+ end
247
+
248
+ def self.collect_urls_from_language_item(locale: nil, value: nil, item_name: nil, friendly_name_postfix: nil, is_optional: false)
249
+ return URLItemToCheck.new(value, item_name, "#{friendly_name_postfix}: (#{locale})", is_optional)
216
250
  end
217
251
  end
218
252
  end