fastlane 2.157.0 → 2.158.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -72
  3. data/deliver/lib/deliver/app_screenshot_iterator.rb +1 -1
  4. data/deliver/lib/deliver/runner.rb +5 -3
  5. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  6. data/fastlane/lib/fastlane/actions/{.git_commit.rb.swp → .slack.rb.swp} +0 -0
  7. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  8. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +12 -8
  9. data/fastlane/lib/fastlane/actions/download_dsyms.rb +89 -68
  10. data/fastlane/lib/fastlane/actions/set_changelog.rb +3 -2
  11. data/fastlane/lib/fastlane/version.rb +1 -1
  12. data/fastlane/swift/Deliverfile.swift +1 -1
  13. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  14. data/fastlane/swift/Fastlane.swift +18 -12
  15. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  16. data/fastlane/swift/Gymfile.swift +1 -1
  17. data/fastlane/swift/GymfileProtocol.swift +1 -1
  18. data/fastlane/swift/Matchfile.swift +1 -1
  19. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  20. data/fastlane/swift/Precheckfile.swift +1 -1
  21. data/fastlane/swift/PrecheckfileProtocol.swift +5 -1
  22. data/fastlane/swift/Scanfile.swift +1 -1
  23. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  24. data/fastlane/swift/Screengrabfile.swift +1 -1
  25. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  26. data/fastlane/swift/Snapshotfile.swift +1 -1
  27. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  28. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -0
  29. data/match/lib/match/spaceship_ensure.rb +5 -5
  30. data/{fastlane/lib/fastlane/.erb_template_helper.rb.swp → pilot/lib/pilot/.manager.rb.swp} +0 -0
  31. data/pilot/lib/pilot/build_manager.rb +0 -3
  32. data/pilot/lib/pilot/manager.rb +1 -1
  33. data/precheck/lib/precheck/options.rb +9 -0
  34. data/precheck/lib/precheck/rule_processor.rb +94 -60
  35. data/precheck/lib/precheck/runner.rb +6 -4
  36. data/produce/lib/produce/itunes_connect.rb +3 -2
  37. data/screengrab/lib/screengrab/runner.rb +28 -10
  38. data/sigh/lib/assets/resign.sh +9 -6
  39. data/sigh/lib/sigh/runner.rb +3 -2
  40. data/spaceship/lib/spaceship/client.rb +1 -0
  41. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  42. data/spaceship/lib/spaceship/{.DS_Store → connect_api/.DS_Store} +0 -0
  43. data/spaceship/lib/spaceship/connect_api/client.rb +32 -13
  44. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  45. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -5
  46. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  47. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  48. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +21 -0
  49. data/spaceship/lib/spaceship/connect_api/spaceship.rb +10 -6
  50. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +50 -50
  51. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +20 -0
  52. metadata +25 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54d4961677c76fce8c6ecb5e8c89f9b28ea818abd3dc886217d8eaf4e198902b
4
- data.tar.gz: a36d89c144e59c29e7dc94eeb8f51a72b3a50a9ed2813ca700d8ee7008d778de
3
+ metadata.gz: 788ea487bca43498edde1360e40fe59761bc470b5028f3b7f6bcccf25f8348a9
4
+ data.tar.gz: 7333608271e41308100b68c9c56d572751b07feeed59d45ee72f0e972eff296d
5
5
  SHA512:
6
- metadata.gz: ef36ec87ab67fa77d75cb6836e994463de4f550e6ff0bc832690c734c09a8a21cd9644c90657d29894baf2b4b7e4d87269f7c8d350ce0300ee2b162f3a861870
7
- data.tar.gz: d8a4392c60f47e7b7d73a374020c854694f27a91a59a23d33a6f0de2464efdd2b653bfb6a999faa3b1657a7aa4d29a097ef7d8cff34eeec5481bafb2e5612339
6
+ metadata.gz: 3d173dc0f428264f2eaba63baf543e849525871cf7981f769fa72aa1ee8896b0b042b262ef0a0d3687423892ae9d2cfd5e28487100a887d78b703af83f847de2
7
+ data.tar.gz: ecfee323ba2035466bbb7efa6fd34a3af1339046ddc93f13de6a88dae9d65b4a65960bed69baa08b738e193cd050e66363699e682f051e0e4e5b5ab38a176007
data/README.md CHANGED
@@ -34,29 +34,49 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
34
34
  <!-- This table is regenerated and resorted on each release -->
35
35
  <table id='team'>
36
36
  <tr>
37
+ <td id='felix-krause'>
38
+ <a href='https://github.com/KrauseFx'>
39
+ <img src='https://github.com/KrauseFx.png?size=140'>
40
+ </a>
41
+ <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
42
+ </td>
37
43
  <td id='olivier-halligon'>
38
44
  <a href='https://github.com/AliSoftware'>
39
45
  <img src='https://github.com/AliSoftware.png?size=140'>
40
46
  </a>
41
47
  <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
42
48
  </td>
43
- <td id='stefan-natchev'>
44
- <a href='https://github.com/snatchev'>
45
- <img src='https://github.com/snatchev.png?size=140'>
49
+ <td id='danielle-tomlinson'>
50
+ <a href='https://github.com/endocrimes'>
51
+ <img src='https://github.com/endocrimes.png?size=140'>
46
52
  </a>
47
- <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
53
+ <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
48
54
  </td>
49
- <td id='jan-piotrowski'>
50
- <a href='https://github.com/janpio'>
51
- <img src='https://github.com/janpio.png?size=140'>
55
+ <td id='luka-mirosevic'>
56
+ <a href='https://github.com/lmirosevic'>
57
+ <img src='https://github.com/lmirosevic.png?size=140'>
52
58
  </a>
53
- <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
59
+ <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
54
60
  </td>
55
- <td id='max-ott'>
56
- <a href='https://github.com/max-ott'>
57
- <img src='https://github.com/max-ott.png?size=140'>
61
+ <td id='kohki-miki'>
62
+ <a href='https://github.com/giginet'>
63
+ <img src='https://github.com/giginet.png?size=140'>
58
64
  </a>
59
- <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
65
+ <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
66
+ </td>
67
+ </tr>
68
+ <tr>
69
+ <td id='aaron-brager'>
70
+ <a href='https://github.com/getaaron'>
71
+ <img src='https://github.com/getaaron.png?size=140'>
72
+ </a>
73
+ <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
74
+ </td>
75
+ <td id='andrew-mcburney'>
76
+ <a href='https://github.com/armcburney'>
77
+ <img src='https://github.com/armcburney.png?size=140'>
78
+ </a>
79
+ <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
60
80
  </td>
61
81
  <td id='jorge-revuelta-h'>
62
82
  <a href='https://github.com/minuscorp'>
@@ -64,89 +84,75 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
64
84
  </a>
65
85
  <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
66
86
  </td>
67
- </tr>
68
- <tr>
69
87
  <td id='joshua-liebowitz'>
70
88
  <a href='https://github.com/taquitos'>
71
89
  <img src='https://github.com/taquitos.png?size=140'>
72
90
  </a>
73
91
  <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
74
92
  </td>
75
- <td id='manu-wallner'>
76
- <a href='https://github.com/milch'>
77
- <img src='https://github.com/milch.png?size=140'>
78
- </a>
79
- <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
80
- </td>
81
- <td id='daniel-jankowski'>
82
- <a href='https://github.com/mollyIV'>
83
- <img src='https://github.com/mollyIV.png?size=140'>
84
- </a>
85
- <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
86
- </td>
87
93
  <td id='jimmy-dee'>
88
94
  <a href='https://github.com/jdee'>
89
95
  <img src='https://github.com/jdee.png?size=140'>
90
96
  </a>
91
97
  <h4 align='center'>Jimmy Dee</h4>
92
98
  </td>
93
- <td id='maksym-grebenets'>
94
- <a href='https://github.com/mgrebenets'>
95
- <img src='https://github.com/mgrebenets.png?size=140'>
96
- </a>
97
- <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
98
- </td>
99
99
  </tr>
100
100
  <tr>
101
- <td id='kohki-miki'>
102
- <a href='https://github.com/giginet'>
103
- <img src='https://github.com/giginet.png?size=140'>
101
+ <td id='stefan-natchev'>
102
+ <a href='https://github.com/snatchev'>
103
+ <img src='https://github.com/snatchev.png?size=140'>
104
104
  </a>
105
- <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
105
+ <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
106
106
  </td>
107
- <td id='andrew-mcburney'>
108
- <a href='https://github.com/armcburney'>
109
- <img src='https://github.com/armcburney.png?size=140'>
107
+ <td id='jan-piotrowski'>
108
+ <a href='https://github.com/janpio'>
109
+ <img src='https://github.com/janpio.png?size=140'>
110
110
  </a>
111
- <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
111
+ <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
112
112
  </td>
113
- <td id='luka-mirosevic'>
114
- <a href='https://github.com/lmirosevic'>
115
- <img src='https://github.com/lmirosevic.png?size=140'>
113
+ <td id='maksym-grebenets'>
114
+ <a href='https://github.com/mgrebenets'>
115
+ <img src='https://github.com/mgrebenets.png?size=140'>
116
116
  </a>
117
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
117
+ <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
118
118
  </td>
119
- <td id='josh-holtz'>
120
- <a href='https://github.com/joshdholtz'>
121
- <img src='https://github.com/joshdholtz.png?size=140'>
119
+ <td id='max-ott'>
120
+ <a href='https://github.com/max-ott'>
121
+ <img src='https://github.com/max-ott.png?size=140'>
122
122
  </a>
123
- <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
123
+ <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
124
124
  </td>
125
- <td id='fumiya-nakamura'>
126
- <a href='https://github.com/nafu'>
127
- <img src='https://github.com/nafu.png?size=140'>
125
+ <td id='jérôme-lacoste'>
126
+ <a href='https://github.com/lacostej'>
127
+ <img src='https://github.com/lacostej.png?size=140'>
128
128
  </a>
129
- <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
129
+ <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
130
130
  </td>
131
131
  </tr>
132
132
  <tr>
133
- <td id='danielle-tomlinson'>
134
- <a href='https://github.com/endocrimes'>
135
- <img src='https://github.com/endocrimes.png?size=140'>
136
- </a>
137
- <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
138
- </td>
139
133
  <td id='matthew-ellis'>
140
134
  <a href='https://github.com/matthewellis'>
141
135
  <img src='https://github.com/matthewellis.png?size=140'>
142
136
  </a>
143
137
  <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
144
138
  </td>
145
- <td id='aaron-brager'>
146
- <a href='https://github.com/getaaron'>
147
- <img src='https://github.com/getaaron.png?size=140'>
139
+ <td id='fumiya-nakamura'>
140
+ <a href='https://github.com/nafu'>
141
+ <img src='https://github.com/nafu.png?size=140'>
148
142
  </a>
149
- <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
143
+ <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
144
+ </td>
145
+ <td id='daniel-jankowski'>
146
+ <a href='https://github.com/mollyIV'>
147
+ <img src='https://github.com/mollyIV.png?size=140'>
148
+ </a>
149
+ <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
150
+ </td>
151
+ <td id='manu-wallner'>
152
+ <a href='https://github.com/milch'>
153
+ <img src='https://github.com/milch.png?size=140'>
154
+ </a>
155
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
150
156
  </td>
151
157
  <td id='helmut-januschka'>
152
158
  <a href='https://github.com/hjanuschka'>
@@ -154,12 +160,6 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
154
160
  </a>
155
161
  <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
156
162
  </td>
157
- <td id='felix-krause'>
158
- <a href='https://github.com/KrauseFx'>
159
- <img src='https://github.com/KrauseFx.png?size=140'>
160
- </a>
161
- <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
162
- </td>
163
163
  </tr>
164
164
  <tr>
165
165
  <td id='iulian-onofrei'>
@@ -168,11 +168,11 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
168
168
  </a>
169
169
  <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
170
170
  </td>
171
- <td id='jérôme-lacoste'>
172
- <a href='https://github.com/lacostej'>
173
- <img src='https://github.com/lacostej.png?size=140'>
171
+ <td id='josh-holtz'>
172
+ <a href='https://github.com/joshdholtz'>
173
+ <img src='https://github.com/joshdholtz.png?size=140'>
174
174
  </a>
175
- <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
175
+ <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
176
176
  </td>
177
177
  </table>
178
178
 
@@ -81,7 +81,7 @@ module Deliver
81
81
 
82
82
  screenshots_per_display_type.each do |display_type, screenshots|
83
83
  # create AppScreenshotSet for given display_type if it doesn't exsit
84
- app_screenshot_set = app_screenshot_set_per_locale_and_display_type[language][display_type]
84
+ app_screenshot_set = (app_screenshot_set_per_locale_and_display_type[language] || {})[display_type]
85
85
  app_screenshot_set ||= localization.create_app_screenshot_set(attributes: { screenshotDisplayType: display_type })
86
86
 
87
87
  # iterate over screenshots per display size with index
@@ -26,9 +26,10 @@ module Deliver
26
26
  end
27
27
 
28
28
  def login
29
+ # Team selection passed though FASTLANE_TEAM_ID and FASTLANE_TEAM_NAME environment variables
30
+ # Prompts select team if multiple teams and none specified
29
31
  UI.message("Login to App Store Connect (#{options[:username]})")
30
- Spaceship::ConnectAPI.login(options[:username])
31
- Spaceship::ConnectAPI.select_team
32
+ Spaceship::ConnectAPI.login(options[:username], nil, use_portal: false, use_tunes: true)
32
33
  UI.message("Login successful")
33
34
  end
34
35
 
@@ -67,7 +68,8 @@ module Deliver
67
68
  default_rule_level: options[:precheck_default_rule_level],
68
69
  include_in_app_purchases: options[:precheck_include_in_app_purchases],
69
70
  app_identifier: options[:app_identifier],
70
- username: options[:username]
71
+ username: options[:username],
72
+ platform: options[:platform]
71
73
  }
72
74
 
73
75
  precheck_config = FastlaneCore::Configuration.create(Precheck::Options.available_options, precheck_options)
@@ -26,27 +26,31 @@ module Fastlane
26
26
  end
27
27
 
28
28
  def self.get_build_number(params)
29
+ # Prompts select team if multiple teams and none specified
29
30
  UI.message("Login to App Store Connect (#{params[:username]})")
30
- Spaceship::Tunes.login(params[:username])
31
- Spaceship::Tunes.select_team(team_id: params[:team_id], team_name: params[:team_name])
31
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
32
32
  UI.message("Login successful")
33
33
 
34
- app = Spaceship::Tunes::Application.find(params[:app_identifier], mac: params[:platform] == "osx")
34
+ platform = Spaceship::ConnectAPI::Platform.map(params[:platform])
35
+
36
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
35
37
  UI.user_error!("Could not find an app on App Store Connect with app_identifier: #{params[:app_identifier]}") unless app
36
38
  if params[:live]
37
39
  UI.message("Fetching the latest build number for live-version")
38
- UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on iTC") unless app.live_version
39
- build_nr = app.live_version.current_build_number
40
+ live_version = app.get_live_app_store_version(platform: platform)
41
+
42
+ UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on App Store Connect") unless live_version
43
+ build_nr = live_version.build.version
40
44
 
41
- UI.message("Latest upload for live-version #{app.live_version.version} is build: #{build_nr}")
45
+ UI.message("Latest upload for live-version #{live_version.version_string} is build: #{build_nr}")
42
46
 
43
- return OpenStruct.new({ build_nr: build_nr, build_v: app.live_version.version })
47
+ return OpenStruct.new({ build_nr: build_nr, build_v: live_version.version_string })
44
48
  else
45
49
  version_number = params[:version]
46
50
  platform = params[:platform]
47
51
 
48
52
  # Create filter for get_builds with optional version number
49
- filter = { app: app.apple_id }
53
+ filter = { app: app.id }
50
54
  if version_number
51
55
  filter["preReleaseVersion.version"] = version_number
52
56
  version_number_message = "version #{version_number}"
@@ -6,16 +6,18 @@ module Fastlane
6
6
  class DownloadDsymsAction < Action
7
7
  # rubocop:disable Metrics/PerceivedComplexity
8
8
  def self.run(params)
9
+ require 'openssl'
9
10
  require 'spaceship'
10
11
  require 'net/http'
11
12
 
13
+ # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
14
+ # Prompts select team if multiple teams and none specified
12
15
  UI.message("Login to App Store Connect (#{params[:username]})")
13
- Spaceship::Tunes.login(params[:username])
14
- Spaceship::Tunes.select_team
16
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true)
15
17
  UI.message("Login successful")
16
18
 
17
19
  # Get App
18
- app = Spaceship::Application.find(params[:app_identifier])
20
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
19
21
  unless app
20
22
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
21
23
  end
@@ -23,38 +25,35 @@ module Fastlane
23
25
  # Process options
24
26
  version = params[:version]
25
27
  build_number = params[:build_number].to_s unless params[:build_number].nil?
26
- platform = params[:platform]
28
+ itc_platform = params[:platform]
27
29
  output_directory = params[:output_directory]
28
30
  wait_for_dsym_processing = params[:wait_for_dsym_processing]
29
31
  wait_timeout = params[:wait_timeout]
30
32
  min_version = Gem::Version.new(params[:min_version]) if params[:min_version]
31
33
 
34
+ platform = Spaceship::ConnectAPI::Platform.map(itc_platform)
35
+
32
36
  # Set version if it is latest
33
37
  if version == 'latest'
34
38
  # Try to grab the edit version first, else fallback to live version
35
39
  UI.message("Looking for latest version...")
36
- latest_version = app.edit_version(platform: platform) || app.live_version(platform: platform)
37
-
38
- UI.user_error!("Could not find latest version for your app, please try setting a specific version") if latest_version.version.nil?
39
-
40
- latest_candidate_build = latest_version.candidate_builds.max_by(&:upload_date)
41
- if latest_candidate_build.nil?
42
- version = latest_version.version
43
- build_number = latest_version.build_version
44
- else
45
- # The build_version of a candidate build does not always match the one in latest_version so get the version and build number from the same place.
46
- version = latest_candidate_build.train_version
47
- build_number = latest_candidate_build.build_version
48
- end
40
+ latest_version = app.get_edit_app_store_version(platform: platform) || app.get_live_app_store_version(platform: platform)
41
+
42
+ UI.user_error!("Could not find latest version for your app, please try setting a specific version") if latest_version.nil?
43
+
44
+ latest_build = get_latest_build!(app_id: app.id, version: latest_version.version_string, platform: platform)
45
+
46
+ version = latest_build.app_version
47
+ build_number = latest_build.version
49
48
  elsif version == 'live'
50
49
  UI.message("Looking for live version...")
51
- live_version = app.live_version(platform: platform)
50
+ live_version = app.get_live_app_store_version(platform: platform)
52
51
 
53
52
  UI.user_error!("Could not find live version for your app, please try setting 'latest' or a specific version") if live_version.nil?
54
53
 
55
54
  # No need to search for candidates, because released App Store version should only have one build
56
- version = live_version.version
57
- build_number = live_version.build_version
55
+ version = live_version.version_string
56
+ build_number = live_version.build.version
58
57
  end
59
58
 
60
59
  # Remove leading zeros from version string (eg. 1.02 -> 1.2)
@@ -74,76 +73,98 @@ module Fastlane
74
73
  message << "(#{build_number})" if build_number
75
74
  UI.message(message.join(" "))
76
75
 
77
- app.tunes_all_build_trains(platform: platform).each do |train|
76
+ filter = { app: app.id }
77
+ filter["preReleaseVersion.platform"] = platform
78
+ build_resps = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-uploadedDate", includes: "preReleaseVersion").all_pages
79
+ builds = build_resps.flat_map(&:to_models)
80
+
81
+ builds.each do |build|
82
+ asc_app_version = build.app_version
83
+ asc_build_number = build.version
84
+
78
85
  message = []
79
- message << "Found train (version): #{train.version_string}"
86
+ message << "Found train (version): #{asc_app_version}"
80
87
  message << ", comparing to supplied version: #{version}" if version
81
88
  UI.verbose(message.join(" "))
82
89
 
83
- if version && version != train.version_string
84
- UI.verbose("Version #{version} doesn't match: #{train.version_string}")
90
+ if version && version != asc_app_version
91
+ UI.verbose("Version #{version} doesn't match: #{asc_app_version}")
85
92
  next
86
93
  end
87
94
 
88
- if min_version && min_version > Gem::Version.new(train.version_string)
89
- UI.verbose("Min version #{min_version} not reached: #{train.version_string}")
95
+ if min_version && min_version > Gem::Version.new(asc_app_version)
96
+ UI.verbose("Min version #{min_version} not reached: #{asc_app_version}")
90
97
  next
91
98
  end
92
99
 
93
- app.tunes_all_builds_for_train(train: train.version_string, platform: platform).each do |build|
94
- message = []
95
- message << "Found build version: #{build.build_version}"
96
- message << ", comparing to supplied build_number: #{build_number}" if build_number
97
- UI.verbose(message.join(" "))
100
+ message = []
101
+ message << "Found build version: #{asc_build_number}"
102
+ message << ", comparing to supplied build_number: #{build_number}" if build_number
103
+ UI.verbose(message.join(" "))
98
104
 
99
- if build_number && build.build_version != build_number
100
- UI.verbose("build_version: #{build.build_version} doesn't match: #{build_number}")
101
- next
102
- end
105
+ if build_number && asc_build_number != build_number
106
+ UI.verbose("build_version: #{asc_build_number} doesn't match: #{build_number}")
107
+ next
108
+ end
103
109
 
104
- UI.verbose("Build_version: #{build.build_version} matches #{build_number}, grabbing dsym_url") if build_number
105
-
106
- start = Time.now
107
- download_url = nil
108
-
109
- loop do
110
- begin
111
- build_details = app.tunes_build_details(train: train.version_string, build_number: build.build_version, platform: platform)
112
- download_url = build_details.dsym_url
113
- UI.verbose("dsym_url: #{download_url}")
114
- rescue Spaceship::TunesClient::ITunesConnectError => ex
115
- UI.error("Error accessing dSYM file for build\n\n#{build}\n\nException: #{ex}")
116
- end
117
-
118
- unless download_url
119
- if !wait_for_dsym_processing || (Time.now - start) > wait_timeout
120
- # In some cases, AppStoreConnect does not process the dSYMs, thus no error should be thrown.
121
- UI.message("Could not find any dSYM for #{build.build_version} (#{train.version_string})")
122
- else
123
- UI.message("Waiting for dSYM file to appear...")
124
- sleep(30)
125
- next
126
- end
127
- end
128
-
129
- break
130
- end
110
+ UI.verbose("Build_version: #{asc_build_number} matches #{build_number}, grabbing dsym_url") if build_number
111
+ get_details_and_download_dsym(app: app, train: asc_app_version, build_number: asc_build_number, platform: itc_platform, wait_for_dsym_processing: wait_for_dsym_processing, wait_timeout: wait_timeout, output_directory: output_directory)
112
+ end
113
+ end
114
+
115
+ def self.get_details_and_download_dsym(app: nil, train: nil, build_number: nil, platform: nil, wait_for_dsym_processing: nil, wait_timeout: nil, output_directory: nil)
116
+ start = Time.now
117
+ download_url = nil
118
+
119
+ loop do
120
+ begin
121
+ resp = Spaceship::Tunes.client.build_details(app_id: app.id, train: train, build_number: build_number, platform: platform)
122
+
123
+ resp['apple_id'] = app.id
124
+ build_details = Spaceship::Tunes::BuildDetails.factory(resp)
131
125
 
132
- if download_url
133
- self.download(download_url, app.bundle_id, train.version_string, build.build_version, output_directory)
134
- break if build_number
126
+ download_url = build_details.dsym_url
127
+ UI.verbose("dsym_url: #{download_url}")
128
+ rescue Spaceship::TunesClient::ITunesConnectError => ex
129
+ UI.error("Error accessing dSYM file for build\n\n#{build}\n\nException: #{ex}")
130
+ end
131
+
132
+ unless download_url
133
+ if !wait_for_dsym_processing || (Time.now - start) > wait_timeout
134
+ # In some cases, AppStoreConnect does not process the dSYMs, thus no error should be thrown.
135
+ UI.message("Could not find any dSYM for #{build_number} (#{train})")
135
136
  else
136
- UI.message("No dSYM URL for #{build.build_version} (#{train.version_string})")
137
+ UI.message("Waiting for dSYM file to appear...")
138
+ sleep(30)
139
+ next
137
140
  end
138
141
  end
142
+
143
+ break
139
144
  end
140
145
 
141
- if (Actions.lane_context[SharedValues::DSYM_PATHS] || []).count == 0
142
- UI.error("No dSYM files found on App Store Connect - this usually happens when no recompiling has happened yet")
146
+ if download_url
147
+ self.download(download_url, app.bundle_id, train, build_number, output_directory)
148
+ return if build_number
149
+ else
150
+ UI.message("No dSYM URL for #{build_number} (#{train})")
143
151
  end
144
152
  end
145
153
  # rubocop:enable Metrics/PerceivedComplexity
146
154
 
155
+ def self.get_latest_build!(app_id: nil, version: nil, platform: nil)
156
+ filter = { app: app_id }
157
+ filter["preReleaseVersion.version"] = version
158
+ filter["preReleaseVersion.platform"] = platform
159
+ latest_build = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-uploadedDate", includes: "preReleaseVersion").first
160
+
161
+ if latest_build.nil?
162
+ UI.user_error!("Could not find latest bulid for version #{version}")
163
+ end
164
+
165
+ return latest_build
166
+ end
167
+
147
168
  def self.download(download_url, bundle_id, train_number, build_version, output_directory)
148
169
  result = self.download_file(download_url)
149
170
  path = write_dsym(result, bundle_id, train_number, build_version, output_directory)