fastlane 2.157.1 → 2.159.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55737a8f7b3af40ddeb4e00f4466372cfa18a26add15401b31ada8a8c75e1fbc
4
- data.tar.gz: afd86451de8c50a3072ebb5a52fd4193b6af6c22a4c578ad1de0b5d3a5a5a110
3
+ metadata.gz: 580e666fe7cc2465dab2cf2b222e64043365b10445aa3ebc747a88cbb3dd39ea
4
+ data.tar.gz: a87f27692ad0f8f0341f60fbd077468ab7d9f6a52fc6d7c380339ca054a32ec6
5
5
  SHA512:
6
- metadata.gz: 8726dd0393f1af51a65958340652efc406be6e78b65e03d4febaf5bd944fc2224c5cd05e05cd4719a0c9045d6734d0ca1dc9c772b4ca5519292f927ceb3b8fef
7
- data.tar.gz: 932807e7809d67579397f6a513161342ace1afb4589058d7e77607961681de53a9424742e3bb3b757980bacfe0b7bc5d48d19cb7f1bb21de960cf516c83ff9ca
6
+ metadata.gz: 5efd5d62be52c22f814bad1afc08e446b60cc97338c205ab10b84357c875d22b1429b5b442e892b7a3d4f67ddd874ed0b101025b4f7ea66c4a26713b044a43f5
7
+ data.tar.gz: b60237273ab6edb899e46b8ae2db68d8064ae476e34139f9b5e653e7f89b6a4159f12a1895d50984e2f2f762723bc9ead7a9c9ccc629d28525d0a592af169522
data/README.md CHANGED
@@ -34,61 +34,87 @@ 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='matthew-ellis'>
38
- <a href='https://github.com/matthewellis'>
39
- <img src='https://github.com/matthewellis.png?size=140'>
37
+ <td id='josh-holtz'>
38
+ <a href='https://github.com/joshdholtz'>
39
+ <img src='https://github.com/joshdholtz.png?size=140'>
40
40
  </a>
41
- <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
41
+ <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
42
42
  </td>
43
- <td id='olivier-halligon'>
44
- <a href='https://github.com/AliSoftware'>
45
- <img src='https://github.com/AliSoftware.png?size=140'>
43
+ <td id='jan-piotrowski'>
44
+ <a href='https://github.com/janpio'>
45
+ <img src='https://github.com/janpio.png?size=140'>
46
46
  </a>
47
- <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
47
+ <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
48
48
  </td>
49
- <td id='iulian-onofrei'>
50
- <a href='https://github.com/revolter'>
51
- <img src='https://github.com/revolter.png?size=140'>
49
+ <td id='jérôme-lacoste'>
50
+ <a href='https://github.com/lacostej'>
51
+ <img src='https://github.com/lacostej.png?size=140'>
52
52
  </a>
53
- <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
53
+ <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
54
54
  </td>
55
- <td id='jimmy-dee'>
56
- <a href='https://github.com/jdee'>
57
- <img src='https://github.com/jdee.png?size=140'>
55
+ <td id='andrew-mcburney'>
56
+ <a href='https://github.com/armcburney'>
57
+ <img src='https://github.com/armcburney.png?size=140'>
58
58
  </a>
59
- <h4 align='center'>Jimmy Dee</h4>
59
+ <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
60
60
  </td>
61
- <td id='jan-piotrowski'>
62
- <a href='https://github.com/janpio'>
63
- <img src='https://github.com/janpio.png?size=140'>
61
+ <td id='jorge-revuelta-h'>
62
+ <a href='https://github.com/minuscorp'>
63
+ <img src='https://github.com/minuscorp.png?size=140'>
64
64
  </a>
65
- <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
65
+ <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
66
66
  </td>
67
67
  </tr>
68
68
  <tr>
69
+ <td id='luka-mirosevic'>
70
+ <a href='https://github.com/lmirosevic'>
71
+ <img src='https://github.com/lmirosevic.png?size=140'>
72
+ </a>
73
+ <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
74
+ </td>
75
+ <td id='stefan-natchev'>
76
+ <a href='https://github.com/snatchev'>
77
+ <img src='https://github.com/snatchev.png?size=140'>
78
+ </a>
79
+ <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
80
+ </td>
81
+ <td id='manu-wallner'>
82
+ <a href='https://github.com/milch'>
83
+ <img src='https://github.com/milch.png?size=140'>
84
+ </a>
85
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
86
+ </td>
69
87
  <td id='fumiya-nakamura'>
70
88
  <a href='https://github.com/nafu'>
71
89
  <img src='https://github.com/nafu.png?size=140'>
72
90
  </a>
73
91
  <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
74
92
  </td>
75
- <td id='josh-holtz'>
76
- <a href='https://github.com/joshdholtz'>
77
- <img src='https://github.com/joshdholtz.png?size=140'>
93
+ <td id='iulian-onofrei'>
94
+ <a href='https://github.com/revolter'>
95
+ <img src='https://github.com/revolter.png?size=140'>
78
96
  </a>
79
- <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
97
+ <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
80
98
  </td>
81
- <td id='andrew-mcburney'>
82
- <a href='https://github.com/armcburney'>
83
- <img src='https://github.com/armcburney.png?size=140'>
99
+ </tr>
100
+ <tr>
101
+ <td id='max-ott'>
102
+ <a href='https://github.com/max-ott'>
103
+ <img src='https://github.com/max-ott.png?size=140'>
84
104
  </a>
85
- <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
105
+ <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
86
106
  </td>
87
- <td id='kohki-miki'>
88
- <a href='https://github.com/giginet'>
89
- <img src='https://github.com/giginet.png?size=140'>
107
+ <td id='olivier-halligon'>
108
+ <a href='https://github.com/AliSoftware'>
109
+ <img src='https://github.com/AliSoftware.png?size=140'>
90
110
  </a>
91
- <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
111
+ <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
112
+ </td>
113
+ <td id='aaron-brager'>
114
+ <a href='https://github.com/getaaron'>
115
+ <img src='https://github.com/getaaron.png?size=140'>
116
+ </a>
117
+ <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
92
118
  </td>
93
119
  <td id='helmut-januschka'>
94
120
  <a href='https://github.com/hjanuschka'>
@@ -96,84 +122,58 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
96
122
  </a>
97
123
  <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
98
124
  </td>
125
+ <td id='matthew-ellis'>
126
+ <a href='https://github.com/matthewellis'>
127
+ <img src='https://github.com/matthewellis.png?size=140'>
128
+ </a>
129
+ <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
130
+ </td>
99
131
  </tr>
100
132
  <tr>
133
+ <td id='joshua-liebowitz'>
134
+ <a href='https://github.com/taquitos'>
135
+ <img src='https://github.com/taquitos.png?size=140'>
136
+ </a>
137
+ <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
138
+ </td>
101
139
  <td id='daniel-jankowski'>
102
140
  <a href='https://github.com/mollyIV'>
103
141
  <img src='https://github.com/mollyIV.png?size=140'>
104
142
  </a>
105
143
  <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
106
144
  </td>
107
- <td id='jorge-revuelta-h'>
108
- <a href='https://github.com/minuscorp'>
109
- <img src='https://github.com/minuscorp.png?size=140'>
110
- </a>
111
- <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
112
- </td>
113
- <td id='max-ott'>
114
- <a href='https://github.com/max-ott'>
115
- <img src='https://github.com/max-ott.png?size=140'>
116
- </a>
117
- <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
118
- </td>
119
145
  <td id='maksym-grebenets'>
120
146
  <a href='https://github.com/mgrebenets'>
121
147
  <img src='https://github.com/mgrebenets.png?size=140'>
122
148
  </a>
123
149
  <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
124
150
  </td>
125
- <td id='aaron-brager'>
126
- <a href='https://github.com/getaaron'>
127
- <img src='https://github.com/getaaron.png?size=140'>
128
- </a>
129
- <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
130
- </td>
131
- </tr>
132
- <tr>
133
- <td id='stefan-natchev'>
134
- <a href='https://github.com/snatchev'>
135
- <img src='https://github.com/snatchev.png?size=140'>
136
- </a>
137
- <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
138
- </td>
139
151
  <td id='danielle-tomlinson'>
140
152
  <a href='https://github.com/endocrimes'>
141
153
  <img src='https://github.com/endocrimes.png?size=140'>
142
154
  </a>
143
155
  <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
144
156
  </td>
145
- <td id='manu-wallner'>
146
- <a href='https://github.com/milch'>
147
- <img src='https://github.com/milch.png?size=140'>
148
- </a>
149
- <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
150
- </td>
151
- <td id='luka-mirosevic'>
152
- <a href='https://github.com/lmirosevic'>
153
- <img src='https://github.com/lmirosevic.png?size=140'>
154
- </a>
155
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
156
- </td>
157
- <td id='joshua-liebowitz'>
158
- <a href='https://github.com/taquitos'>
159
- <img src='https://github.com/taquitos.png?size=140'>
157
+ <td id='kohki-miki'>
158
+ <a href='https://github.com/giginet'>
159
+ <img src='https://github.com/giginet.png?size=140'>
160
160
  </a>
161
- <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
161
+ <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
162
162
  </td>
163
163
  </tr>
164
164
  <tr>
165
- <td id='jérôme-lacoste'>
166
- <a href='https://github.com/lacostej'>
167
- <img src='https://github.com/lacostej.png?size=140'>
168
- </a>
169
- <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
170
- </td>
171
165
  <td id='felix-krause'>
172
166
  <a href='https://github.com/KrauseFx'>
173
167
  <img src='https://github.com/KrauseFx.png?size=140'>
174
168
  </a>
175
169
  <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
176
170
  </td>
171
+ <td id='jimmy-dee'>
172
+ <a href='https://github.com/jdee'>
173
+ <img src='https://github.com/jdee.png?size=140'>
174
+ </a>
175
+ <h4 align='center'>Jimmy Dee</h4>
176
+ </td>
177
177
  </table>
178
178
 
179
179
  Special thanks to all [contributors](https://github.com/fastlane/fastlane/graphs/contributors) for extending and improving _fastlane_.
@@ -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
32
  Spaceship::ConnectAPI.login(options[:username], nil, use_portal: false, use_tunes: true)
31
- Spaceship::ConnectAPI.select_team
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)
@@ -111,7 +111,11 @@ module Deliver
111
111
  end
112
112
 
113
113
  # Needed for to filter out release notes from being sent up
114
- number_of_versions = app.get_app_store_versions(filter: { platform: platform }, limit: 2).size
114
+ number_of_versions = Spaceship::ConnectAPI.get_app_store_versions(
115
+ app_id: app.id,
116
+ filter: { platform: platform },
117
+ limit: 2
118
+ ).count
115
119
  is_first_version = number_of_versions == 1
116
120
  UI.verbose("Version '#{version.version_string}' is the first version on App Store Connect") if is_first_version
117
121
 
@@ -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}"
@@ -32,7 +32,7 @@ For all commands, you can either use an [API Key](#app-store-connect-api-key) or
32
32
 
33
33
  The App Store Connect API Key is the preferred authentication method (if you are able to use it).
34
34
 
35
- - Uses offial App Store Connect API
35
+ - Uses official App Store Connect API
36
36
  - No need for 2FA
37
37
  - Better performance over Apple ID
38
38
 
@@ -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 build 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)