fastlane 2.174.0 → 2.179.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +93 -80
  4. data/cert/lib/cert/options.rb +3 -2
  5. data/cert/lib/cert/runner.rb +5 -1
  6. data/deliver/lib/deliver/app_screenshot.rb +6 -2
  7. data/deliver/lib/deliver/download_screenshots.rb +1 -2
  8. data/deliver/lib/deliver/options.rb +3 -2
  9. data/deliver/lib/deliver/runner.rb +12 -4
  10. data/deliver/lib/deliver/setup.rb +0 -1
  11. data/deliver/lib/deliver/upload_metadata.rb +5 -4
  12. data/deliver/lib/deliver/upload_screenshots.rb +12 -11
  13. data/fastlane/lib/fastlane/actions/adb.rb +1 -1
  14. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +8 -3
  15. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +7 -4
  16. data/fastlane/lib/fastlane/actions/appaloosa.rb +7 -2
  17. data/fastlane/lib/fastlane/actions/backup_file.rb +1 -1
  18. data/fastlane/lib/fastlane/actions/build_app.rb +4 -0
  19. data/fastlane/lib/fastlane/actions/check_app_store_metadata.rb +4 -0
  20. data/fastlane/lib/fastlane/actions/commit_github_file.rb +11 -1
  21. data/fastlane/lib/fastlane/actions/create_xcframework.rb +5 -0
  22. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +1 -1
  23. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +1 -1
  24. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +8 -2
  25. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -1
  26. data/fastlane/lib/fastlane/actions/download_dsyms.rb +5 -15
  27. data/fastlane/lib/fastlane/actions/get_github_release.rb +11 -1
  28. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +4 -0
  29. data/fastlane/lib/fastlane/actions/get_version_number.rb +17 -10
  30. data/fastlane/lib/fastlane/actions/git_branch.rb +4 -10
  31. data/fastlane/lib/fastlane/actions/git_commit.rb +1 -1
  32. data/fastlane/lib/fastlane/actions/git_tag_exists.rb +4 -0
  33. data/fastlane/lib/fastlane/actions/github_api.rb +2 -1
  34. data/fastlane/lib/fastlane/actions/increment_build_number.rb +8 -1
  35. data/fastlane/lib/fastlane/actions/install_provisioning_profile.rb +4 -0
  36. data/fastlane/lib/fastlane/actions/jazzy.rb +10 -1
  37. data/fastlane/lib/fastlane/actions/latest_testflight_build_number.rb +3 -2
  38. data/fastlane/lib/fastlane/actions/match_nuke.rb +59 -0
  39. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +0 -1
  40. data/fastlane/lib/fastlane/actions/register_device.rb +3 -3
  41. data/fastlane/lib/fastlane/actions/register_devices.rb +3 -3
  42. data/fastlane/lib/fastlane/actions/restore_file.rb +1 -1
  43. data/fastlane/lib/fastlane/actions/set_changelog.rb +3 -3
  44. data/fastlane/lib/fastlane/actions/spaceship_logs.rb +1 -1
  45. data/fastlane/lib/fastlane/actions/swiftlint.rb +1 -1
  46. data/fastlane/lib/fastlane/actions/update_code_signing_settings.rb +1 -1
  47. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +1 -2
  48. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +4 -5
  49. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +5 -1
  50. data/fastlane/lib/fastlane/documentation/actions_list.rb +2 -2
  51. data/fastlane/lib/fastlane/erb_template_helper.rb +7 -1
  52. data/fastlane/lib/fastlane/fast_file.rb +9 -5
  53. data/fastlane/lib/fastlane/helper/adb_helper.rb +1 -1
  54. data/fastlane/lib/fastlane/helper/gem_helper.rb +2 -2
  55. data/fastlane/lib/fastlane/helper/git_helper.rb +11 -7
  56. data/fastlane/lib/fastlane/plugins/plugin_fetcher.rb +1 -2
  57. data/fastlane/lib/fastlane/plugins/plugin_info_collector.rb +1 -2
  58. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +1 -2
  59. data/fastlane/lib/fastlane/swift_fastlane_function.rb +4 -0
  60. data/fastlane/lib/fastlane/version.rb +1 -1
  61. data/fastlane/swift/Deliverfile.swift +1 -1
  62. data/fastlane/swift/DeliverfileProtocol.swift +3 -3
  63. data/fastlane/swift/Fastlane.swift +491 -315
  64. data/fastlane/swift/Gymfile.swift +1 -1
  65. data/fastlane/swift/GymfileProtocol.swift +1 -1
  66. data/fastlane/swift/Matchfile.swift +1 -1
  67. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  68. data/fastlane/swift/Precheckfile.swift +1 -1
  69. data/fastlane/swift/PrecheckfileProtocol.swift +3 -3
  70. data/fastlane/swift/Scanfile.swift +1 -1
  71. data/fastlane/swift/ScanfileProtocol.swift +9 -1
  72. data/fastlane/swift/Screengrabfile.swift +1 -1
  73. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  74. data/fastlane/swift/Snapshotfile.swift +1 -1
  75. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  76. data/fastlane/swift/formatting/Brewfile.lock.json +13 -11
  77. data/fastlane_core/lib/fastlane_core.rb +1 -0
  78. data/fastlane_core/lib/fastlane_core/command_executor.rb +3 -9
  79. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +1 -1
  80. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +23 -0
  81. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +6 -6
  82. data/fastlane_core/lib/fastlane_core/helper.rb +50 -6
  83. data/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb +3 -2
  84. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +14 -8
  85. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -1
  86. data/fastlane_core/lib/fastlane_core/pkg_upload_package_builder.rb +3 -2
  87. data/fastlane_core/lib/fastlane_core/project.rb +3 -14
  88. data/{deliver/lib/deliver → fastlane_core/lib/fastlane_core}/queue_worker.rb +2 -2
  89. data/fastlane_core/lib/fastlane_core/ui/interface.rb +1 -1
  90. data/fastlane_core/lib/fastlane_core/update_checker/update_checker.rb +2 -2
  91. data/gym/lib/gym/.runner.rb.swp +0 -0
  92. data/gym/lib/gym/generators/.package_command_generator_xcode7.rb.swp +0 -0
  93. data/gym/lib/gym/generators/package_command_generator.rb +4 -0
  94. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +13 -8
  95. data/gym/lib/gym/runner.rb +11 -4
  96. data/match/lib/match/change_password.rb +3 -3
  97. data/match/lib/match/encryption/interface.rb +1 -1
  98. data/match/lib/match/encryption/openssl.rb +2 -2
  99. data/match/lib/match/importer.rb +1 -1
  100. data/match/lib/match/migrate.rb +1 -1
  101. data/match/lib/match/module.rb +1 -0
  102. data/match/lib/match/nuke.rb +6 -1
  103. data/match/lib/match/options.rb +2 -2
  104. data/match/lib/match/runner.rb +1 -1
  105. data/match/lib/match/storage/google_cloud_storage.rb +1 -1
  106. data/match/lib/match/storage/s3_storage.rb +1 -1
  107. data/pilot/lib/pilot/build_manager.rb +25 -8
  108. data/pilot/lib/pilot/manager.rb +5 -1
  109. data/pilot/lib/pilot/options.rb +6 -5
  110. data/precheck/lib/precheck/options.rb +3 -2
  111. data/precheck/lib/precheck/runner.rb +6 -2
  112. data/scan/lib/scan/detect_values.rb +4 -1
  113. data/scan/lib/scan/options.rb +10 -0
  114. data/scan/lib/scan/runner.rb +27 -0
  115. data/screengrab/lib/screengrab/android_environment.rb +8 -6
  116. data/screengrab/lib/screengrab/runner.rb +2 -3
  117. data/sigh/lib/sigh/download_all.rb +1 -1
  118. data/sigh/lib/sigh/options.rb +3 -2
  119. data/sigh/lib/sigh/runner.rb +5 -1
  120. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +2 -1
  121. data/spaceship/README.md +2 -2
  122. data/spaceship/lib/spaceship/client.rb +18 -17
  123. data/spaceship/lib/spaceship/connect_api/api_client.rb +24 -6
  124. data/spaceship/lib/spaceship/connect_api/models/app.rb +1 -1
  125. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +5 -0
  126. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +5 -0
  127. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +6 -0
  128. data/spaceship/lib/spaceship/connect_api/models/beta_group.rb +5 -0
  129. data/spaceship/lib/spaceship/connect_api/models/build.rb +5 -0
  130. data/spaceship/lib/spaceship/connect_api/models/build_beta_detail.rb +4 -0
  131. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +13 -0
  132. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  133. data/spaceship/lib/spaceship/connect_api/token.rb +2 -2
  134. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +15 -0
  135. data/spaceship/lib/spaceship/playground.rb +2 -2
  136. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  137. data/spaceship/lib/spaceship/two_step_or_factor_client.rb +41 -28
  138. metadata +41 -22
@@ -17,4 +17,4 @@ public class Gymfile: GymfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.174.0
20
+ // Generated with fastlane 2.179.0
@@ -196,4 +196,4 @@ public extension GymfileProtocol {
196
196
 
197
197
  // Please don't remove the lines below
198
198
  // They are used to detect outdated files
199
- // FastlaneRunnerAPIVersion [0.9.60]
199
+ // FastlaneRunnerAPIVersion [0.9.65]
@@ -17,4 +17,4 @@ public class Matchfile: MatchfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.174.0
20
+ // Generated with fastlane 2.179.0
@@ -184,4 +184,4 @@ public extension MatchfileProtocol {
184
184
 
185
185
  // Please don't remove the lines below
186
186
  // They are used to detect outdated files
187
- // FastlaneRunnerAPIVersion [0.9.54]
187
+ // FastlaneRunnerAPIVersion [0.9.59]
@@ -17,4 +17,4 @@ public class Precheckfile: PrecheckfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.174.0
20
+ // Generated with fastlane 2.179.0
@@ -12,7 +12,7 @@ public protocol PrecheckfileProtocol: class {
12
12
  var appIdentifier: String { get }
13
13
 
14
14
  /// Your Apple ID Username
15
- var username: String { get }
15
+ var username: String? { get }
16
16
 
17
17
  /// The ID of your App Store Connect team if you're in multiple teams
18
18
  var teamId: String? { get }
@@ -40,7 +40,7 @@ public extension PrecheckfileProtocol {
40
40
  var apiKeyPath: String? { return nil }
41
41
  var apiKey: [String: Any]? { return nil }
42
42
  var appIdentifier: String { return "" }
43
- var username: String { return "" }
43
+ var username: String? { return nil }
44
44
  var teamId: String? { return nil }
45
45
  var teamName: String? { return nil }
46
46
  var platform: String { return "ios" }
@@ -52,4 +52,4 @@ public extension PrecheckfileProtocol {
52
52
 
53
53
  // Please don't remove the lines below
54
54
  // They are used to detect outdated files
55
- // FastlaneRunnerAPIVersion [0.9.53]
55
+ // FastlaneRunnerAPIVersion [0.9.58]
@@ -17,4 +17,4 @@ public class Scanfile: ScanfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.174.0
20
+ // Generated with fastlane 2.179.0
@@ -20,6 +20,9 @@ public protocol ScanfileProtocol: class {
20
20
  /// Should skip auto detecting of devices if none were specified
21
21
  var skipDetectDevices: Bool { get }
22
22
 
23
+ /// Should fail if devices not found
24
+ var ensureDevicesFound: Bool { get }
25
+
23
26
  /// Enabling this option will automatically killall Simulator processes before the run
24
27
  var forceQuitSimulator: Bool { get }
25
28
 
@@ -110,6 +113,9 @@ public protocol ScanfileProtocol: class {
110
113
  /// Should zip the derived data build products and place in output path?
111
114
  var shouldZipBuildProducts: Bool { get }
112
115
 
116
+ /// Should provide additional copy of .xctestrun file (settings.xctestrun) and place in output path?
117
+ var outputXctestrun: Bool { get }
118
+
113
119
  /// Should an Xcode result bundle be generated in the output directory
114
120
  var resultBundle: Bool { get }
115
121
 
@@ -214,6 +220,7 @@ public extension ScanfileProtocol {
214
220
  var device: String? { return nil }
215
221
  var devices: [String]? { return nil }
216
222
  var skipDetectDevices: Bool { return false }
223
+ var ensureDevicesFound: Bool { return false }
217
224
  var forceQuitSimulator: Bool { return false }
218
225
  var resetSimulator: Bool { return false }
219
226
  var disableSlideToType: Bool { return true }
@@ -244,6 +251,7 @@ public extension ScanfileProtocol {
244
251
  var xcprettyArgs: String? { return nil }
245
252
  var derivedDataPath: String? { return nil }
246
253
  var shouldZipBuildProducts: Bool { return false }
254
+ var outputXctestrun: Bool { return false }
247
255
  var resultBundle: Bool { return false }
248
256
  var useClangReportName: Bool { return false }
249
257
  var concurrentWorkers: Int? { return nil }
@@ -280,4 +288,4 @@ public extension ScanfileProtocol {
280
288
 
281
289
  // Please don't remove the lines below
282
290
  // They are used to detect outdated files
283
- // FastlaneRunnerAPIVersion [0.9.65]
291
+ // FastlaneRunnerAPIVersion [0.9.70]
@@ -17,4 +17,4 @@ public class Screengrabfile: ScreengrabfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.174.0
20
+ // Generated with fastlane 2.179.0
@@ -96,4 +96,4 @@ public extension ScreengrabfileProtocol {
96
96
 
97
97
  // Please don't remove the lines below
98
98
  // They are used to detect outdated files
99
- // FastlaneRunnerAPIVersion [0.9.55]
99
+ // FastlaneRunnerAPIVersion [0.9.60]
@@ -17,4 +17,4 @@ public class Snapshotfile: SnapshotfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.174.0
20
+ // Generated with fastlane 2.179.0
@@ -196,4 +196,4 @@ public extension SnapshotfileProtocol {
196
196
 
197
197
  // Please don't remove the lines below
198
198
  // They are used to detect outdated files
199
- // FastlaneRunnerAPIVersion [0.9.49]
199
+ // FastlaneRunnerAPIVersion [0.9.54]
@@ -2,26 +2,28 @@
2
2
  "entries": {
3
3
  "brew": {
4
4
  "swiftformat": {
5
- "version": "0.47.11",
5
+ "version": "0.47.13",
6
6
  "bottle": {
7
+ "rebuild": 0,
7
8
  "cellar": ":any_skip_relocation",
8
9
  "prefix": "/usr/local",
10
+ "root_url": "https://homebrew.bintray.com/bottles",
9
11
  "files": {
10
12
  "arm64_big_sur": {
11
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.11.arm64_big_sur.bottle.tar.gz",
12
- "sha256": "65a20f75d4a9e2837dfc60318e312893b99f2a957a7f3a9a137b326c87dc29ff"
13
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.13.arm64_big_sur.bottle.tar.gz",
14
+ "sha256": "fdcdb5e94b9c4d66a32d4515ba3d2db4057865f96aefab0e41fdeaf2879f4f89"
13
15
  },
14
16
  "big_sur": {
15
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.11.big_sur.bottle.tar.gz",
16
- "sha256": "0b4c55f9316fbf40c9eab826536df17eb0249484772c372a962a189e0d1a7fd2"
17
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.13.big_sur.bottle.tar.gz",
18
+ "sha256": "cbb7a9803926d8bfaacf5c1a7d4cd07d8fe2255b1885be3ae2ffd8414e4c5292"
17
19
  },
18
20
  "catalina": {
19
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.11.catalina.bottle.tar.gz",
20
- "sha256": "3b7bc3e4e6f150ecdd298be109d13ef9e84a56a45c580113c7a6b151fe1615da"
21
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.13.catalina.bottle.tar.gz",
22
+ "sha256": "3a13e9b1f4a63bc03601897944f71dd4e6942788531dc060322d20fc6b36d2fd"
21
23
  },
22
24
  "mojave": {
23
- "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.11.mojave.bottle.tar.gz",
24
- "sha256": "24bdfac40c16c1e40bbe970eedb9450cd3099890188b8d6bdd0fe2447d54ce48"
25
+ "url": "https://homebrew.bintray.com/bottles/swiftformat-0.47.13.mojave.bottle.tar.gz",
26
+ "sha256": "4e0691f12a5ef3b01eba9f41091b8f3457bc65151bfad057a45e8de9525074cd"
25
27
  }
26
28
  }
27
29
  }
@@ -31,9 +33,9 @@
31
33
  "system": {
32
34
  "macos": {
33
35
  "catalina": {
34
- "HOMEBREW_VERSION": "3.0.0-57-g59dd425",
36
+ "HOMEBREW_VERSION": "3.0.9-4-g9308a25",
35
37
  "HOMEBREW_PREFIX": "/usr/local",
36
- "Homebrew/homebrew-core": "637196b33ecd885dc057c16fc5cb652a4561f632",
38
+ "Homebrew/homebrew-core": "2e6c683b1705308ab02e71f996733b1ad05942d0",
37
39
  "CLT": "11.0.33.12",
38
40
  "Xcode": "12.2",
39
41
  "macOS": "10.15.7"
@@ -35,6 +35,7 @@ require_relative 'fastlane_core/analytics/analytics_ingester_client'
35
35
  require_relative 'fastlane_core/analytics/analytics_session'
36
36
  require_relative 'fastlane_core/tag_version'
37
37
  require_relative 'fastlane_core/fastlane_pty'
38
+ require_relative 'fastlane_core/queue_worker'
38
39
 
39
40
  # Third Party code
40
41
  require 'colored'
@@ -13,16 +13,10 @@ module FastlaneCore
13
13
  #
14
14
  # Derived from https://stackoverflow.com/a/5471032/3005
15
15
  def which(cmd)
16
- # PATHEXT contains the list of file extensions that Windows considers executable, semicolon separated.
17
- # e.g. ".COM;.EXE;.BAT;.CMD"
18
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : []
19
- exts << '' # Always have an empty string (= no file extension)
20
-
21
16
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
22
- exts.each do |ext|
23
- cmd_path = File.join(path, "#{cmd}#{ext}")
24
- return cmd_path if Helper.executable?(cmd_path)
25
- end
17
+ cmd_path = File.join(path, cmd)
18
+ executable_path = Helper.get_executable_path(cmd_path)
19
+ return executable_path if Helper.executable?(executable_path)
26
20
  end
27
21
 
28
22
  return nil
@@ -67,7 +67,7 @@ module FastlaneCore
67
67
  long_switch = "--#{option.key} #{value_appendix}"
68
68
 
69
69
  description = option.description
70
- description += " (#{option.env_name})" unless option.env_name.to_s.empty?
70
+ description += " (#{option.env_names.join(', ')})" unless option.env_names.empty?
71
71
 
72
72
  # We compact this array here to remove the short_switch variable if it is nil.
73
73
  # Passing a nil value to global_option has been shown to create problems with
@@ -12,6 +12,9 @@ module FastlaneCore
12
12
  # [String] the name of the environment variable, which is only used if no other values were found
13
13
  attr_accessor :env_name
14
14
 
15
+ # [Array] the names of the environment variables, which is only used if no other values were found
16
+ attr_accessor :env_names
17
+
15
18
  # [String] A description shown to the user
16
19
  attr_accessor :description
17
20
 
@@ -71,6 +74,7 @@ module FastlaneCore
71
74
  # Creates a new option
72
75
  # @param key (Symbol) the key which is used as command parameters or key in the fastlane tools
73
76
  # @param env_name (String) the name of the environment variable, which is only used if no other values were found
77
+ # @param env_names (Array) the names of the environment variables, which is only used if no other values were found
74
78
  # @param description (String) A description shown to the user
75
79
  # @param short_option (String) A string of length 1 which is used for the command parameters (e.g. -f)
76
80
  # @param default_value the value which is used if there was no given values and no environment values
@@ -88,8 +92,10 @@ module FastlaneCore
88
92
  # @param sensitive (Boolean) Set if the variable is sensitive, such as a password or API token, to prevent echoing when prompted for the parameter
89
93
  # @param display_in_shell (Boolean) Set if the variable can be used from shell
90
94
  # rubocop:disable Metrics/ParameterLists
95
+ # rubocop:disable Metrics/PerceivedComplexity
91
96
  def initialize(key: nil,
92
97
  env_name: nil,
98
+ env_names: nil,
93
99
  description: nil,
94
100
  short_option: nil,
95
101
  default_value: nil,
@@ -109,6 +115,11 @@ module FastlaneCore
109
115
  UI.user_error!("key must be a symbol") unless key.kind_of?(Symbol)
110
116
  UI.user_error!("env_name must be a String") unless (env_name || '').kind_of?(String)
111
117
 
118
+ UI.user_error!("env_names must be an Array") unless (env_names || []).kind_of?(Array)
119
+ (env_names || []).each do |name|
120
+ UI.user_error!("env_names must only contain String") unless (name || '').kind_of?(String)
121
+ end
122
+
112
123
  if short_option
113
124
  UI.user_error!("short_option for key :#{key} must of type String") unless short_option.kind_of?(String)
114
125
  UI.user_error!("short_option for key :#{key} must be a string of length 1") unless short_option.delete('-').length == 1
@@ -138,6 +149,7 @@ module FastlaneCore
138
149
 
139
150
  @key = key
140
151
  @env_name = env_name
152
+ @env_names = [env_name].compact + (env_names || [])
141
153
  @description = description
142
154
  @short_option = short_option
143
155
  @default_value = default_value
@@ -160,6 +172,7 @@ module FastlaneCore
160
172
 
161
173
  update_code_gen_default_value_if_able!
162
174
  end
175
+ # rubocop:enable Metrics/PerceivedComplexity
163
176
  # rubocop:enable Metrics/ParameterLists
164
177
 
165
178
  # if code_gen_default_value is nil, use the default value if it isn't a `code_gen_sensitive` value
@@ -228,6 +241,16 @@ module FastlaneCore
228
241
  true
229
242
  end
230
243
 
244
+ def fetch_env_value
245
+ env_names.each do |name|
246
+ next if ENV[name].nil?
247
+ # verify! before using (see https://github.com/fastlane/fastlane/issues/14449)
248
+ return ENV[name].dup if verify!(auto_convert_value(ENV[name]))
249
+ end
250
+
251
+ return nil
252
+ end
253
+
231
254
  # rubocop:disable Metrics/PerceivedComplexity
232
255
  # Returns an updated value type (if necessary)
233
256
  def auto_convert_value(value)
@@ -208,9 +208,10 @@ module FastlaneCore
208
208
  #####################################################
209
209
 
210
210
  # Returns the value for a certain key. fastlane_core tries to fetch the value from different sources
211
- # if 'ask' is true and the value is not present, the user will be prompted to provide a value
211
+ # if 'ask' is true and the value is not present, the user will be prompted to provide a value if optional
212
+ # if 'force_ask' is true, the option is not required to be optional to ask
212
213
  # rubocop:disable Metrics/PerceivedComplexity
213
- def fetch(key, ask: true)
214
+ def fetch(key, ask: true, force_ask: false)
214
215
  UI.crash!("Key '#{key}' must be a symbol. Example :app_id.") unless key.kind_of?(Symbol)
215
216
 
216
217
  option = verify_options_key!(key)
@@ -218,9 +219,8 @@ module FastlaneCore
218
219
  # Same order as https://docs.fastlane.tools/advanced/#priorities-of-parameters-and-options
219
220
  value = if @values.key?(key) && !@values[key].nil?
220
221
  @values[key]
221
- elsif option.env_name && !ENV[option.env_name].nil?
222
- # verify! before using (see https://github.com/fastlane/fastlane/issues/14449)
223
- ENV[option.env_name].dup if option.verify!(option.auto_convert_value(ENV[option.env_name]))
222
+ elsif (env_value = option.fetch_env_value)
223
+ env_value
224
224
  elsif self.config_file_options.key?(key)
225
225
  self.config_file_options[key]
226
226
  else
@@ -229,7 +229,7 @@ module FastlaneCore
229
229
 
230
230
  value = option.auto_convert_value(value)
231
231
  value = nil if value.nil? && !option.string? # by default boolean flags are false
232
- return value unless value.nil? && !option.optional && ask
232
+ return value unless value.nil? && (!option.optional || force_ask) && ask
233
233
 
234
234
  # fallback to asking
235
235
  if Helper.test? || !UI.interactive?
@@ -75,7 +75,7 @@ module FastlaneCore
75
75
 
76
76
  # Check for Jenkins, Travis CI, ... environment variables
77
77
  ['JENKINS_HOME', 'JENKINS_URL', 'TRAVIS', 'CI', 'APPCENTER_BUILD_ID', 'TEAMCITY_VERSION', 'GO_PIPELINE_NAME', 'bamboo_buildKey', 'GITLAB_CI', 'XCS', 'TF_BUILD', 'GITHUB_ACTION', 'GITHUB_ACTIONS', 'BITRISE_IO', 'BUDDY'].each do |current|
78
- return true if ENV.key?(current)
78
+ return true if FastlaneCore::Env.truthy?(current)
79
79
  end
80
80
  return false
81
81
  end
@@ -368,8 +368,37 @@ module FastlaneCore
368
368
 
369
369
  # checks if a given path is an executable file
370
370
  def self.executable?(cmd_path)
371
- # no executable files on Windows, so existing is enough there
372
- cmd_path && !File.directory?(cmd_path) && (File.executable?(cmd_path) || (self.windows? && File.exist?(cmd_path)))
371
+ if !cmd_path || File.directory?(cmd_path)
372
+ return false
373
+ end
374
+
375
+ return File.exist?(get_executable_path(cmd_path))
376
+ end
377
+
378
+ # returns the path of the executable with the correct extension on Windows
379
+ def self.get_executable_path(cmd_path)
380
+ cmd_path = localize_file_path(cmd_path)
381
+
382
+ if self.windows?
383
+ # PATHEXT contains the list of file extensions that Windows considers executable, semicolon separated.
384
+ # e.g. ".COM;.EXE;.BAT;.CMD"
385
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : []
386
+
387
+ # no executable files on Windows, so existing is enough there
388
+ # also check if command + ext is present
389
+ exts.each do |ext|
390
+ executable_path = "#{cmd_path}#{ext.downcase}"
391
+ return executable_path if File.exist?(executable_path)
392
+ end
393
+ end
394
+
395
+ return cmd_path
396
+ end
397
+
398
+ # returns the path with the platform-specific path separator (`/` on UNIX, `\` on Windows)
399
+ def self.localize_file_path(path)
400
+ # change `/` to `\` on Windows
401
+ return self.windows? ? path.gsub('/', '\\') : path
373
402
  end
374
403
 
375
404
  # checks if given file is a valid json file
@@ -425,20 +454,35 @@ module FastlaneCore
425
454
  UI.current.log
426
455
  end
427
456
 
428
- def self.ask_password(message: "Passphrase: ", confirm: nil)
457
+ def self.ask_password(message: "Passphrase: ", confirm: nil, confirmation_message: "Type passphrase again: ")
429
458
  raise "This code should only run in interactive mode" unless UI.interactive?
430
459
 
431
460
  loop do
432
461
  password = UI.password(message)
433
462
  if confirm
434
- password2 = UI.password("Type passphrase again: ")
463
+ password2 = UI.password(confirmation_message)
435
464
  if password == password2
436
465
  return password
437
466
  end
438
467
  else
439
468
  return password
440
469
  end
441
- UI.error("Passphrases differ. Try again")
470
+ UI.error("Your entries do not match. Please try again")
471
+ end
472
+ end
473
+
474
+ # URI.open added by `require 'open-uri'` is not available in Ruby 2.4. This helper lets you open a URI
475
+ # by choosing appropriate interface to do so depending on Ruby version. This helper is subject to be removed
476
+ # when fastlane drops Ruby 2.4 support.
477
+ def self.open_uri(*rest, &block)
478
+ require 'open-uri'
479
+
480
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.5')
481
+ dup = rest.dup
482
+ uri = dup.shift
483
+ URI.parse(uri).open(*dup, &block)
484
+ else
485
+ URI.open(*rest, &block)
442
486
  end
443
487
  end
444
488
  end
@@ -1,4 +1,5 @@
1
1
  require "digest/md5"
2
+ require 'securerandom'
2
3
 
3
4
  require_relative 'globals'
4
5
  require_relative 'ui/ui'
@@ -12,7 +13,7 @@ module FastlaneCore
12
13
  attr_accessor :package_path
13
14
 
14
15
  def generate(app_id: nil, ipa_path: nil, package_path: nil, platform: nil)
15
- self.package_path = File.join(package_path, "#{app_id}.itmsp")
16
+ self.package_path = File.join(package_path, "#{app_id}-#{SecureRandom.uuid}.itmsp")
16
17
  FileUtils.rm_rf(self.package_path) if File.directory?(self.package_path)
17
18
  FileUtils.mkdir_p(self.package_path)
18
19
 
@@ -32,7 +33,7 @@ module FastlaneCore
32
33
  File.write(File.join(self.package_path, METADATA_FILE_NAME), xml)
33
34
  UI.success("Wrote XML data to '#{self.package_path}'") if FastlaneCore::Globals.verbose?
34
35
 
35
- return package_path
36
+ return self.package_path
36
37
  end
37
38
 
38
39
  def unique_ipa_path(ipa_path)
@@ -94,6 +94,10 @@ module FastlaneCore
94
94
  return exit_status.zero?
95
95
  end
96
96
 
97
+ def displayable_errors
98
+ @errors.map { |error| "[Transporter Error Output]: #{error}" }.join("\n").gsub!(/"/, "")
99
+ end
100
+
97
101
  private
98
102
 
99
103
  def parse_line(line, hide_output)
@@ -107,7 +111,6 @@ module FastlaneCore
107
111
 
108
112
  elsif line =~ ERROR_REGEX
109
113
  @errors << $1
110
- UI.error("[Transporter Error Output]: #{$1}")
111
114
 
112
115
  # Check if it's a login error
113
116
  if $1.include?("Your Apple ID or password was entered incorrectly") ||
@@ -117,9 +120,6 @@ module FastlaneCore
117
120
  CredentialsManager::AccountManager.new(user: @user).invalid_credentials
118
121
  UI.error("Please run this tool again to apply the new password")
119
122
  end
120
- elsif $1.include?("Redundant Binary Upload. There already exists a binary upload with build")
121
- UI.error($1)
122
- UI.error("You have to change the build number of your app to upload your ipa file")
123
123
  end
124
124
 
125
125
  output_done = true
@@ -471,11 +471,13 @@ module FastlaneCore
471
471
  # Uploads the modified package back to App Store Connect
472
472
  # @param app_id [Integer] The unique App ID
473
473
  # @param dir [String] the path in which the package file is located
474
+ # @param package_path [String] the path to the package file (used instead of app_id and dir)
474
475
  # @return (Bool) True if everything worked fine
475
476
  # @raise [Deliver::TransporterTransferError] when something went wrong
476
477
  # when transferring
477
- def upload(app_id, dir)
478
- actual_dir = File.join(dir, "#{app_id}.itmsp")
478
+ def upload(app_id = nil, dir = nil, package_path: nil)
479
+ raise "app_id and dir are required or package_path is required" if (app_id.nil? || dir.nil?) && package_path.nil?
480
+ actual_dir = package_path || File.join(dir, "#{app_id}.itmsp")
479
481
 
480
482
  UI.message("Going to upload updated app to App Store Connect")
481
483
  UI.success("This might take a few minutes. Please don't interrupt the script.")
@@ -490,7 +492,7 @@ module FastlaneCore
490
492
  result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
491
493
  rescue TransporterRequiresApplicationSpecificPasswordError => ex
492
494
  handle_two_step_failure(ex)
493
- return upload(app_id, dir)
495
+ return upload(app_id, dir, package_path: package_path)
494
496
  end
495
497
 
496
498
  if result
@@ -501,7 +503,11 @@ module FastlaneCore
501
503
  handle_error(@password)
502
504
  end
503
505
 
504
- result
506
+ return result
507
+ end
508
+
509
+ def displayable_errors
510
+ @transporter_executor.displayable_errors
505
511
  end
506
512
 
507
513
  def provider_ids