fastlane 2.241.2 → 2.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -38
  3. data/cert/lib/cert/runner.rb +1 -1
  4. data/credentials_manager/README.md +3 -3
  5. data/credentials_manager/lib/credentials_manager/account_manager.rb +13 -3
  6. data/deliver/lib/deliver/runner.rb +5 -0
  7. data/fastlane/lib/assets/certificates/AppleIncRootCertificate.cer +0 -0
  8. data/fastlane/lib/assets/certificates/AppleRootCA-G3.cer +0 -0
  9. data/fastlane/lib/fastlane/action.rb +8 -6
  10. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -1
  11. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +0 -3
  12. data/fastlane/lib/fastlane/actions/clipboard.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +0 -1
  14. data/fastlane/lib/fastlane/actions/create_keychain.rb +20 -29
  15. data/fastlane/lib/fastlane/actions/delete_keychain.rb +5 -3
  16. data/fastlane/lib/fastlane/actions/docs/build_app.md +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +4 -4
  19. data/fastlane/lib/fastlane/actions/docs/get_provisioning_profile.md +1 -1
  20. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +1 -1
  21. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +12 -0
  22. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +5 -4
  23. data/fastlane/lib/fastlane/actions/download_dsyms.rb +3 -1
  24. data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +1 -0
  25. data/fastlane/lib/fastlane/actions/git_pull.rb +1 -1
  26. data/fastlane/lib/fastlane/actions/hg_commit_version_bump.rb +0 -1
  27. data/fastlane/lib/fastlane/actions/import_certificate.rb +18 -6
  28. data/fastlane/lib/fastlane/actions/import_from_gem.rb +70 -0
  29. data/fastlane/lib/fastlane/actions/jazzy.rb +1 -1
  30. data/fastlane/lib/fastlane/actions/lcov.rb +1 -1
  31. data/fastlane/lib/fastlane/actions/mailgun.rb +2 -2
  32. data/fastlane/lib/fastlane/actions/make_changelog_from_jenkins.rb +1 -1
  33. data/fastlane/lib/fastlane/actions/notarize.rb +55 -7
  34. data/fastlane/lib/fastlane/actions/prompt.rb +1 -1
  35. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +2 -2
  36. data/fastlane/lib/fastlane/actions/sh.rb +20 -2
  37. data/fastlane/lib/fastlane/actions/sourcedocs.rb +2 -2
  38. data/fastlane/lib/fastlane/actions/swiftlint.rb +5 -2
  39. data/fastlane/lib/fastlane/actions/unlock_keychain.rb +17 -29
  40. data/fastlane/lib/fastlane/actions/update_fastlane.rb +10 -3
  41. data/fastlane/lib/fastlane/actions/update_project_code_signing.rb +2 -1
  42. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +21 -18
  43. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +1 -1
  44. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +8 -2
  45. data/fastlane/lib/fastlane/actions/verify_build.rb +2 -1
  46. data/fastlane/lib/fastlane/actions/verify_pod_keys.rb +2 -1
  47. data/fastlane/lib/fastlane/actions/xcodebuild.rb +1 -1
  48. data/fastlane/lib/fastlane/cli_tools_distributor.rb +7 -0
  49. data/fastlane/lib/fastlane/environment_printer.rb +14 -14
  50. data/fastlane/lib/fastlane/fast_file.rb +35 -4
  51. data/fastlane/lib/fastlane/helper/sh_helper.rb +27 -45
  52. data/fastlane/lib/fastlane/lane_list.rb +1 -1
  53. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +2 -2
  54. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +0 -2
  55. data/fastlane/lib/fastlane/runner.rb +4 -6
  56. data/fastlane/lib/fastlane/server/socket_server_action_command_executor.rb +4 -4
  57. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -3
  58. data/fastlane/lib/fastlane/version.rb +2 -1
  59. data/fastlane/swift/Deliverfile.swift +1 -1
  60. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  61. data/fastlane/swift/Fastlane.swift +46 -152
  62. data/fastlane/swift/Gymfile.swift +1 -1
  63. data/fastlane/swift/GymfileProtocol.swift +1 -1
  64. data/fastlane/swift/Matchfile.swift +1 -1
  65. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  66. data/fastlane/swift/Precheckfile.swift +1 -1
  67. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  68. data/fastlane/swift/Runner.swift +1 -1
  69. data/fastlane/swift/Scanfile.swift +1 -1
  70. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  71. data/fastlane/swift/Screengrabfile.swift +1 -1
  72. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  73. data/fastlane/swift/Snapshotfile.swift +1 -1
  74. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  75. data/fastlane_core/lib/fastlane_core/cert_checker.rb +40 -76
  76. data/fastlane_core/lib/fastlane_core/command_executor.rb +128 -7
  77. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -1
  78. data/fastlane_core/lib/fastlane_core/configuration/configuration_file.rb +1 -1
  79. data/fastlane_core/lib/fastlane_core/device_manager.rb +14 -5
  80. data/fastlane_core/lib/fastlane_core/fastlane_pty.rb +25 -10
  81. data/fastlane_core/lib/fastlane_core/helper.rb +26 -2
  82. data/fastlane_core/lib/fastlane_core/ios_app_identifier_guesser.rb +1 -1
  83. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +24 -19
  84. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +48 -71
  85. data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +5 -1
  86. data/fastlane_core/lib/fastlane_core/print_table.rb +1 -1
  87. data/fastlane_core/lib/fastlane_core/queue_worker.rb +0 -2
  88. data/fastlane_core/lib/fastlane_core/stored_passwords.rb +29 -0
  89. data/fastlane_core/lib/fastlane_core/string_filters.rb +1 -2
  90. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +8 -4
  91. data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +2 -2
  92. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +1 -1
  93. data/frameit/lib/frameit/device_types.rb +11 -4
  94. data/frameit/lib/frameit/editor.rb +31 -12
  95. data/frameit/lib/frameit/frame_downloader.rb +4 -1
  96. data/gym/lib/gym/detect_values.rb +10 -10
  97. data/gym/lib/gym/options.rb +1 -7
  98. data/gym/lib/gym/runner.rb +6 -1
  99. data/match/lib/match/encryption/encryption.rb +6 -1
  100. data/match/lib/match/encryption/openssl.rb +8 -3
  101. data/match/lib/match/portal_fetcher.rb +12 -6
  102. data/match/lib/match/runner.rb +2 -1
  103. data/pem/lib/pem/manager.rb +3 -3
  104. data/precheck/lib/precheck/runner.rb +4 -2
  105. data/scan/lib/scan/detect_values.rb +0 -1
  106. data/scan/lib/scan/runner.rb +1 -0
  107. data/sigh/lib/assets/resign.sh +10 -3
  108. data/sigh/lib/sigh/resign.rb +5 -21
  109. data/snapshot/lib/snapshot/reset_simulators.rb +5 -2
  110. data/snapshot/lib/snapshot/runner.rb +0 -1
  111. data/spaceship/lib/spaceship/base.rb +1 -1
  112. data/spaceship/lib/spaceship/client.rb +6 -3
  113. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -14
  114. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +1 -1
  115. data/spaceship/lib/spaceship/connect_api/models/user.rb +7 -3
  116. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +9 -11
  117. data/spaceship/lib/spaceship/connect_api/token.rb +21 -1
  118. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +3 -1
  119. data/spaceship/lib/spaceship/helper/plist_middleware.rb +2 -2
  120. data/spaceship/lib/spaceship/portal/portal_client.rb +8 -8
  121. data/spaceship/lib/spaceship/test_flight/client.rb +1 -5
  122. data/supply/lib/supply/client.rb +1 -1
  123. data/supply/lib/supply/options.rb +6 -0
  124. data/supply/lib/supply/uploader.rb +28 -2
  125. metadata +29 -26
  126. data/fastlane/lib/fastlane/actions/hockey.rb +0 -400
  127. data/fastlane/lib/fastlane/actions/typetalk.rb +0 -93
@@ -4,6 +4,10 @@ module Fastlane
4
4
  module Actions
5
5
  class ImportCertificateAction < Action
6
6
  def self.run(params)
7
+ unless params[:keychain_name] || params[:keychain_path]
8
+ UI.user_error!("You must provide either a :keychain_name or a :keychain_path")
9
+ end
10
+
7
11
  keychain_path = params[:keychain_path] || FastlaneCore::Helper.keychain_path(params[:keychain_name])
8
12
 
9
13
  FastlaneCore::KeychainImporter.import_file(params[:certificate_path], keychain_path, keychain_password: params[:keychain_password], certificate_password: params[:certificate_password], certificate_format: params[:certificate_format], output: params[:log_output])
@@ -29,11 +33,13 @@ module Fastlane
29
33
  FastlaneCore::ConfigItem.new(key: :keychain_name,
30
34
  env_name: "KEYCHAIN_NAME",
31
35
  description: "Keychain the items should be imported to",
32
- optional: false),
36
+ optional: true,
37
+ conflicting_options: [:keychain_path]),
33
38
  FastlaneCore::ConfigItem.new(key: :keychain_path,
34
39
  env_name: "KEYCHAIN_PATH",
35
40
  description: "Path to the Keychain file to which the items should be imported",
36
- optional: true),
41
+ optional: true,
42
+ conflicting_options: [:keychain_name]),
37
43
  FastlaneCore::ConfigItem.new(key: :keychain_password,
38
44
  env_name: "FL_IMPORT_CERT_KEYCHAIN_PASSWORD",
39
45
  description: "The password for the keychain. Note that for the login keychain this is your user's password",
@@ -61,18 +67,24 @@ module Fastlane
61
67
 
62
68
  def self.example_code
63
69
  [
64
- 'import_certificate(certificate_path: "certs/AppleWWDRCA6.cer")',
70
+ 'import_certificate(
71
+ certificate_path: "certs/AppleWWDRCA6.cer",
72
+ keychain_name: "login.keychain"
73
+ )',
65
74
  'import_certificate(
66
75
  certificate_path: "certs/dist.p12",
67
- certificate_password: ENV["CERTIFICATE_PASSWORD"] || "default"
76
+ certificate_password: ENV["CERTIFICATE_PASSWORD"] || "default",
77
+ keychain_name: "custom.keychain"
68
78
  )',
69
79
  'import_certificate(
70
- certificate_path: "certs/development.cer"
80
+ certificate_path: "certs/development.cer",
81
+ keychain_path: File.expand_path("~/Library/Keychains/login.keychain-db")
71
82
  )',
72
83
  'import_certificate(
73
84
  certificate_path: "certs/dist.p12",
74
85
  certificate_password: ENV["CERTIFICATE_PASSWORD"] || "default",
75
- certificate_format: "pkcs12"
86
+ certificate_format: "pkcs12",
87
+ keychain_path: "/path/to/custom.keychain"
76
88
  )'
77
89
  ]
78
90
  end
@@ -0,0 +1,70 @@
1
+ module Fastlane
2
+ module Actions
3
+ class ImportFromGemAction < Action
4
+ def self.run(params)
5
+ # this is implemented in the fast_file.rb
6
+ end
7
+
8
+ #####################################################
9
+ # @!group Documentation
10
+ #####################################################
11
+
12
+ def self.description
13
+ "Import Fastfiles from an installed gem to use their lanes"
14
+ end
15
+
16
+ def self.details
17
+ [
18
+ "Like `import_from_git`, this is useful if you share lanes across multiple apps, here by packaging the Fastfiles in a gem. The project's `Gemfile.lock` then pins the version of the shared lanes and of what they depend on, and the fastlane plugins the gem depends on are loaded when its Fastfiles are imported.",
19
+ "The gem must be in the project's Gemfile. By default every `fastlane/Fastfile*` in the gem is imported, so lanes can be split into files by purpose; an `actions` folder next to them is imported too."
20
+ ].join("\n")
21
+ end
22
+
23
+ def self.available_options
24
+ [
25
+ FastlaneCore::ConfigItem.new(key: :gem_name,
26
+ optional: false,
27
+ type: String,
28
+ description: "The gem to import the Fastfiles and actions from"),
29
+ FastlaneCore::ConfigItem.new(key: :paths,
30
+ description: "The path(s) of the Fastfiles in the gem, as glob patterns",
31
+ type: Array,
32
+ default_value: ['fastlane/Fastfile*'],
33
+ optional: true)
34
+ ]
35
+ end
36
+
37
+ def self.category
38
+ :misc
39
+ end
40
+
41
+ def self.output
42
+ [
43
+ ]
44
+ end
45
+
46
+ def self.return_value
47
+ end
48
+
49
+ def self.authors
50
+ ["lacostej"]
51
+ end
52
+
53
+ def self.example_code
54
+ [
55
+ 'import_from_gem(
56
+ gem_name: "my_company_lanes" # The gem to import the Fastfiles from, listed in your Gemfile
57
+ )',
58
+ 'import_from_gem(
59
+ gem_name: "my_company_lanes",
60
+ paths: ["fastlane/Fastfile", "fastlane/Fastfile.release"] # The Fastfiles to import, relative to the gem
61
+ )'
62
+ ]
63
+ end
64
+
65
+ def self.is_supported?(platform)
66
+ true
67
+ end
68
+ end
69
+ end
70
+ end
@@ -3,7 +3,7 @@ module Fastlane
3
3
  class JazzyAction < Action
4
4
  def self.run(params)
5
5
  Actions.verify_gem!('jazzy')
6
- command = "jazzy"
6
+ command = +"jazzy"
7
7
  command << " --config #{params[:config]}" if params[:config]
8
8
  command << " --module-version #{params[:module_version]}" if params[:module_version]
9
9
  Actions.sh(command)
@@ -54,7 +54,7 @@ module Fastlane
54
54
  end
55
55
 
56
56
  def self.gen_lcov_cmd(cov_file)
57
- cmd = "lcov "
57
+ cmd = +"lcov "
58
58
  exclude_dirs.each do |e|
59
59
  cmd << "--remove #{cov_file} \"#{e}\" "
60
60
  end
@@ -108,12 +108,12 @@ module Fastlane
108
108
  end
109
109
 
110
110
  def self.handle_params_transition(options)
111
- if options[:mailgun_sandbox_postmaster] && !options[:postmaster]
111
+ if options[:mailgun_sandbox_postmaster] && !options.fetch(:postmaster, ask: false)
112
112
  options[:postmaster] = options[:mailgun_sandbox_postmaster]
113
113
  puts("\nUsing :mailgun_sandbox_postmaster is deprecated, please change to :postmaster".yellow)
114
114
  end
115
115
 
116
- if options[:mailgun_apikey] && !options[:apikey]
116
+ if options[:mailgun_apikey] && !options.fetch(:apikey, ask: false)
117
117
  options[:apikey] = options[:mailgun_apikey]
118
118
  puts("\nUsing :mailgun_apikey is deprecated, please change to :apikey".yellow)
119
119
  end
@@ -9,7 +9,7 @@ module Fastlane
9
9
  require 'json'
10
10
  require 'net/http'
11
11
 
12
- changelog = ""
12
+ changelog = +""
13
13
 
14
14
  if Helper.ci? || Helper.test?
15
15
  # The "BUILD_URL" environment variable is set automatically by Jenkins in every build
@@ -3,6 +3,8 @@ module Fastlane
3
3
  class NotarizeAction < Action
4
4
  # rubocop:disable Metrics/PerceivedComplexity
5
5
  def self.run(params)
6
+ UI.user_error!("The :keychain_path option can only be used together with :keychain_profile") if params[:keychain_path] && !params[:keychain_profile]
7
+
6
8
  package_path = params[:package]
7
9
  skip_stapling = params[:skip_stapling]
8
10
  print_log = params[:print_log]
@@ -13,6 +15,7 @@ module Fastlane
13
15
  params[:api_key] ||= Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY]
14
16
  end
15
17
  api_key = Spaceship::ConnectAPI::Token.from(hash: params[:api_key], filepath: params[:api_key_path])
18
+ UI.user_error!("Pass :keychain_profile, :api_key, :api_key_path or :username") unless params[:keychain_profile] || api_key || params[:username]
16
19
 
17
20
  # Compress only if .app bundle
18
21
  compressed_package_path = nil
@@ -30,9 +33,12 @@ module Fastlane
30
33
  def self.notarytool(params, package_path, skip_stapling, print_log, verbose, api_key, compressed_package_path)
31
34
  temp_file = nil
32
35
 
33
- # Create authorization part of command with either API Key or Apple ID
36
+ # Keychain profile first, then API key (which can come from the lane context), then Apple ID
34
37
  auth_parts = []
35
- if api_key
38
+ if params[:keychain_profile]
39
+ auth_parts << "--keychain-profile #{params[:keychain_profile].shellescape}"
40
+ auth_parts << "--keychain #{File.expand_path(params[:keychain_path]).shellescape}" if params[:keychain_path]
41
+ elsif api_key
36
42
  # Writes key contents to temporary file for command
37
43
  require 'tempfile'
38
44
  temp_file = Tempfile.new
@@ -60,15 +66,18 @@ module Fastlane
60
66
  end
61
67
 
62
68
  submit_command = submit_parts.join(' ')
69
+ notarytool_error = nil
63
70
  submit_response = Actions.sh(
64
71
  submit_command,
65
72
  log: verbose,
73
+ separate_stderr: true,
66
74
  error_callback: lambda { |msg|
75
+ notarytool_error = msg
67
76
  UI.error("Error polling for notarization info: #{msg}")
68
77
  }
69
78
  )
70
79
 
71
- notarization_info = JSON.parse(submit_response)
80
+ notarization_info = parse_notarytool_result(submit_response, notarytool_error)
72
81
 
73
82
  # Staple
74
83
  submission_id = notarization_info["id"]
@@ -109,6 +118,12 @@ module Fastlane
109
118
  temp_file.delete if temp_file
110
119
  end
111
120
 
121
+ def self.parse_notarytool_result(output, error)
122
+ JSON.parse(output)
123
+ rescue JSON::ParserError
124
+ UI.user_error!("notarytool did not return a notarization result:\n#{error || output}")
125
+ end
126
+
112
127
  def self.staple(package_path, verbose)
113
128
  Actions.sh(
114
129
  "xcrun stapler staple #{package_path.shellescape}",
@@ -148,7 +163,7 @@ module Fastlane
148
163
  description: 'Apple ID username',
149
164
  default_value: username,
150
165
  optional: true,
151
- conflicting_options: [:api_key_path, :api_key],
166
+ conflicting_options: [:api_key_path, :api_key, :keychain_profile],
152
167
  default_value_dynamic: true),
153
168
  FastlaneCore::ConfigItem.new(key: :asc_provider,
154
169
  env_name: 'FL_NOTARIZE_ASC_PROVIDER',
@@ -171,7 +186,7 @@ module Fastlane
171
186
  env_names: ['FL_NOTARIZE_API_KEY_PATH', "APP_STORE_CONNECT_API_KEY_PATH"],
172
187
  description: "Path to your App Store Connect API Key JSON file (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-json-file)",
173
188
  optional: true,
174
- conflicting_options: [:username, :api_key],
189
+ conflicting_options: [:username, :api_key, :keychain_profile],
175
190
  verify_block: proc do |value|
176
191
  UI.user_error!("API Key not found at '#{value}'") unless File.exist?(value)
177
192
  end),
@@ -179,9 +194,21 @@ module Fastlane
179
194
  env_names: ['FL_NOTARIZE_API_KEY', "APP_STORE_CONNECT_API_KEY"],
180
195
  description: "Your App Store Connect API Key information (https://docs.fastlane.tools/app-store-connect-api/#using-fastlane-api-key-hash-option)",
181
196
  optional: true,
182
- conflicting_options: [:username, :api_key_path],
197
+ conflicting_options: [:username, :api_key_path, :keychain_profile],
183
198
  sensitive: true,
184
- type: Hash)
199
+ type: Hash),
200
+ FastlaneCore::ConfigItem.new(key: :keychain_path,
201
+ env_name: 'FL_NOTARIZE_KEYCHAIN_PATH',
202
+ description: "The path to a keychain file to use for reading the keychain item. If not specified, the default user keychain is used",
203
+ optional: true,
204
+ conflicting_options: [:username, :api_key_path, :api_key],
205
+ type: String),
206
+ FastlaneCore::ConfigItem.new(key: :keychain_profile,
207
+ env_name: 'FL_NOTARIZE_KEYCHAIN_PROFILE',
208
+ description: "Authenticate with credentials stored in the Keychain. Use the profile name you provided in the \"xcrun notarytool store-credentials\" command. Unlike :username, no app-specific password is passed on the command line, so prefer it when you do not use an API key",
209
+ optional: true,
210
+ conflicting_options: [:username, :api_key_path, :api_key],
211
+ type: String)
185
212
  ]
186
213
  end
187
214
 
@@ -189,6 +216,27 @@ module Fastlane
189
216
  platform == :mac
190
217
  end
191
218
 
219
+ def self.example_code
220
+ [
221
+ 'notarize(
222
+ package: "MyApp.app",
223
+ api_key_path: "fastlane/AuthKey.json"
224
+ )',
225
+ '# If you want to notarize locally but don\'t have access to the API key,
226
+ # you can notarize using stored credentials:
227
+ #
228
+ # 1. Run `xcrun notarytool store-credentials --team-id "TEAM_ID" --apple-id "APPLE_ID"`
229
+ # 2. There will be prompts for the profile name and the app-specific password (so the password never appears on the command line).
230
+ # 3. The specified profile name can be used at any time without the need to specify team ID, username and password:
231
+ # `xcrun notarytool submit --keychain-profile KEYCHAIN_PROFILE_NAME`
232
+ notarize(
233
+ package: "MyApp.app",
234
+ keychain_profile: "AC_PASSWORD",
235
+ keychain_path: "~/Library/Keychains/notarization.keychain-db"
236
+ )'
237
+ ]
238
+ end
239
+
192
240
  def self.category
193
241
  :code_signing
194
242
  end
@@ -15,7 +15,7 @@ module Fastlane
15
15
  # Multi line
16
16
  end_tag = params[:multi_line_end_keyword]
17
17
  UI.important("Submit inputs using \"#{params[:multi_line_end_keyword]}\"")
18
- user_input = ""
18
+ user_input = +""
19
19
  loop do
20
20
  line = STDIN.gets # returns `nil` if called at end of file
21
21
  break unless line
@@ -121,10 +121,10 @@ module Fastlane
121
121
 
122
122
  def self.example_code
123
123
  [
124
- 'push_to_git_remote # simple version. pushes "master" branch to "origin" remote',
124
+ 'push_to_git_remote # simple version. Pushes the current branch and all local tags to "origin" remote',
125
125
  'push_to_git_remote(
126
126
  remote: "origin", # optional, default: "origin"
127
- local_branch: "develop", # optional, aliased by "branch", default is set to current branch
127
+ local_branch: "develop", # optional, default is set to current branch
128
128
  remote_branch: "develop", # optional, default is set to local_branch
129
129
  force: true, # optional, default: false
130
130
  force_with_lease: true, # optional, default: false
@@ -34,7 +34,23 @@ module Fastlane
34
34
  description: 'A callback invoked with the command output if there is a non-zero exit status',
35
35
  optional: true,
36
36
  type: :string_callback,
37
- default_value: nil)
37
+ default_value: nil),
38
+ FastlaneCore::ConfigItem.new(key: :stdin,
39
+ description: 'Data written to the command\'s standard input, which is then closed. It is never printed, so it can carry a secret the command reads from its input',
40
+ optional: true,
41
+ sensitive: true,
42
+ type: String,
43
+ default_value: nil),
44
+ FastlaneCore::ConfigItem.new(key: :chdir,
45
+ description: 'Directory the command runs in; the lane\'s own directory stays as it is',
46
+ optional: true,
47
+ type: String,
48
+ default_value: nil),
49
+ FastlaneCore::ConfigItem.new(key: :separate_stderr,
50
+ description: 'Return stdout only; stderr goes to the error message and the error_callback',
51
+ optional: true,
52
+ type: Boolean,
53
+ default_value: false)
38
54
  ]
39
55
  end
40
56
 
@@ -57,7 +73,9 @@ module Fastlane
57
73
  def self.example_code
58
74
  [
59
75
  'sh("ls")',
60
- 'sh("git", "commit", "-m", "My message")'
76
+ 'sh("git", "commit", "-m", "My message")',
77
+ 'sh("gh", "auth", "login", "--with-token", stdin: ENV["GH_TOKEN"])',
78
+ 'version = sh("xcodebuild", "-version", separate_stderr: true)'
61
79
  ]
62
80
  end
63
81
 
@@ -4,7 +4,7 @@ module Fastlane
4
4
  def self.run(params)
5
5
  UI.user_error!("You have to install sourcedocs using `brew install sourcedocs`") unless Helper.which('sourcedocs') || Helper.test?
6
6
 
7
- command = "sourcedocs generate"
7
+ command = +"sourcedocs generate"
8
8
  command << " --all-modules" if params[:all_modules]
9
9
  command << " --spm-module #{params[:spm_module].shellescape}" unless params[:spm_module].nil?
10
10
  command << " --module-name #{params[:module_name].shellescape}" unless params[:module_name].nil?
@@ -58,7 +58,7 @@ module Fastlane
58
58
  FastlaneCore::ConfigItem.new(key: :output_folder,
59
59
  env_name: 'FL_SOURCEDOCS_OUTPUT_FOLDER',
60
60
  description: 'Output directory to clean (default: Documentation/Reference)',
61
- optional: false),
61
+ optional: true),
62
62
  FastlaneCore::ConfigItem.new(key: :min_acl,
63
63
  env_name: 'FL_SOURCEDOCS_MIN_ACL',
64
64
  description: 'Access level to include in documentation [private, fileprivate, internal, public, open] (default: public)',
@@ -53,7 +53,7 @@ module Fastlane
53
53
  end
54
54
 
55
55
  def self.optional_flags(params)
56
- command = ""
56
+ command = +""
57
57
  command << supported_option_switch(params, :strict, "0.9.2", true)
58
58
  command << " --config #{params[:config_file].shellescape}" if params[:config_file]
59
59
  command << " --reporter #{params[:reporter]}" if params[:reporter]
@@ -76,7 +76,10 @@ module Fastlane
76
76
  # Get current SwiftLint version
77
77
  def self.swiftlint_version(executable: nil)
78
78
  binary = executable || 'swiftlint'
79
- Gem::Version.new(`#{binary} version`.chomp)
79
+ version = Actions.sh("#{binary} version", log: false, separate_stderr: true, error_callback: lambda { |error|
80
+ UI.user_error!("`#{binary} version` failed: #{error.strip}")
81
+ })
82
+ Gem::Version.new(version.chomp)
80
83
  end
81
84
 
82
85
  def self.supported_no_cache_option(params)
@@ -1,60 +1,48 @@
1
+ require 'security'
2
+
1
3
  module Fastlane
2
4
  module Actions
3
5
  class UnlockKeychainAction < Action
4
6
  def self.run(params)
5
7
  keychain_path = FastlaneCore::Helper.keychain_path(params[:path])
6
8
  add_to_search_list = params[:add_to_search_list]
7
- set_default = params[:set_default]
8
- commands = []
9
9
 
10
10
  # add to search list if not already added
11
11
  if add_to_search_list == true || add_to_search_list == :add
12
- commands << add_keychain_to_search_list(keychain_path)
12
+ add_keychain_to_search_list(keychain_path)
13
13
  elsif add_to_search_list == :replace
14
- commands << replace_keychain_in_search_list(keychain_path)
15
- end
16
-
17
- # set default keychain
18
- if set_default
19
- commands << default_keychain(keychain_path)
14
+ replace_keychain_in_search_list(keychain_path)
20
15
  end
21
16
 
22
- escaped_path = keychain_path.shellescape
23
- escaped_password = params[:password].shellescape
17
+ default_keychain(keychain_path) if params[:set_default]
24
18
 
25
19
  # Log the full path, useful for troubleshooting
26
- UI.message("Unlocking keychain at path: #{escaped_path}")
20
+ UI.message("Unlocking keychain at path: #{keychain_path}")
27
21
  # unlock given keychain and disable lock and timeout
28
- commands << Fastlane::Actions.sh("security unlock-keychain -p #{escaped_password} #{escaped_path}", log: false)
29
- commands << Fastlane::Actions.sh("security set-keychain-settings #{escaped_path}", log: false)
30
- commands
22
+ keychain = Security::Keychain.new(keychain_path)
23
+ UI.user_error!("Could not unlock keychain '#{keychain_path}'") unless keychain.unlock(params[:password])
24
+ UI.user_error!("Could not change the settings of keychain '#{keychain_path}'") unless keychain.update_settings
31
25
  end
32
26
 
33
27
  def self.add_keychain_to_search_list(keychain_path)
34
- keychains = Fastlane::Actions.sh("security list-keychains -d user", log: false).shellsplit
28
+ keychains = Security::Keychain.list(:user).map(&:filename)
29
+ return if keychains.include?(keychain_path)
35
30
 
36
- # add the keychain to the keychain list
37
- unless keychains.include?(keychain_path)
38
- keychains << keychain_path
39
-
40
- Fastlane::Actions.sh("security list-keychains -s #{keychains.shelljoin}", log: false)
41
- end
31
+ UI.user_error!("Could not add '#{keychain_path}' to the keychain search list") unless Security::Keychain.set_search_list(keychains + [keychain_path])
42
32
  end
43
33
 
44
34
  def self.replace_keychain_in_search_list(keychain_path)
45
35
  begin
46
36
  UI.message("Reading existing default keychain")
47
- Actions.lane_context[Actions::SharedValues::ORIGINAL_DEFAULT_KEYCHAIN] = Fastlane::Actions.sh("security default-keychain").strip
48
- rescue => e
49
- raise unless e.message.include?("security: SecKeychainCopyDefault: A default keychain could not be found.")
37
+ Actions.lane_context[Actions::SharedValues::ORIGINAL_DEFAULT_KEYCHAIN] = Security::Keychain.default_keychain&.filename
38
+ rescue Security::Error => e
39
+ raise unless e.message.include?("A default keychain could not be found")
50
40
  end
51
- escaped_path = keychain_path.shellescape
52
- Fastlane::Actions.sh("security list-keychains -s #{escaped_path}", log: false)
41
+ UI.user_error!("Could not replace the keychain search list with '#{keychain_path}'") unless Security::Keychain.set_search_list([keychain_path])
53
42
  end
54
43
 
55
44
  def self.default_keychain(keychain_path)
56
- escaped_path = keychain_path.shellescape
57
- Fastlane::Actions.sh("security default-keychain -s #{escaped_path}", log: false)
45
+ UI.user_error!("Could not make '#{keychain_path}' the default keychain") unless Security::Keychain.set_default_keychain(keychain_path)
58
46
  end
59
47
 
60
48
  #####################################################
@@ -10,6 +10,11 @@ module Fastlane
10
10
  def self.run(options)
11
11
  return if options[:no_update] # this is used to update itself
12
12
 
13
+ if Helper.bundler?
14
+ UI.important("update_fastlane does nothing when fastlane runs with Bundler: your Gemfile.lock sets the version. Run `bundle update fastlane` instead.")
15
+ return
16
+ end
17
+
13
18
  tools_to_update = ALL_TOOLS
14
19
  UI.message("Looking for updates for #{tools_to_update.join(', ')}...")
15
20
 
@@ -78,8 +83,8 @@ module Fastlane
78
83
 
79
84
  UI.message("fastlane.tools successfully updated! I will now restart myself... 😴")
80
85
 
81
- # Set no_update to true so we don't try to update again
82
- exec("FL_NO_UPDATE=true #{$PROGRAM_NAME} #{ARGV.join(' ')}")
86
+ # Set no_update to true so we don't try to update again. Without a shell, so each argument stays as given
87
+ exec({ "FL_NO_UPDATE" => "true" }, $PROGRAM_NAME, *ARGV)
83
88
  end
84
89
 
85
90
  def self.get_gem_name(tool_info)
@@ -113,7 +118,9 @@ module Fastlane
113
118
  sample,
114
119
  "After the above changes, restart your terminal, then run `mkdir $GEM_HOME` to create the new gem directory. After this, you're good to go!",
115
120
  "",
116
- "Recommended usage of the `update_fastlane` action is at the top inside of the `before_all` block, before running any other action."
121
+ "Recommended usage of the `update_fastlane` action is at the top inside of the `before_all` block, before running any other action.",
122
+ "",
123
+ "When fastlane runs with Bundler (`bundle exec fastlane`), this action does nothing: run `bundle update fastlane` instead."
117
124
  ].join("\n")
118
125
  end
119
126
 
@@ -13,7 +13,8 @@ module Fastlane
13
13
  path = File.join(path, "project.pbxproj")
14
14
  UI.user_error!("Could not find path to project config '#{path}'. Pass the path to your project (not workspace)!") unless File.exist?(path)
15
15
 
16
- uuid = params[:uuid] || params[:udid]
16
+ # :uuid last again, to ask for it or fail when neither is given
17
+ uuid = params.fetch(:uuid, ask: false) || params[:udid] || params[:uuid]
17
18
  UI.message("Updating provisioning profile UUID (#{uuid}) for the given project '#{path}'")
18
19
 
19
20
  p = File.read(path)
@@ -1,14 +1,16 @@
1
1
  # coding: utf-8
2
2
 
3
- require 'tmpdir'
4
-
5
3
  module Fastlane
6
4
  module Actions
7
5
  module SharedValues
8
6
  end
9
7
 
10
8
  class UpdateProjectProvisioningAction < Action
11
- ROOT_CERTIFICATE_URL = "https://www.apple.com/appleca/AppleIncRootCertificate.cer"
9
+ # Apple Root CA and Apple Root CA - G3, from https://www.apple.com/certificateauthority/
10
+ ROOT_CERTIFICATE_PATHS = %w(AppleIncRootCertificate.cer AppleRootCA-G3.cer).map do |name|
11
+ File.join(Fastlane::ROOT, "lib", "assets", "certificates", name)
12
+ end
13
+
12
14
  def self.run(params)
13
15
  UI.message("You’re updating provisioning profiles directly in your project, but have you considered easier ways to do code signing?")
14
16
  UI.message("https://docs.fastlane.tools/codesigning/GettingStarted/")
@@ -20,25 +22,16 @@ module Fastlane
20
22
  project_file_path = File.join(folder, "project.pbxproj")
21
23
  UI.user_error!("Could not find path to project config '#{project_file_path}'. Pass the path to your project (not workspace)!") unless File.exist?(project_file_path)
22
24
 
23
- # download certificate
24
- unless File.exist?(params[:certificate]) && File.size(params[:certificate]) > 0
25
- UI.message("Downloading root certificate from (#{ROOT_CERTIFICATE_URL}) to path '#{params[:certificate]}'")
26
- require 'open-uri'
27
- File.open(params[:certificate], "w:ASCII-8BIT") do |file|
28
- file.write(URI.parse(ROOT_CERTIFICATE_URL).open("rb").read)
29
- end
30
- end
25
+ certs = root_certificates(params[:certificate])
31
26
 
32
27
  # parsing mobileprovision file
33
28
  UI.message("Parsing mobile provisioning profile from '#{params[:profile]}'")
34
- profile = File.read(params[:profile])
29
+ profile = File.binread(params[:profile])
35
30
  p7 = OpenSSL::PKCS7.new(profile)
36
31
  store = OpenSSL::X509::Store.new
37
- UI.user_error!("Could not find valid certificate at '#{params[:certificate]}'") unless File.size(params[:certificate]) > 0
38
- cert = OpenSSL::X509::Certificate.new(File.read(params[:certificate]))
39
- store.add_cert(cert)
32
+ certs.each { |cert| store.add_cert(cert) }
40
33
 
41
- p7.verify([cert], store)
34
+ p7.verify(certs, store)
42
35
  check_verify!(p7)
43
36
  data = Plist.parse_xml(p7.data)
44
37
 
@@ -86,6 +79,16 @@ module Fastlane
86
79
  UI.success("Successfully updated project settings in '#{folder}'")
87
80
  end
88
81
 
82
+ def self.root_certificates(path)
83
+ paths = ROOT_CERTIFICATE_PATHS
84
+ if path && File.size?(path)
85
+ paths += [path]
86
+ elsif path
87
+ UI.important("No certificate at '#{path}', verifying the profile with Apple's root certificates shipped with fastlane. Remove the `certificate` option unless you need a root certificate they do not include.")
88
+ end
89
+ paths.map { |p| OpenSSL::X509::Certificate.new(File.binread(p)) }
90
+ end
91
+
89
92
  def self.check_verify!(p7)
90
93
  failed_to_verify = (p7.data.nil? || p7.data == "") && !(p7.error_string || "").empty?
91
94
  if failed_to_verify
@@ -147,8 +150,8 @@ module Fastlane
147
150
  end),
148
151
  FastlaneCore::ConfigItem.new(key: :certificate,
149
152
  env_name: "FL_PROJECT_PROVISIONING_CERTIFICATE_PATH",
150
- description: "Path to apple root certificate",
151
- default_value: File.join(Dir.tmpdir, "AppleIncRootCertificate.cer")),
153
+ description: "Path to a root certificate to trust in addition to Apple's root certificates shipped with fastlane, e.g. a root Apple introduced after this release",
154
+ optional: true),
152
155
  FastlaneCore::ConfigItem.new(key: :code_signing_identity,
153
156
  env_name: "FL_PROJECT_PROVISIONING_CODE_SIGN_IDENTITY",
154
157
  description: "Code sign identity for build configuration",
@@ -236,7 +236,7 @@ module Fastlane
236
236
  FastlaneCore::ConfigItem.new(key: :skip_json_file_saving,
237
237
  env_name: "UPLOAD_APP_PRIVACY_DETAILS_TO_APP_STORE_OUTPUT_SKIP_JSON_FILE_SAVING",
238
238
  description: "Whether to skip the saving of the JSON file",
239
- conflicting_options: [:skip_output_json_path],
239
+ conflicting_options: [:output_json_path],
240
240
  type: Boolean,
241
241
  default_value: false),
242
242
  FastlaneCore::ConfigItem.new(key: :skip_upload,