fastlane 2.156.1 → 2.157.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +82 -82
  3. data/deliver/lib/deliver.rb +1 -0
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +26 -29
  5. data/deliver/lib/deliver/detect_values.rb +4 -1
  6. data/deliver/lib/deliver/languages.rb +7 -0
  7. data/deliver/lib/deliver/loader.rb +4 -5
  8. data/deliver/lib/deliver/runner.rb +8 -5
  9. data/deliver/lib/deliver/upload_screenshots.rb +34 -17
  10. data/fastlane/lib/fastlane/actions/{.git_commit.rb.swp → .ensure_git_status_clean.rb.swp} +0 -0
  11. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  12. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  13. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  14. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +12 -8
  15. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +120 -0
  16. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -0
  18. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +17 -1
  19. data/fastlane/lib/fastlane/actions/download_dsyms.rb +89 -68
  20. data/fastlane/lib/fastlane/actions/set_changelog.rb +3 -2
  21. data/fastlane/lib/fastlane/actions/sonar.rb +5 -0
  22. data/fastlane/lib/fastlane/actions/spaceship_stats.rb +73 -0
  23. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +4 -0
  24. data/fastlane/lib/fastlane/version.rb +1 -1
  25. data/fastlane/swift/Deliverfile.swift +1 -1
  26. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  27. data/fastlane/swift/Fastlane.swift +78 -18
  28. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  29. data/fastlane/swift/Gymfile.swift +1 -1
  30. data/fastlane/swift/GymfileProtocol.swift +1 -1
  31. data/fastlane/swift/Matchfile.swift +1 -1
  32. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  33. data/fastlane/swift/Precheckfile.swift +1 -1
  34. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  35. data/fastlane/swift/Scanfile.swift +1 -1
  36. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  37. data/fastlane/swift/Screengrabfile.swift +1 -1
  38. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  39. data/fastlane/swift/Snapshotfile.swift +1 -1
  40. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  41. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -0
  42. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +71 -42
  43. data/gym/lib/gym/error_handler.rb +1 -1
  44. data/match/lib/match/spaceship_ensure.rb +5 -5
  45. data/{fastlane/lib/fastlane/.erb_template_helper.rb.swp → pilot/lib/pilot/.manager.rb.swp} +0 -0
  46. data/pilot/lib/pilot/build_manager.rb +15 -4
  47. data/pilot/lib/pilot/manager.rb +15 -5
  48. data/pilot/lib/pilot/options.rb +16 -0
  49. data/produce/lib/produce/itunes_connect.rb +3 -2
  50. data/screengrab/lib/screengrab/runner.rb +29 -10
  51. data/sigh/lib/assets/resign.sh +9 -6
  52. data/sigh/lib/sigh/runner.rb +5 -4
  53. data/spaceship/lib/spaceship.rb +4 -0
  54. data/spaceship/lib/spaceship/client.rb +3 -0
  55. data/spaceship/lib/spaceship/connect_api.rb +1 -15
  56. data/spaceship/lib/spaceship/{.DS_Store → connect_api/.DS_Store} +0 -0
  57. data/spaceship/lib/spaceship/connect_api/api_client.rb +270 -0
  58. data/spaceship/lib/spaceship/connect_api/client.rb +155 -210
  59. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  60. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -5
  61. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  62. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  63. data/spaceship/lib/spaceship/connect_api/provisioning/client.rb +8 -17
  64. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +75 -64
  65. data/spaceship/lib/spaceship/connect_api/spaceship.rb +98 -0
  66. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +8 -17
  67. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +288 -277
  68. data/spaceship/lib/spaceship/connect_api/token.rb +46 -5
  69. data/spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb +24 -0
  70. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +8 -17
  71. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +725 -706
  72. data/spaceship/lib/spaceship/connect_api/users/client.rb +8 -17
  73. data/spaceship/lib/spaceship/connect_api/users/users.rb +28 -17
  74. data/spaceship/lib/spaceship/stats_middleware.rb +65 -0
  75. metadata +33 -22
  76. data/spaceship/lib/spaceship/connect_api/.client.rb.swp +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ddb9f8d09ffcb09f5ddd4d6365f67d41c538e8804630e40911e058a8174aaf2
4
- data.tar.gz: 8bf0f6513c658bb9891058e5bee6fb22689bc496376e4aff6a2d2e5f1a2b9b74
3
+ metadata.gz: 724ffba6ca23aa124bf2c5493e9bb4eda084ce2361eb9c1ee2db3eb04c3a25cc
4
+ data.tar.gz: 51d3469c018497d533e66922626264fe6b561b71ec30351a1c578e500ed2b7fa
5
5
  SHA512:
6
- metadata.gz: 9627a6de633cc011c1cd083468869543125e4eb021f025152c3aaf0e4e6067c80bcc514e71c1d425485138df0ff7ab43fa70771d846e0270c49ad50b60dc47c1
7
- data.tar.gz: 177ba0af8b688d96e5374f7a3175663cebe4e3bae3966733880e75e0634cc4e1cdedc3f12c1c8ac0cd415b024eb3aa9385489d67f98b2e9d4e5175631d2874bf
6
+ metadata.gz: e4f3bd7df2c383ae03f2550a9a7847e2913d3d6a048ad7efa14e4bf145156da2590b5c75c12eb303d14e6aaa838be7cadf8f6986b76d3121c2fdaacd7a0c2104
7
+ data.tar.gz: '0853ba7ad4d7725e0c1ab9f89e733e1ec361dee2abdbc835aace640216d7d0f3796afafd8e852f8b5a2d8cdae9d5347c064946c3eccfd9242065455602558796'
data/README.md CHANGED
@@ -34,29 +34,43 @@ 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'>
40
+ </a>
41
+ <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
42
+ </td>
37
43
  <td id='jorge-revuelta-h'>
38
44
  <a href='https://github.com/minuscorp'>
39
45
  <img src='https://github.com/minuscorp.png?size=140'>
40
46
  </a>
41
47
  <h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
42
48
  </td>
43
- <td id='luka-mirosevic'>
44
- <a href='https://github.com/lmirosevic'>
45
- <img src='https://github.com/lmirosevic.png?size=140'>
49
+ <td id='jan-piotrowski'>
50
+ <a href='https://github.com/janpio'>
51
+ <img src='https://github.com/janpio.png?size=140'>
46
52
  </a>
47
- <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
53
+ <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
48
54
  </td>
49
- <td id='josh-holtz'>
50
- <a href='https://github.com/joshdholtz'>
51
- <img src='https://github.com/joshdholtz.png?size=140'>
55
+ <td id='jérôme-lacoste'>
56
+ <a href='https://github.com/lacostej'>
57
+ <img src='https://github.com/lacostej.png?size=140'>
52
58
  </a>
53
- <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
59
+ <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
54
60
  </td>
55
- <td id='felix-krause'>
56
- <a href='https://github.com/KrauseFx'>
57
- <img src='https://github.com/KrauseFx.png?size=140'>
61
+ <td id='olivier-halligon'>
62
+ <a href='https://github.com/AliSoftware'>
63
+ <img src='https://github.com/AliSoftware.png?size=140'>
58
64
  </a>
59
- <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
65
+ <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</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>
60
74
  </td>
61
75
  <td id='fumiya-nakamura'>
62
76
  <a href='https://github.com/nafu'>
@@ -64,6 +78,24 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
64
78
  </a>
65
79
  <h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
66
80
  </td>
81
+ <td id='joshua-liebowitz'>
82
+ <a href='https://github.com/taquitos'>
83
+ <img src='https://github.com/taquitos.png?size=140'>
84
+ </a>
85
+ <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
86
+ </td>
87
+ <td id='helmut-januschka'>
88
+ <a href='https://github.com/hjanuschka'>
89
+ <img src='https://github.com/hjanuschka.png?size=140'>
90
+ </a>
91
+ <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
92
+ </td>
93
+ <td id='luka-mirosevic'>
94
+ <a href='https://github.com/lmirosevic'>
95
+ <img src='https://github.com/lmirosevic.png?size=140'>
96
+ </a>
97
+ <h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
98
+ </td>
67
99
  </tr>
68
100
  <tr>
69
101
  <td id='max-ott'>
@@ -72,69 +104,49 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
72
104
  </a>
73
105
  <h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
74
106
  </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='jérôme-lacoste'>
82
- <a href='https://github.com/lacostej'>
83
- <img src='https://github.com/lacostej.png?size=140'>
84
- </a>
85
- <h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
86
- </td>
87
- <td id='joshua-liebowitz'>
88
- <a href='https://github.com/taquitos'>
89
- <img src='https://github.com/taquitos.png?size=140'>
107
+ <td id='josh-holtz'>
108
+ <a href='https://github.com/joshdholtz'>
109
+ <img src='https://github.com/joshdholtz.png?size=140'>
90
110
  </a>
91
- <h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
111
+ <h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
92
112
  </td>
93
- <td id='iulian-onofrei'>
94
- <a href='https://github.com/revolter'>
95
- <img src='https://github.com/revolter.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'>
96
116
  </a>
97
- <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
117
+ <h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
98
118
  </td>
99
- </tr>
100
- <tr>
101
119
  <td id='jimmy-dee'>
102
120
  <a href='https://github.com/jdee'>
103
121
  <img src='https://github.com/jdee.png?size=140'>
104
122
  </a>
105
123
  <h4 align='center'>Jimmy Dee</h4>
106
124
  </td>
107
- <td id='andrew-mcburney'>
108
- <a href='https://github.com/armcburney'>
109
- <img src='https://github.com/armcburney.png?size=140'>
110
- </a>
111
- <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
112
- </td>
113
- <td id='kohki-miki'>
114
- <a href='https://github.com/giginet'>
115
- <img src='https://github.com/giginet.png?size=140'>
125
+ <td id='manu-wallner'>
126
+ <a href='https://github.com/milch'>
127
+ <img src='https://github.com/milch.png?size=140'>
116
128
  </a>
117
- <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
129
+ <h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
118
130
  </td>
119
- <td id='jan-piotrowski'>
120
- <a href='https://github.com/janpio'>
121
- <img src='https://github.com/janpio.png?size=140'>
131
+ </tr>
132
+ <tr>
133
+ <td id='felix-krause'>
134
+ <a href='https://github.com/KrauseFx'>
135
+ <img src='https://github.com/KrauseFx.png?size=140'>
122
136
  </a>
123
- <h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
137
+ <h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
124
138
  </td>
125
- <td id='olivier-halligon'>
126
- <a href='https://github.com/AliSoftware'>
127
- <img src='https://github.com/AliSoftware.png?size=140'>
139
+ <td id='danielle-tomlinson'>
140
+ <a href='https://github.com/endocrimes'>
141
+ <img src='https://github.com/endocrimes.png?size=140'>
128
142
  </a>
129
- <h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
143
+ <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
130
144
  </td>
131
- </tr>
132
- <tr>
133
- <td id='helmut-januschka'>
134
- <a href='https://github.com/hjanuschka'>
135
- <img src='https://github.com/hjanuschka.png?size=140'>
145
+ <td id='iulian-onofrei'>
146
+ <a href='https://github.com/revolter'>
147
+ <img src='https://github.com/revolter.png?size=140'>
136
148
  </a>
137
- <h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
149
+ <h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
138
150
  </td>
139
151
  <td id='daniel-jankowski'>
140
152
  <a href='https://github.com/mollyIV'>
@@ -142,37 +154,25 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
142
154
  </a>
143
155
  <h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</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='aaron-brager'>
152
- <a href='https://github.com/getaaron'>
153
- <img src='https://github.com/getaaron.png?size=140'>
154
- </a>
155
- <h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
156
- </td>
157
- <td id='matthew-ellis'>
158
- <a href='https://github.com/matthewellis'>
159
- <img src='https://github.com/matthewellis.png?size=140'>
157
+ <td id='stefan-natchev'>
158
+ <a href='https://github.com/snatchev'>
159
+ <img src='https://github.com/snatchev.png?size=140'>
160
160
  </a>
161
- <h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
161
+ <h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
162
162
  </td>
163
163
  </tr>
164
164
  <tr>
165
- <td id='maksym-grebenets'>
166
- <a href='https://github.com/mgrebenets'>
167
- <img src='https://github.com/mgrebenets.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/mgrebenets'>Maksym Grebenets</a></h4>
169
+ <h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
170
170
  </td>
171
- <td id='danielle-tomlinson'>
172
- <a href='https://github.com/endocrimes'>
173
- <img src='https://github.com/endocrimes.png?size=140'>
171
+ <td id='kohki-miki'>
172
+ <a href='https://github.com/giginet'>
173
+ <img src='https://github.com/giginet.png?size=140'>
174
174
  </a>
175
- <h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
175
+ <h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
176
176
  </td>
177
177
  </table>
178
178
 
@@ -1,3 +1,4 @@
1
+ require_relative 'deliver/languages'
1
2
  require_relative 'deliver/loader'
2
3
  require_relative 'deliver/options'
3
4
  require_relative 'deliver/commands_generator'
@@ -13,14 +13,14 @@ module Deliver
13
13
  # @yield [localization, app_screenshot_set]
14
14
  # @yieldparam [optional, Spaceship::ConnectAPI::AppStoreVersionLocalization] localization
15
15
  # @yieldparam [optional, Spaceship::ConnectAPI::AppStoreScreenshotSet] app_screenshot_set
16
- def each_app_screenshot_set(&block)
17
- return enum_for(__method__) unless block_given?
16
+ def each_app_screenshot_set(localizations = @localizations, &block)
17
+ return enum_for(__method__, localizations) unless block_given?
18
18
 
19
19
  # Collect app_screenshot_sets from localizations in parallel but
20
20
  # limit the number of threads working at a time with using `lazy` and `force` controls
21
21
  # to not attack App Store Connect
22
- results = @localizations.each_slice(NUMBER_OF_THREADS).lazy.map do |localizations|
23
- localizations.map do |localization|
22
+ results = localizations.each_slice(NUMBER_OF_THREADS).lazy.map do |localizations_grouped|
23
+ localizations_grouped.map do |localization|
24
24
  Thread.new do
25
25
  [localization, localization.get_app_screenshot_sets]
26
26
  end
@@ -63,35 +63,32 @@ module Deliver
63
63
  def each_local_screenshot(screenshots_per_language, &block)
64
64
  return enum_for(__method__, screenshots_per_language) unless block_given?
65
65
 
66
- # Iterate over all the screenshots per language and display_type
67
- # and then enqueue them to worker one by one if it's not duplciated on App Store Connect
68
- screenshots_per_language.map do |language, screenshots_for_language|
69
- localization = @localizations.find { |l| l.locale == language }
70
- [localization, screenshots_for_language]
71
- end.reject do |localization, _|
72
- localization.nil?
73
- end.each do |localization, screenshots_for_language|
74
- iterate_over_screenshots_per_language(localization, screenshots_for_language, &block)
75
- end
76
- end
66
+ # filter unnecessary localizations
67
+ supported_localizations = @localizations.reject { |l| screenshots_per_language[l.locale].nil? }
77
68
 
78
- private
69
+ # build a hash that can access app_screenshot_set corresponding to given locale and display_type
70
+ # via parallelized each_app_screenshot_set to gain performance
71
+ app_screenshot_set_per_locale_and_display_type = each_app_screenshot_set(supported_localizations)
72
+ .each_with_object({}) do |(localization, app_screenshot_set), hash|
73
+ hash[localization.locale] ||= {}
74
+ hash[localization.locale][app_screenshot_set.screenshot_display_type] = app_screenshot_set
75
+ end
79
76
 
80
- def iterate_over_screenshots_per_language(localization, screenshots_for_language, &block)
81
- app_screenshot_sets_per_display_type = localization.get_app_screenshot_sets.map { |set| [set.screenshot_display_type, set] }.to_h
82
- screenshots_per_display_type = screenshots_for_language.reject { |screenshot| screenshot.device_type.nil? }.group_by(&:device_type)
77
+ # iterate over screenshots per localization
78
+ screenshots_per_language.each do |language, screenshots_for_language|
79
+ localization = supported_localizations.find { |l| l.locale == language }
80
+ screenshots_per_display_type = screenshots_for_language.reject { |screenshot| screenshot.device_type.nil? }.group_by(&:device_type)
83
81
 
84
- screenshots_per_display_type.each do |display_type, screenshots|
85
- # Create AppScreenshotSet for given display_type if it doesn't exsit
86
- app_screenshot_set = app_screenshot_sets_per_display_type[display_type]
87
- app_screenshot_set ||= localization.create_app_screenshot_set(attributes: { screenshotDisplayType: display_type })
88
- iterate_over_screenshots_per_display_type(localization, app_screenshot_set, screenshots, &block)
89
- end
90
- end
82
+ screenshots_per_display_type.each do |display_type, screenshots|
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]
85
+ app_screenshot_set ||= localization.create_app_screenshot_set(attributes: { screenshotDisplayType: display_type })
91
86
 
92
- def iterate_over_screenshots_per_display_type(localization, app_screenshot_set, screenshots, &block)
93
- screenshots.each.with_index do |screenshot, index|
94
- yield(localization, app_screenshot_set, screenshot, index)
87
+ # iterate over screenshots per display size with index
88
+ screenshots.each.with_index do |screenshot, index|
89
+ yield(localization, app_screenshot_set, screenshot, index)
90
+ end
91
+ end
95
92
  end
96
93
  end
97
94
  end
@@ -5,6 +5,7 @@ require 'spaceship/tunes/tunes'
5
5
  require 'spaceship/tunes/application'
6
6
 
7
7
  require_relative 'module'
8
+ require_relative 'languages'
8
9
 
9
10
  module Deliver
10
11
  class DetectValues
@@ -88,7 +89,9 @@ module Deliver
88
89
  languages = options[:languages]
89
90
  return unless languages
90
91
 
91
- all_languages = Spaceship::Tunes.client.available_languages
92
+ # 2020-08-24 - Available locales are not available as an endpoint in App Store Connect
93
+ # Update with Spaceship::Tunes.client.available_languages.sort (as long as endpoint is avilable)
94
+ all_languages = Deliver::Languages::ALL_LANGUAGES
92
95
  diff = languages - all_languages
93
96
 
94
97
  unless diff.empty?
@@ -0,0 +1,7 @@
1
+ module Deliver
2
+ module Languages
3
+ # 2020-08-24 - Available locales are not available as an endpoint in App Store Connect
4
+ # Update with Spaceship::Tunes.client.available_languages.sort (as long as endpoint is avilable)
5
+ ALL_LANGUAGES = ["ar-SA", "ca", "cs", "da", "de-DE", "el", "en-AU", "en-CA", "en-GB", "en-US", "es-ES", "es-MX", "fi", "fr-CA", "fr-FR", "he", "hi", "hr", "hu", "id", "it", "ja", "ko", "ms", "nl-NL", "no", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sv", "th", "tr", "uk", "vi", "zh-Hans", "zh-Hant"]
6
+ end
7
+ end
@@ -3,6 +3,7 @@ require 'spaceship/tunes/tunes'
3
3
 
4
4
  require_relative 'module'
5
5
  require_relative 'upload_metadata'
6
+ require_relative 'languages'
6
7
 
7
8
  module Deliver
8
9
  module Loader
@@ -24,11 +25,9 @@ module Deliver
24
25
  def self.language_folders(root, ignore_validation)
25
26
  folders = Dir.glob(File.join(root, '*'))
26
27
 
27
- if Helper.test?
28
- available_languages = FastlaneCore::Languages::ALL_LANGUAGES
29
- else
30
- available_languages = Spaceship::Tunes.client.available_languages.sort
31
- end
28
+ # 2020-08-24 - Available locales are not available as an endpoint in App Store Connect
29
+ # Update with Spaceship::Tunes.client.available_languages.sort (as long as endpoint is avilable)
30
+ available_languages = Deliver::Languages::ALL_LANGUAGES
32
31
 
33
32
  allowed_directory_names_with_case = (available_languages + SPECIAL_DIR_NAMES)
34
33
  allowed_directory_names = allowed_directory_names_with_case.map(&:downcase).freeze
@@ -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::Tunes.login(options[:username])
31
- Spaceship::Tunes.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
 
@@ -177,17 +178,19 @@ module Deliver
177
178
  # If there are multiple teams, infer the provider from the selected team name.
178
179
  # If there are fewer than two teams, don't infer the provider.
179
180
  def transporter_for_selected_team
181
+ tunes_client = Spaceship::ConnectAPI.client.tunes_client
182
+
180
183
  generic_transporter = FastlaneCore::ItunesTransporter.new(options[:username], nil, false, options[:itc_provider])
181
- return generic_transporter unless options[:itc_provider].nil? && Spaceship::Tunes.client.teams.count > 1
184
+ return generic_transporter unless options[:itc_provider].nil? && tunes_client.teams.count > 1
182
185
 
183
186
  begin
184
- team = Spaceship::Tunes.client.teams.find { |t| t['contentProvider']['contentProviderId'].to_s == Spaceship::Tunes.client.team_id }
187
+ team = tunes_client.teams.find { |t| t['contentProvider']['contentProviderId'].to_s == tunes_client.team_id }
185
188
  name = team['contentProvider']['name']
186
189
  provider_id = generic_transporter.provider_ids[name]
187
190
  UI.verbose("Inferred provider id #{provider_id} for team #{name}.")
188
191
  return FastlaneCore::ItunesTransporter.new(options[:username], nil, false, provider_id)
189
192
  rescue => ex
190
- UI.verbose("Couldn't infer a provider short name for team with id #{Spaceship::Tunes.client.team_id} automatically: #{ex}. Proceeding without provider short name.")
193
+ UI.verbose("Couldn't infer a provider short name for team with id #{tunes_client.team_id} automatically: #{ex}. Proceeding without provider short name.")
191
194
  return generic_transporter
192
195
  end
193
196
  end
@@ -179,21 +179,40 @@ module Deliver
179
179
  # Verify all screenshots states on App Store Connect are okay
180
180
  def retry_upload_screenshots_if_needed(iterator, states, number_of_screenshots, tries, localizations, screenshots_per_language)
181
181
  is_failure = states.fetch("FAILED", 0) > 0
182
- is_missing_screenshot = states.reduce(0) { |sum, (k, v)| sum + v } != number_of_screenshots && !screenshots_per_language.empty?
182
+ is_missing_screenshot = !screenshots_per_language.empty? && !verify_local_screenshots_are_uploaded(iterator, screenshots_per_language)
183
+ return unless is_failure || is_missing_screenshot
183
184
 
184
- if is_failure || is_missing_screenshot
185
- if tries.zero?
186
- incomplete_screenshot_count = states.reject { |k, v| k == 'COMPLETE' }.reduce(0) { |sum, (k, v)| sum + v }
187
- UI.user_error!("Failed verification of all screenshots uploaded... #{incomplete_screenshot_count} incomplete screenshot(s) still exist")
188
- else
189
- UI.error("Failed to upload all screenshots... Tries remaining: #{tries}")
190
- # Delete bad entries before retry
191
- iterator.each_app_screenshot do |_, _, app_screenshot|
192
- app_screenshot.delete! unless app_screenshot.complete?
193
- end
194
- upload_screenshots(localizations, screenshots_per_language, tries: tries)
185
+ if tries.zero?
186
+ iterator.each_app_screenshot.select { |_, _, app_screenshot| app_screenshot.error? }.each do |localization, _, app_screenshot|
187
+ UI.error("#{app_screenshot.file_name} for #{localization.locale} has error(s) - #{app_screenshot.error_messages.join(', ')}")
195
188
  end
189
+ incomplete_screenshot_count = states.reject { |k, v| k == 'COMPLETE' }.reduce(0) { |sum, (k, v)| sum + v }
190
+ UI.user_error!("Failed verification of all screenshots uploaded... #{incomplete_screenshot_count} incomplete screenshot(s) still exist")
191
+ else
192
+ UI.error("Failed to upload all screenshots... Tries remaining: #{tries}")
193
+ # Delete bad entries before retry
194
+ iterator.each_app_screenshot do |_, _, app_screenshot|
195
+ app_screenshot.delete! unless app_screenshot.complete?
196
+ end
197
+ upload_screenshots(localizations, screenshots_per_language, tries: tries)
198
+ end
199
+ end
200
+
201
+ # Return `true` if all the local screenshots are uploaded to App Store Connect
202
+ def verify_local_screenshots_are_uploaded(iterator, screenshots_per_language)
203
+ # Check if local screenshots' checksum exist on App Store Connect
204
+ checksum_to_app_screenshot = iterator.each_app_screenshot.map { |_, _, app_screenshot| [app_screenshot.source_file_checksum, app_screenshot] }.to_h
205
+
206
+ missing_local_screenshots = iterator.each_local_screenshot(screenshots_per_language).select do |_, _, local_screenshot, index|
207
+ checksum = UploadScreenshots.calculate_checksum(local_screenshot.path)
208
+ checksum_to_app_screenshot[checksum].nil? && index < 10 # if index is more than 10, it's skipped
209
+ end
210
+
211
+ missing_local_screenshots.each do |_, _, screenshot, _|
212
+ UI.error("#{screenshot.path} is missing on App Store Connect.")
196
213
  end
214
+
215
+ missing_local_screenshots.empty?
197
216
  end
198
217
 
199
218
  def sort_screenshots(localizations)
@@ -285,11 +304,9 @@ module Deliver
285
304
 
286
305
  # helper method so Spaceship::Tunes.client.available_languages is easier to test
287
306
  def self.available_languages
288
- if Helper.test?
289
- FastlaneCore::Languages::ALL_LANGUAGES
290
- else
291
- Spaceship::Tunes.client.available_languages
292
- end
307
+ # 2020-08-24 - Available locales are not available as an endpoint in App Store Connect
308
+ # Update with Spaceship::Tunes.client.available_languages.sort (as long as endpoint is avilable)
309
+ Deliver::Languages::ALL_LANGUAGES
293
310
  end
294
311
 
295
312
  # helper method to mock this step in tests