fastlane 2.157.2 → 2.157.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +66 -66
  3. data/deliver/lib/deliver/runner.rb +0 -1
  4. data/fastlane/lib/fastlane/actions/{.git_commit.rb.swp → .ensure_git_status_clean.rb.swp} +0 -0
  5. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  6. data/fastlane/lib/fastlane/actions/.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 +11 -8
  9. data/fastlane/lib/fastlane/actions/download_dsyms.rb +87 -68
  10. data/fastlane/lib/fastlane/actions/set_changelog.rb +0 -1
  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 +12 -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 +1 -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/match/lib/match/spaceship_ensure.rb +5 -5
  29. data/{fastlane/lib/fastlane/.erb_template_helper.rb.swp → pilot/lib/pilot/.manager.rb.swp} +0 -0
  30. data/pilot/lib/pilot/build_manager.rb +0 -3
  31. data/pilot/lib/pilot/manager.rb +1 -2
  32. data/produce/lib/produce/itunes_connect.rb +0 -1
  33. data/sigh/lib/assets/resign.sh +9 -6
  34. data/sigh/lib/sigh/runner.rb +0 -1
  35. data/spaceship/lib/spaceship/client.rb +1 -0
  36. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  37. data/spaceship/lib/spaceship/{.DS_Store → connect_api/.DS_Store} +0 -0
  38. data/spaceship/lib/spaceship/connect_api/client.rb +10 -4
  39. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  40. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -5
  41. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  42. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  43. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +50 -50
  44. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +8 -0
  45. metadata +25 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 465b4bc1e3551c467e870d317ff7a226dd9f5ecac4c6c27dc23505d2d2e53ee7
4
- data.tar.gz: 2cdde87ff47e244e29d6970da46e72bca189224686fe92f19f6203a731b77030
3
+ metadata.gz: fd1050cf89fc0ae6d56214788fb1f78af159c544bc13f70533173a99b18444e5
4
+ data.tar.gz: a42063c3aee9786fd39100296898218318680e8c206a5a59dda6016ab4d0608d
5
5
  SHA512:
6
- metadata.gz: f1bc24ba94758c5195c6485c270cf2e143f4ecc1eebec467be9f4e3c5aae625020ac58f380888f67553fa1c13f5d921e0328bc3e0b2c0b15a28d3a6253563cf4
7
- data.tar.gz: 12398261e87004b0877024398f825f4533af281bf5685de0a1a111fdc91588abc02aa5eb23011777b1c78c0aca31939652d8d8bc18bbeb93b0aacc3a8fce8a49
6
+ metadata.gz: 87560b19fb15dc19e9930d6339c49126eb7451a29d6d6bfb4bfaa896969e1e831857ce4e76956fc3e774bc17e1d4c8a9dcaf7c114aa73052284f05f228776bf5
7
+ data.tar.gz: f0ffda1c6a9141737987eed86ccef7e4a305b27690e8b16c0e4720e281b44d38cd81a6d0312d804977e855450802f3358d52adeff4a1a444cc5de137581d847e
data/README.md CHANGED
@@ -34,11 +34,11 @@ 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='olivier-halligon'>
38
- <a href='https://github.com/AliSoftware'>
39
- <img src='https://github.com/AliSoftware.png?size=140'>
37
+ <td id='danielle-tomlinson'>
38
+ <a href='https://github.com/endocrimes'>
39
+ <img src='https://github.com/endocrimes.png?size=140'>
40
40
  </a>
41
- <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
41
+ <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
42
42
  </td>
43
43
  <td id='aaron-brager'>
44
44
  <a href='https://github.com/getaaron'>
@@ -46,17 +46,17 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
46
46
  </a>
47
47
  <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
48
48
  </td>
49
- <td id='josh-holtz'>
50
- <a href='https://github.com/joshdholtz'>
51
- <img src='https://github.com/joshdholtz.png?size=140'>
49
+ <td id='helmut-januschka'>
50
+ <a href='https://github.com/hjanuschka'>
51
+ <img src='https://github.com/hjanuschka.png?size=140'>
52
52
  </a>
53
- <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
53
+ <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
54
54
  </td>
55
- <td id='joshua-liebowitz'>
56
- <a href='https://github.com/taquitos'>
57
- <img src='https://github.com/taquitos.png?size=140'>
55
+ <td id='fumiya-nakamura'>
56
+ <a href='https://github.com/nafu'>
57
+ <img src='https://github.com/nafu.png?size=140'>
58
58
  </a>
59
- <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
59
+ <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
60
60
  </td>
61
61
  <td id='jérôme-lacoste'>
62
62
  <a href='https://github.com/lacostej'>
@@ -66,35 +66,35 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
66
66
  </td>
67
67
  </tr>
68
68
  <tr>
69
- <td id='fumiya-nakamura'>
70
- <a href='https://github.com/nafu'>
71
- <img src='https://github.com/nafu.png?size=140'>
69
+ <td id='jimmy-dee'>
70
+ <a href='https://github.com/jdee'>
71
+ <img src='https://github.com/jdee.png?size=140'>
72
72
  </a>
73
- <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
73
+ <h4 align='center'>Jimmy Dee</h4>
74
74
  </td>
75
- <td id='matthew-ellis'>
76
- <a href='https://github.com/matthewellis'>
77
- <img src='https://github.com/matthewellis.png?size=140'>
75
+ <td id='olivier-halligon'>
76
+ <a href='https://github.com/AliSoftware'>
77
+ <img src='https://github.com/AliSoftware.png?size=140'>
78
78
  </a>
79
- <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
79
+ <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
80
80
  </td>
81
- <td id='danielle-tomlinson'>
82
- <a href='https://github.com/endocrimes'>
83
- <img src='https://github.com/endocrimes.png?size=140'>
81
+ <td id='jan-piotrowski'>
82
+ <a href='https://github.com/janpio'>
83
+ <img src='https://github.com/janpio.png?size=140'>
84
84
  </a>
85
- <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
85
+ <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
86
86
  </td>
87
- <td id='jorge-revuelta-h'>
88
- <a href='https://github.com/minuscorp'>
89
- <img src='https://github.com/minuscorp.png?size=140'>
87
+ <td id='maksym-grebenets'>
88
+ <a href='https://github.com/mgrebenets'>
89
+ <img src='https://github.com/mgrebenets.png?size=140'>
90
90
  </a>
91
- <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
91
+ <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
92
92
  </td>
93
- <td id='helmut-januschka'>
94
- <a href='https://github.com/hjanuschka'>
95
- <img src='https://github.com/hjanuschka.png?size=140'>
93
+ <td id='max-ott'>
94
+ <a href='https://github.com/max-ott'>
95
+ <img src='https://github.com/max-ott.png?size=140'>
96
96
  </a>
97
- <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
97
+ <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
98
98
  </td>
99
99
  </tr>
100
100
  <tr>
@@ -104,29 +104,29 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
104
104
  </a>
105
105
  <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</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='luka-mirosevic'>
108
+ <a href='https://github.com/lmirosevic'>
109
+ <img src='https://github.com/lmirosevic.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/lmirosevic'>Luka Mirosevic</a></h4>
112
112
  </td>
113
- <td id='jimmy-dee'>
114
- <a href='https://github.com/jdee'>
115
- <img src='https://github.com/jdee.png?size=140'>
113
+ <td id='josh-holtz'>
114
+ <a href='https://github.com/joshdholtz'>
115
+ <img src='https://github.com/joshdholtz.png?size=140'>
116
116
  </a>
117
- <h4 align='center'>Jimmy Dee</h4>
117
+ <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
118
118
  </td>
119
- <td id='maksym-grebenets'>
120
- <a href='https://github.com/mgrebenets'>
121
- <img src='https://github.com/mgrebenets.png?size=140'>
119
+ <td id='manu-wallner'>
120
+ <a href='https://github.com/milch'>
121
+ <img src='https://github.com/milch.png?size=140'>
122
122
  </a>
123
- <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
123
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
124
124
  </td>
125
- <td id='max-ott'>
126
- <a href='https://github.com/max-ott'>
127
- <img src='https://github.com/max-ott.png?size=140'>
125
+ <td id='iulian-onofrei'>
126
+ <a href='https://github.com/revolter'>
127
+ <img src='https://github.com/revolter.png?size=140'>
128
128
  </a>
129
- <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
129
+ <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
130
130
  </td>
131
131
  </tr>
132
132
  <tr>
@@ -136,23 +136,17 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
136
136
  </a>
137
137
  <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
138
138
  </td>
139
- <td id='jan-piotrowski'>
140
- <a href='https://github.com/janpio'>
141
- <img src='https://github.com/janpio.png?size=140'>
142
- </a>
143
- <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
144
- </td>
145
- <td id='manu-wallner'>
146
- <a href='https://github.com/milch'>
147
- <img src='https://github.com/milch.png?size=140'>
139
+ <td id='matthew-ellis'>
140
+ <a href='https://github.com/matthewellis'>
141
+ <img src='https://github.com/matthewellis.png?size=140'>
148
142
  </a>
149
- <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
143
+ <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
150
144
  </td>
151
- <td id='iulian-onofrei'>
152
- <a href='https://github.com/revolter'>
153
- <img src='https://github.com/revolter.png?size=140'>
145
+ <td id='joshua-liebowitz'>
146
+ <a href='https://github.com/taquitos'>
147
+ <img src='https://github.com/taquitos.png?size=140'>
154
148
  </a>
155
- <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
149
+ <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
156
150
  </td>
157
151
  <td id='kohki-miki'>
158
152
  <a href='https://github.com/giginet'>
@@ -160,13 +154,19 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
160
154
  </a>
161
155
  <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
162
156
  </td>
157
+ <td id='jorge-revuelta-h'>
158
+ <a href='https://github.com/minuscorp'>
159
+ <img src='https://github.com/minuscorp.png?size=140'>
160
+ </a>
161
+ <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
162
+ </td>
163
163
  </tr>
164
164
  <tr>
165
- <td id='luka-mirosevic'>
166
- <a href='https://github.com/lmirosevic'>
167
- <img src='https://github.com/lmirosevic.png?size=140'>
165
+ <td id='andrew-mcburney'>
166
+ <a href='https://github.com/armcburney'>
167
+ <img src='https://github.com/armcburney.png?size=140'>
168
168
  </a>
169
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
169
+ <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
170
170
  </td>
171
171
  <td id='stefan-natchev'>
172
172
  <a href='https://github.com/snatchev'>
@@ -28,7 +28,6 @@ module Deliver
28
28
  def login
29
29
  UI.message("Login to App Store Connect (#{options[:username]})")
30
30
  Spaceship::ConnectAPI.login(options[:username], nil, use_portal: false, use_tunes: true)
31
- Spaceship::ConnectAPI.select_team
32
31
  UI.message("Login successful")
33
32
  end
34
33
 
@@ -27,26 +27,29 @@ module Fastlane
27
27
 
28
28
  def self.get_build_number(params)
29
29
  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])
30
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
32
31
  UI.message("Login successful")
33
32
 
34
- app = Spaceship::Tunes::Application.find(params[:app_identifier], mac: params[:platform] == "osx")
33
+ platform = Spaceship::ConnectAPI::Platform.map(params[:platform])
34
+
35
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
35
36
  UI.user_error!("Could not find an app on App Store Connect with app_identifier: #{params[:app_identifier]}") unless app
36
37
  if params[:live]
37
38
  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
39
+ live_version = app.get_live_app_store_version(platform: platform)
40
+
41
+ UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on App Store Connect") unless live_version
42
+ build_nr = live_version.build.version
40
43
 
41
- UI.message("Latest upload for live-version #{app.live_version.version} is build: #{build_nr}")
44
+ UI.message("Latest upload for live-version #{live_version.version_string} is build: #{build_nr}")
42
45
 
43
- return OpenStruct.new({ build_nr: build_nr, build_v: app.live_version.version })
46
+ return OpenStruct.new({ build_nr: build_nr, build_v: live_version.version_string })
44
47
  else
45
48
  version_number = params[:version]
46
49
  platform = params[:platform]
47
50
 
48
51
  # Create filter for get_builds with optional version number
49
- filter = { app: app.apple_id }
52
+ filter = { app: app.id }
50
53
  if version_number
51
54
  filter["preReleaseVersion.version"] = version_number
52
55
  version_number_message = "version #{version_number}"
@@ -6,16 +6,16 @@ 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
 
12
13
  UI.message("Login to App Store Connect (#{params[:username]})")
13
- Spaceship::Tunes.login(params[:username])
14
- Spaceship::Tunes.select_team
14
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true)
15
15
  UI.message("Login successful")
16
16
 
17
17
  # Get App
18
- app = Spaceship::Application.find(params[:app_identifier])
18
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
19
19
  unless app
20
20
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
21
21
  end
@@ -23,38 +23,35 @@ module Fastlane
23
23
  # Process options
24
24
  version = params[:version]
25
25
  build_number = params[:build_number].to_s unless params[:build_number].nil?
26
- platform = params[:platform]
26
+ itc_platform = params[:platform]
27
27
  output_directory = params[:output_directory]
28
28
  wait_for_dsym_processing = params[:wait_for_dsym_processing]
29
29
  wait_timeout = params[:wait_timeout]
30
30
  min_version = Gem::Version.new(params[:min_version]) if params[:min_version]
31
31
 
32
+ platform = Spaceship::ConnectAPI::Platform.map(itc_platform)
33
+
32
34
  # Set version if it is latest
33
35
  if version == 'latest'
34
36
  # Try to grab the edit version first, else fallback to live version
35
37
  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
38
+ latest_version = app.get_edit_app_store_version(platform: platform) || app.get_live_app_store_version(platform: platform)
39
+
40
+ UI.user_error!("Could not find latest version for your app, please try setting a specific version") if latest_version.nil?
41
+
42
+ latest_build = get_latest_build!(app_id: app.id, version: latest_version.version_string, platform: platform)
43
+
44
+ version = latest_build.app_version
45
+ build_number = latest_build.version
49
46
  elsif version == 'live'
50
47
  UI.message("Looking for live version...")
51
- live_version = app.live_version(platform: platform)
48
+ live_version = app.get_live_app_store_version(platform: platform)
52
49
 
53
50
  UI.user_error!("Could not find live version for your app, please try setting 'latest' or a specific version") if live_version.nil?
54
51
 
55
52
  # 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
53
+ version = live_version.version_string
54
+ build_number = live_version.build.version
58
55
  end
59
56
 
60
57
  # Remove leading zeros from version string (eg. 1.02 -> 1.2)
@@ -74,76 +71,98 @@ module Fastlane
74
71
  message << "(#{build_number})" if build_number
75
72
  UI.message(message.join(" "))
76
73
 
77
- app.tunes_all_build_trains(platform: platform).each do |train|
74
+ filter = { app: app.id }
75
+ filter["preReleaseVersion.platform"] = platform
76
+ build_resps = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-uploadedDate", includes: "preReleaseVersion").all_pages
77
+ builds = build_resps.flat_map(&:to_models)
78
+
79
+ builds.each do |build|
80
+ asc_app_version = build.app_version
81
+ asc_build_number = build.version
82
+
78
83
  message = []
79
- message << "Found train (version): #{train.version_string}"
84
+ message << "Found train (version): #{asc_app_version}"
80
85
  message << ", comparing to supplied version: #{version}" if version
81
86
  UI.verbose(message.join(" "))
82
87
 
83
- if version && version != train.version_string
84
- UI.verbose("Version #{version} doesn't match: #{train.version_string}")
88
+ if version && version != asc_app_version
89
+ UI.verbose("Version #{version} doesn't match: #{asc_app_version}")
85
90
  next
86
91
  end
87
92
 
88
- if min_version && min_version > Gem::Version.new(train.version_string)
89
- UI.verbose("Min version #{min_version} not reached: #{train.version_string}")
93
+ if min_version && min_version > Gem::Version.new(asc_app_version)
94
+ UI.verbose("Min version #{min_version} not reached: #{asc_app_version}")
90
95
  next
91
96
  end
92
97
 
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(" "))
98
+ message = []
99
+ message << "Found build version: #{asc_build_number}"
100
+ message << ", comparing to supplied build_number: #{build_number}" if build_number
101
+ UI.verbose(message.join(" "))
98
102
 
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
103
+ if build_number && asc_build_number != build_number
104
+ UI.verbose("build_version: #{asc_build_number} doesn't match: #{build_number}")
105
+ next
106
+ end
103
107
 
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
108
+ UI.verbose("Build_version: #{asc_build_number} matches #{build_number}, grabbing dsym_url") if build_number
109
+ 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)
110
+ end
111
+ end
112
+
113
+ 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)
114
+ start = Time.now
115
+ download_url = nil
116
+
117
+ loop do
118
+ begin
119
+ resp = Spaceship::Tunes.client.build_details(app_id: app.id, train: train, build_number: build_number, platform: platform)
120
+
121
+ resp['apple_id'] = app.id
122
+ build_details = Spaceship::Tunes::BuildDetails.factory(resp)
131
123
 
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
124
+ download_url = build_details.dsym_url
125
+ UI.verbose("dsym_url: #{download_url}")
126
+ rescue Spaceship::TunesClient::ITunesConnectError => ex
127
+ UI.error("Error accessing dSYM file for build\n\n#{build}\n\nException: #{ex}")
128
+ end
129
+
130
+ unless download_url
131
+ if !wait_for_dsym_processing || (Time.now - start) > wait_timeout
132
+ # In some cases, AppStoreConnect does not process the dSYMs, thus no error should be thrown.
133
+ UI.message("Could not find any dSYM for #{build_number} (#{train})")
135
134
  else
136
- UI.message("No dSYM URL for #{build.build_version} (#{train.version_string})")
135
+ UI.message("Waiting for dSYM file to appear...")
136
+ sleep(30)
137
+ next
137
138
  end
138
139
  end
140
+
141
+ break
139
142
  end
140
143
 
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")
144
+ if download_url
145
+ self.download(download_url, app.bundle_id, train, build_number, output_directory)
146
+ return if build_number
147
+ else
148
+ UI.message("No dSYM URL for #{build_number} (#{train})")
143
149
  end
144
150
  end
145
151
  # rubocop:enable Metrics/PerceivedComplexity
146
152
 
153
+ def self.get_latest_build!(app_id: nil, version: nil, platform: nil)
154
+ filter = { app: app_id }
155
+ filter["preReleaseVersion.version"] = version
156
+ filter["preReleaseVersion.platform"] = platform
157
+ latest_build = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-uploadedDate", includes: "preReleaseVersion").first
158
+
159
+ if latest_build.nil?
160
+ UI.user_error!("Could not find latest bulid for version #{version}")
161
+ end
162
+
163
+ return latest_build
164
+ end
165
+
147
166
  def self.download(download_url, bundle_id, train_number, build_version, output_directory)
148
167
  result = self.download_file(download_url)
149
168
  path = write_dsym(result, bundle_id, train_number, build_version, output_directory)