fastlane 2.212.1 → 2.219.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -100
  3. data/deliver/lib/deliver/app_screenshot.rb +22 -12
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +2 -2
  5. data/deliver/lib/deliver/detect_values.rb +1 -1
  6. data/deliver/lib/deliver/languages.rb +1 -1
  7. data/deliver/lib/deliver/loader.rb +2 -2
  8. data/deliver/lib/deliver/options.rb +4 -4
  9. data/deliver/lib/deliver/runner.rb +10 -9
  10. data/deliver/lib/deliver/submit_for_review.rb +13 -0
  11. data/deliver/lib/deliver/sync_screenshots.rb +2 -2
  12. data/deliver/lib/deliver/upload_metadata.rb +60 -15
  13. data/deliver/lib/deliver/upload_price_tier.rb +2 -2
  14. data/deliver/lib/deliver/upload_screenshots.rb +3 -3
  15. data/fastlane/lib/assets/custom_action_template.rb +18 -12
  16. data/fastlane/lib/fastlane/action.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/appledoc.rb +1 -1
  18. data/fastlane/lib/fastlane/actions/apteligent.rb +1 -1
  19. data/fastlane/lib/fastlane/actions/backup_xcarchive.rb +1 -1
  20. data/fastlane/lib/fastlane/actions/commit_github_file.rb +2 -2
  21. data/fastlane/lib/fastlane/actions/copy_artifacts.rb +1 -1
  22. data/fastlane/lib/fastlane/actions/create_app_online.rb +1 -1
  23. data/fastlane/lib/fastlane/actions/create_pull_request.rb +1 -1
  24. data/fastlane/lib/fastlane/actions/docs/build_app.md +2 -2
  25. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +8 -8
  26. data/fastlane/lib/fastlane/actions/docs/check_app_store_metadata.md +3 -3
  27. data/fastlane/lib/fastlane/actions/docs/get_push_certificate.md +2 -2
  28. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +6 -4
  29. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +1 -1
  30. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +6 -2
  31. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +1 -1
  32. data/fastlane/lib/fastlane/actions/download_universal_apk_from_google_play.rb +124 -0
  33. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +44 -5
  34. data/fastlane/lib/fastlane/actions/ensure_xcode_version.rb +4 -0
  35. data/fastlane/lib/fastlane/actions/get_certificates.rb +1 -1
  36. data/fastlane/lib/fastlane/actions/get_github_release.rb +1 -1
  37. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -1
  38. data/fastlane/lib/fastlane/actions/git_branch.rb +1 -1
  39. data/fastlane/lib/fastlane/actions/github_api.rb +1 -1
  40. data/fastlane/lib/fastlane/actions/gradle.rb +1 -1
  41. data/fastlane/lib/fastlane/actions/install_on_device.rb +2 -2
  42. data/fastlane/lib/fastlane/actions/ipa.rb +1 -1
  43. data/fastlane/lib/fastlane/actions/jazzy.rb +1 -1
  44. data/fastlane/lib/fastlane/actions/nexus_upload.rb +1 -0
  45. data/fastlane/lib/fastlane/actions/notarize.rb +17 -2
  46. data/fastlane/lib/fastlane/actions/oclint.rb +3 -3
  47. data/fastlane/lib/fastlane/actions/opt_out_crash_reporting.rb +2 -2
  48. data/fastlane/lib/fastlane/actions/restore_file.rb +1 -1
  49. data/fastlane/lib/fastlane/actions/set_github_release.rb +1 -1
  50. data/fastlane/lib/fastlane/actions/slather.rb +18 -5
  51. data/fastlane/lib/fastlane/actions/sonar.rb +12 -3
  52. data/fastlane/lib/fastlane/actions/splunkmint.rb +1 -1
  53. data/fastlane/lib/fastlane/actions/spm.rb +76 -2
  54. data/fastlane/lib/fastlane/actions/update_info_plist.rb +1 -1
  55. data/fastlane/lib/fastlane/actions/update_urban_airship_configuration.rb +1 -1
  56. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +1 -0
  57. data/fastlane/lib/fastlane/actions/upload_symbols_to_sentry.rb +1 -1
  58. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +2 -2
  59. data/fastlane/lib/fastlane/actions/verify_build.rb +7 -4
  60. data/fastlane/lib/fastlane/actions/xcov.rb +1 -1
  61. data/fastlane/lib/fastlane/cli_tools_distributor.rb +1 -1
  62. data/fastlane/lib/fastlane/command_line_handler.rb +2 -4
  63. data/fastlane/lib/fastlane/commands_generator.rb +2 -2
  64. data/fastlane/lib/fastlane/fast_file.rb +1 -1
  65. data/fastlane/lib/fastlane/helper/dotenv_helper.rb +1 -1
  66. data/fastlane/lib/fastlane/helper/git_helper.rb +3 -0
  67. data/fastlane/lib/fastlane/helper/xcodes_helper.rb +0 -3
  68. data/fastlane/lib/fastlane/junit_generator.rb +1 -1
  69. data/fastlane/lib/fastlane/lane.rb +9 -1
  70. data/fastlane/lib/fastlane/lane_manager.rb +1 -2
  71. data/fastlane/lib/fastlane/new_action.rb +1 -1
  72. data/fastlane/lib/fastlane/plugins/plugin_info_collector.rb +3 -3
  73. data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +1 -13
  74. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +9 -1
  75. data/fastlane/lib/fastlane/plugins/template/Gemfile.erb +27 -0
  76. data/fastlane/lib/fastlane/plugins/template/lib/fastlane/plugin/%plugin_name%/helper/%plugin_name%_helper.rb.erb +1 -1
  77. data/fastlane/lib/fastlane/runner.rb +2 -2
  78. data/fastlane/lib/fastlane/setup/setup.rb +1 -1
  79. data/fastlane/lib/fastlane/swift_lane_manager.rb +2 -5
  80. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +7 -4
  81. data/fastlane/lib/fastlane/version.rb +2 -2
  82. data/fastlane/swift/Actions.swift +1 -1
  83. data/fastlane/swift/Appfile.swift +1 -1
  84. data/fastlane/swift/ArgumentProcessor.swift +1 -1
  85. data/fastlane/swift/Atomic.swift +1 -1
  86. data/fastlane/swift/ControlCommand.swift +1 -1
  87. data/fastlane/swift/Deliverfile.swift +2 -2
  88. data/fastlane/swift/DeliverfileProtocol.swift +4 -4
  89. data/fastlane/swift/Fastlane.swift +227 -36
  90. data/fastlane/swift/Gymfile.swift +2 -2
  91. data/fastlane/swift/GymfileProtocol.swift +2 -2
  92. data/fastlane/swift/LaneFileProtocol.swift +5 -5
  93. data/fastlane/swift/MainProcess.swift +1 -1
  94. data/fastlane/swift/Matchfile.swift +2 -2
  95. data/fastlane/swift/MatchfileProtocol.swift +22 -2
  96. data/fastlane/swift/OptionalConfigValue.swift +1 -1
  97. data/fastlane/swift/Plugins.swift +1 -1
  98. data/fastlane/swift/Precheckfile.swift +2 -2
  99. data/fastlane/swift/PrecheckfileProtocol.swift +2 -2
  100. data/fastlane/swift/RubyCommand.swift +1 -1
  101. data/fastlane/swift/RubyCommandable.swift +1 -1
  102. data/fastlane/swift/Runner.swift +1 -1
  103. data/fastlane/swift/RunnerArgument.swift +1 -1
  104. data/fastlane/swift/Scanfile.swift +2 -2
  105. data/fastlane/swift/ScanfileProtocol.swift +6 -2
  106. data/fastlane/swift/Screengrabfile.swift +2 -2
  107. data/fastlane/swift/ScreengrabfileProtocol.swift +2 -2
  108. data/fastlane/swift/Snapshotfile.swift +2 -2
  109. data/fastlane/swift/SnapshotfileProtocol.swift +2 -2
  110. data/fastlane/swift/SocketClient.swift +1 -1
  111. data/fastlane/swift/SocketClientDelegateProtocol.swift +1 -1
  112. data/fastlane/swift/SocketResponse.swift +1 -1
  113. data/fastlane/swift/formatting/Brewfile.lock.json +31 -23
  114. data/fastlane/swift/main.swift +1 -1
  115. data/fastlane_core/lib/fastlane_core/build_watcher.rb +1 -1
  116. data/fastlane_core/lib/fastlane_core/cert_checker.rb +4 -9
  117. data/fastlane_core/lib/fastlane_core/configuration/configuration_file.rb +1 -1
  118. data/fastlane_core/lib/fastlane_core/device_manager.rb +17 -15
  119. data/fastlane_core/lib/fastlane_core/fastlane_pty.rb +34 -12
  120. data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
  121. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +53 -16
  122. data/fastlane_core/lib/fastlane_core/project.rb +7 -2
  123. data/fastlane_core/lib/fastlane_core/queue_worker.rb +2 -2
  124. data/fastlane_core/lib/fastlane_core/string_filters.rb +6 -6
  125. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +2 -2
  126. data/frameit/lib/frameit/device_types.rb +1 -1
  127. data/frameit/lib/frameit/editor.rb +4 -4
  128. data/frameit/lib/frameit/trim_box.rb +1 -1
  129. data/gym/lib/gym/error_handler.rb +1 -1
  130. data/gym/lib/gym/generators/build_command_generator.rb +1 -1
  131. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +3 -3
  132. data/gym/lib/gym/module.rb +13 -2
  133. data/gym/lib/gym/options.rb +1 -1
  134. data/gym/lib/gym/runner.rb +1 -1
  135. data/gym/lib/gym/xcodebuild_fixes/README.md +1 -1
  136. data/match/lib/match/change_password.rb +3 -9
  137. data/match/lib/match/commands_generator.rb +3 -6
  138. data/match/lib/match/encryption.rb +1 -1
  139. data/match/lib/match/generator.rb +9 -1
  140. data/match/lib/match/importer.rb +3 -30
  141. data/match/lib/match/migrate.rb +6 -2
  142. data/match/lib/match/module.rb +2 -1
  143. data/match/lib/match/nuke.rb +3 -24
  144. data/match/lib/match/options.rb +25 -0
  145. data/match/lib/match/portal_cache.rb +106 -0
  146. data/match/lib/match/portal_fetcher.rb +72 -0
  147. data/match/lib/match/profile_includes.rb +120 -0
  148. data/match/lib/match/runner.rb +93 -209
  149. data/match/lib/match/setup.rb +1 -1
  150. data/match/lib/match/spaceship_ensure.rb +15 -11
  151. data/match/lib/match/storage/git_storage.rb +17 -4
  152. data/match/lib/match/storage/gitlab/client.rb +40 -14
  153. data/match/lib/match/storage/gitlab_secure_files.rb +18 -7
  154. data/match/lib/match/storage/interface.rb +1 -1
  155. data/match/lib/match/storage/s3_storage.rb +7 -1
  156. data/match/lib/match/storage.rb +56 -5
  157. data/match/lib/match.rb +3 -0
  158. data/pilot/lib/pilot/build_manager.rb +4 -4
  159. data/precheck/lib/precheck/rules/unreachable_urls_rule.rb +1 -1
  160. data/produce/lib/produce/itunes_connect.rb +1 -1
  161. data/scan/lib/scan/detect_values.rb +86 -21
  162. data/scan/lib/scan/options.rb +6 -1
  163. data/scan/lib/scan/runner.rb +1 -1
  164. data/scan/lib/scan/test_command_generator.rb +1 -1
  165. data/screengrab/lib/screengrab/runner.rb +1 -1
  166. data/sigh/lib/assets/resign.sh +10 -10
  167. data/sigh/lib/sigh/commands_generator.rb +1 -1
  168. data/sigh/lib/sigh/module.rb +98 -0
  169. data/sigh/lib/sigh/options.rb +55 -1
  170. data/sigh/lib/sigh/resign.rb +1 -1
  171. data/sigh/lib/sigh/runner.rb +36 -112
  172. data/snapshot/lib/assets/SnapshotHelper.swift +13 -9
  173. data/snapshot/lib/snapshot/latest_os_version.rb +2 -5
  174. data/snapshot/lib/snapshot/reports_generator.rb +48 -7
  175. data/snapshot/lib/snapshot/setup.rb +2 -2
  176. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +23 -22
  177. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -2
  178. data/snapshot/lib/snapshot/test_command_generator.rb +1 -1
  179. data/spaceship/lib/spaceship/client.rb +1 -2
  180. data/spaceship/lib/spaceship/connect_api/api_client.rb +22 -3
  181. data/spaceship/lib/spaceship/connect_api/client.rb +4 -4
  182. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -4
  183. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +15 -9
  184. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +2 -0
  185. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +2 -2
  186. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +7 -0
  187. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +1 -0
  188. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +3 -1
  189. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +5 -5
  190. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +3 -3
  191. data/spaceship/lib/spaceship/connect_api/models/device.rb +83 -4
  192. data/spaceship/lib/spaceship/connect_api/models/profile.rb +5 -3
  193. data/spaceship/lib/spaceship/connect_api/models/user.rb +38 -0
  194. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +5 -15
  195. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +14 -8
  196. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +8 -2
  197. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +3 -6
  198. data/spaceship/lib/spaceship/connect_api/users/users.rb +34 -0
  199. data/spaceship/lib/spaceship/connect_api.rb +2 -0
  200. data/spaceship/lib/spaceship/portal/app.rb +1 -1
  201. data/spaceship/lib/spaceship/portal/app_group.rb +1 -1
  202. data/spaceship/lib/spaceship/test_flight/client.rb +1 -1
  203. data/spaceship/lib/spaceship/test_flight/tester.rb +1 -1
  204. data/spaceship/lib/spaceship/tunes/app_details.rb +2 -2
  205. data/spaceship/lib/spaceship/tunes/app_image.rb +1 -1
  206. data/spaceship/lib/spaceship/tunes/app_review_attachment.rb +1 -1
  207. data/spaceship/lib/spaceship/tunes/app_submission.rb +1 -1
  208. data/spaceship/lib/spaceship/tunes/app_version.rb +5 -5
  209. data/spaceship/lib/spaceship/tunes/build_details.rb +1 -1
  210. data/spaceship/lib/spaceship/tunes/iap.rb +3 -3
  211. data/spaceship/lib/spaceship/tunes/iap_detail.rb +2 -2
  212. data/spaceship/lib/spaceship/tunes/iap_families.rb +1 -1
  213. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +2 -2
  214. data/spaceship/lib/spaceship/tunes/iap_family_list.rb +1 -1
  215. data/spaceship/lib/spaceship/tunes/tunes_client.rb +3 -3
  216. data/supply/lib/supply/client.rb +80 -21
  217. data/supply/lib/supply/generated_universal_apk.rb +24 -0
  218. data/supply/lib/supply/image_listing.rb +15 -0
  219. data/supply/lib/supply/options.rb +5 -0
  220. data/supply/lib/supply/setup.rb +2 -2
  221. data/supply/lib/supply/uploader.rb +60 -18
  222. data/supply/lib/supply.rb +2 -0
  223. data/trainer/lib/trainer/junit_generator.rb +1 -1
  224. data/trainer/lib/trainer/test_parser.rb +1 -1
  225. data/trainer/lib/trainer/xcresult.rb +1 -1
  226. metadata +205 -431
  227. data/fastlane/lib/fastlane/plugins/template/Gemfile +0 -6
@@ -4,6 +4,7 @@ require 'credentials_manager/appfile_config'
4
4
  require_relative 'module'
5
5
 
6
6
  module Match
7
+ # rubocop:disable Metrics/ClassLength
7
8
  class Options
8
9
  # This is match specific, as users can append storage specific options
9
10
  def self.append_option(option)
@@ -222,12 +223,30 @@ module Match
222
223
  env_name: "MATCH_S3_OBJECT_PREFIX",
223
224
  description: "Prefix to be used on all objects uploaded to S3",
224
225
  optional: true),
226
+ FastlaneCore::ConfigItem.new(key: :s3_skip_encryption,
227
+ env_name: "MATCH_S3_SKIP_ENCRYPTION",
228
+ description: "Skip encryption of all objects uploaded to S3. WARNING: only enable this on S3 buckets with sufficiently restricted permissions and server-side encryption enabled. See https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingEncryption.html",
229
+ type: Boolean,
230
+ default_value: false),
225
231
 
226
232
  # Storage: GitLab Secure Files
227
233
  FastlaneCore::ConfigItem.new(key: :gitlab_project,
228
234
  env_name: "MATCH_GITLAB_PROJECT",
229
235
  description: "GitLab Project Path (i.e. 'gitlab-org/gitlab')",
230
236
  optional: true),
237
+ FastlaneCore::ConfigItem.new(key: :gitlab_host,
238
+ env_name: "MATCH_GITLAB_HOST",
239
+ default_value: 'https://gitlab.com',
240
+ description: "GitLab Host (i.e. 'https://gitlab.com')",
241
+ optional: true),
242
+ FastlaneCore::ConfigItem.new(key: :job_token,
243
+ env_name: "CI_JOB_TOKEN",
244
+ description: "GitLab CI_JOB_TOKEN",
245
+ optional: true),
246
+ FastlaneCore::ConfigItem.new(key: :private_token,
247
+ env_name: "PRIVATE_TOKEN",
248
+ description: "GitLab Access Token",
249
+ optional: true),
231
250
 
232
251
  # Keychain
233
252
  FastlaneCore::ConfigItem.new(key: :keychain_name,
@@ -263,6 +282,11 @@ module Match
263
282
  description: "Include all matching certificates in the provisioning profile. Works only for the 'development' provisioning profile type",
264
283
  type: Boolean,
265
284
  default_value: false),
285
+ FastlaneCore::ConfigItem.new(key: :certificate_id,
286
+ env_name: "MATCH_CERTIFICATE_ID",
287
+ description: "Select certificate by id. Useful if multiple certificates are stored in one place",
288
+ type: String,
289
+ optional: true),
266
290
  FastlaneCore::ConfigItem.new(key: :force_for_new_certificates,
267
291
  env_name: "MATCH_FORCE_FOR_NEW_CERTIFICATES",
268
292
  description: "Renew the provisioning profiles if the certificate count on the developer portal has changed. Works only for the 'development' provisioning profile type. Requires 'include_all_certificates' option to be 'true'",
@@ -344,4 +368,5 @@ module Match
344
368
  ]
345
369
  end
346
370
  end
371
+ # rubocop:enable Metrics/ClassLength
347
372
  end
@@ -0,0 +1,106 @@
1
+ require 'fastlane_core/provisioning_profile'
2
+ require 'spaceship/client'
3
+ require_relative 'portal_fetcher'
4
+ module Match
5
+ class Portal
6
+ class Cache
7
+ def self.build(params:, bundle_id_identifiers:)
8
+ require_relative 'profile_includes'
9
+ require 'sigh'
10
+
11
+ profile_type = Sigh.profile_type_for_distribution_type(
12
+ platform: params[:platform],
13
+ distribution_type: params[:type]
14
+ )
15
+
16
+ cache = Portal::Cache.new(
17
+ platform: params[:platform],
18
+ profile_type: profile_type,
19
+ additional_cert_types: params[:additional_cert_types],
20
+ bundle_id_identifiers: bundle_id_identifiers,
21
+ needs_profiles_devices: ProfileIncludes.can_force_include_all_devices?(params: params, notify: true),
22
+ needs_profiles_certificate_content: !ProfileIncludes.can_force_include_all_certificates?(params: params, notify: true),
23
+ include_mac_in_profiles: params[:include_mac_in_profiles]
24
+ )
25
+
26
+ return cache
27
+ end
28
+
29
+ attr_reader :platform, :profile_type, :bundle_id_identifiers, :additional_cert_types, :needs_profiles_devices, :needs_profiles_certificate_content, :include_mac_in_profiles
30
+
31
+ def initialize(platform:, profile_type:, additional_cert_types:, bundle_id_identifiers:, needs_profiles_devices:, needs_profiles_certificate_content:, include_mac_in_profiles:)
32
+ @platform = platform
33
+ @profile_type = profile_type
34
+
35
+ # Bundle Ids
36
+ @bundle_id_identifiers = bundle_id_identifiers
37
+
38
+ # Certs
39
+ @additional_cert_types = additional_cert_types
40
+
41
+ # Profiles
42
+ @needs_profiles_devices = needs_profiles_devices
43
+ @needs_profiles_certificate_content = needs_profiles_certificate_content
44
+
45
+ # Devices
46
+ @include_mac_in_profiles = include_mac_in_profiles
47
+ end
48
+
49
+ def portal_profile(stored_profile_path:, keychain_path:)
50
+ parsed = FastlaneCore::ProvisioningProfile.parse(stored_profile_path, keychain_path)
51
+ uuid = parsed["UUID"]
52
+
53
+ portal_profile = self.profiles.detect { |i| i.uuid == uuid }
54
+
55
+ portal_profile
56
+ end
57
+
58
+ def reset_certificates
59
+ @certificates = nil
60
+ end
61
+
62
+ def forget_portal_profile(portal_profile)
63
+ return unless @profiles && portal_profile
64
+
65
+ @profiles -= [portal_profile]
66
+ end
67
+
68
+ def bundle_ids
69
+ @bundle_ids ||= Match::Portal::Fetcher.bundle_ids(
70
+ bundle_id_identifiers: @bundle_id_identifiers
71
+ )
72
+
73
+ return @bundle_ids.dup
74
+ end
75
+
76
+ def certificates
77
+ @certificates ||= Match::Portal::Fetcher.certificates(
78
+ platform: @platform,
79
+ profile_type: @profile_type,
80
+ additional_cert_types: @additional_cert_types
81
+ )
82
+
83
+ return @certificates.dup
84
+ end
85
+
86
+ def profiles
87
+ @profiles ||= Match::Portal::Fetcher.profiles(
88
+ profile_type: @profile_type,
89
+ needs_profiles_devices: @needs_profiles_devices,
90
+ needs_profiles_certificate_content: @needs_profiles_certificate_content
91
+ )
92
+
93
+ return @profiles.dup
94
+ end
95
+
96
+ def devices
97
+ @devices ||= Match::Portal::Fetcher.devices(
98
+ platform: @platform,
99
+ include_mac_in_profiles: @include_mac_in_profiles
100
+ )
101
+
102
+ return @devices.dup
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,72 @@
1
+ require 'fastlane_core/provisioning_profile'
2
+ require 'spaceship/client'
3
+ require 'spaceship/connect_api/models/profile'
4
+
5
+ module Match
6
+ class Portal
7
+ module Fetcher
8
+ def self.profiles(profile_type:, needs_profiles_devices: false, needs_profiles_certificate_content: false, name: nil)
9
+ includes = ['bundleId']
10
+
11
+ if needs_profiles_devices
12
+ includes += ['devices', 'certificates']
13
+ end
14
+
15
+ if needs_profiles_certificate_content
16
+ includes += ['certificates']
17
+ end
18
+
19
+ profiles = Spaceship::ConnectAPI::Profile.all(
20
+ filter: { profileType: profile_type, name: name }.compact,
21
+ includes: includes.uniq.join(',')
22
+ )
23
+
24
+ profiles
25
+ end
26
+
27
+ def self.certificates(platform:, profile_type:, additional_cert_types:)
28
+ require 'sigh'
29
+ certificate_types = Sigh.certificate_types_for_profile_and_platform(platform: platform, profile_type: profile_type)
30
+
31
+ additional_cert_types ||= []
32
+ additional_cert_types.map! do |cert_type|
33
+ case Match.cert_type_sym(cert_type)
34
+ when :mac_installer_distribution
35
+ Spaceship::ConnectAPI::Certificate::CertificateType::MAC_INSTALLER_DISTRIBUTION
36
+ when :developer_id_installer
37
+ Spaceship::ConnectAPI::Certificate::CertificateType::DEVELOPER_ID_INSTALLER
38
+ end
39
+ end
40
+
41
+ certificate_types += additional_cert_types
42
+
43
+ filter = { certificateType: certificate_types.uniq.sort.join(',') } unless certificate_types.empty?
44
+
45
+ certificates = Spaceship::ConnectAPI::Certificate.all(
46
+ filter: filter
47
+ ).select(&:valid?)
48
+
49
+ certificates
50
+ end
51
+
52
+ def self.devices(platform: nil, include_mac_in_profiles: false)
53
+ devices = Spaceship::ConnectAPI::Device.devices_for_platform(
54
+ platform: platform,
55
+ include_mac_in_profiles: include_mac_in_profiles
56
+ )
57
+
58
+ devices
59
+ end
60
+
61
+ def self.bundle_ids(bundle_id_identifiers: nil)
62
+ filter = { identifier: bundle_id_identifiers.join(',') } if bundle_id_identifiers
63
+
64
+ bundle_ids = Spaceship::ConnectAPI::BundleId.all(
65
+ filter: filter
66
+ )
67
+
68
+ bundle_ids
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,120 @@
1
+ require_relative 'portal_fetcher'
2
+ require_relative 'module'
3
+
4
+ module Match
5
+ class ProfileIncludes
6
+ PROV_TYPES_WITH_DEVICES = [:adhoc, :development]
7
+ PROV_TYPES_WITH_MULTIPLE_CERTIFICATES = [:development]
8
+
9
+ def self.can_force_include?(params:, notify:)
10
+ self.can_force_include_all_devices?(params: params, notify: notify) &&
11
+ self.can_force_include_all_certificates?(params: params, notify: notify)
12
+ end
13
+
14
+ ###############
15
+ #
16
+ # DEVICES
17
+ #
18
+ ###############
19
+
20
+ def self.should_force_include_all_devices?(params:, portal_profile:, cached_devices:)
21
+ return false unless self.can_force_include_all_devices?(params: params)
22
+
23
+ force = devices_differ?(portal_profile: portal_profile, platform: params[:platform], include_mac_in_profiles: params[:include_mac_in_profiles], cached_devices: cached_devices)
24
+
25
+ return force
26
+ end
27
+
28
+ def self.can_force_include_all_devices?(params:, notify: false)
29
+ return false if params[:readonly] || params[:force]
30
+ return false unless params[:force_for_new_devices]
31
+
32
+ provisioning_type = params[:type].to_sym
33
+
34
+ can_force = PROV_TYPES_WITH_DEVICES.include?(provisioning_type)
35
+
36
+ if !can_force && notify
37
+ # App Store provisioning profiles don't contain device identifiers and
38
+ # thus shouldn't be renewed if the device count has changed.
39
+ UI.important("Warning: `force_for_new_devices` is set but is ignored for #{provisioning_type}.")
40
+ UI.important("You can safely stop specifying `force_for_new_devices` when running Match for type '#{provisioning_type}'.")
41
+ end
42
+
43
+ can_force
44
+ end
45
+
46
+ def self.devices_differ?(portal_profile:, platform:, include_mac_in_profiles:, cached_devices:)
47
+ return false unless portal_profile
48
+
49
+ profile_devices = portal_profile.devices || []
50
+
51
+ portal_devices = cached_devices
52
+ portal_devices ||= Match::Portal::Fetcher.devices(platform: platform, include_mac_in_profiles: include_mac_in_profiles)
53
+
54
+ profile_device_ids = profile_devices.map(&:id).sort
55
+ portal_devices_ids = portal_devices.map(&:id).sort
56
+
57
+ devices_differs = profile_device_ids != portal_devices_ids
58
+
59
+ UI.important("Devices in the profile and available on the portal differ. Recreating a profile") if devices_differs
60
+
61
+ return devices_differs
62
+ end
63
+
64
+ ###############
65
+ #
66
+ # CERTIFICATES
67
+ #
68
+ ###############
69
+
70
+ def self.should_force_include_all_certificates?(params:, portal_profile:, cached_certificates:)
71
+ return false unless self.can_force_include_all_certificates?(params: params)
72
+
73
+ force = certificates_differ?(portal_profile: portal_profile, platform: params[:platform], cached_certificates: cached_certificates)
74
+
75
+ return force
76
+ end
77
+
78
+ def self.can_force_include_all_certificates?(params:, notify: false)
79
+ return false if params[:readonly] || params[:force]
80
+ return false unless params[:force_for_new_certificates]
81
+
82
+ unless params[:include_all_certificates]
83
+ UI.important("You specified 'force_for_new_certificates: true', but new certificates will not be added, cause 'include_all_certificates' is 'false'") if notify
84
+ return false
85
+ end
86
+
87
+ provisioning_type = params[:type].to_sym
88
+
89
+ can_force = PROV_TYPES_WITH_MULTIPLE_CERTIFICATES.include?(provisioning_type)
90
+
91
+ if !can_force && notify
92
+ # All other (not development) provisioning profiles don't contain
93
+ # multiple certificates, thus shouldn't be renewed
94
+ # if the certificates count has changed.
95
+ UI.important("Warning: `force_for_new_certificates` is set but is ignored for non-'development' provisioning profiles.")
96
+ UI.important("You can safely stop specifying `force_for_new_certificates` when running Match for '#{provisioning_type}' provisioning profiles.")
97
+ end
98
+
99
+ can_force
100
+ end
101
+
102
+ def self.certificates_differ?(portal_profile:, platform:, cached_certificates:)
103
+ return false unless portal_profile
104
+
105
+ profile_certs = portal_profile.certificates || []
106
+
107
+ portal_certs = cached_certificates
108
+ portal_certs ||= Match::Portal::Fetcher.certificates(platform: platform, profile_type: portal_profile.profile_type)
109
+
110
+ profile_certs_ids = profile_certs.map(&:id).sort
111
+ portal_certs_ids = portal_certs.map(&:id).sort
112
+
113
+ certificates_differ = profile_certs_ids != portal_certs_ids
114
+
115
+ UI.important("Certificates in the profile and available on the portal differ. Recreating a profile") if certificates_differ
116
+
117
+ return certificates_differ
118
+ end
119
+ end
120
+ end