fastlane 2.131.0 → 2.135.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +70 -70
  3. data/cert/lib/cert/module.rb +2 -0
  4. data/cert/lib/cert/options.rb +6 -0
  5. data/cert/lib/cert/runner.rb +17 -11
  6. data/fastlane/lib/fastlane/action.rb +1 -1
  7. data/{pilot/lib/pilot/.manager.rb.swp → fastlane/lib/fastlane/actions/.google_play_track_version_codes.rb.swp} +0 -0
  8. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  9. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +10 -2
  10. data/fastlane/lib/fastlane/actions/carthage.rb +7 -0
  11. data/fastlane/lib/fastlane/actions/cocoapods.rb +24 -2
  12. data/fastlane/lib/fastlane/actions/copy_artifacts.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/deploygate.rb +1 -1
  14. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  15. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +26 -5
  16. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +26 -2
  17. data/fastlane/lib/fastlane/actions/download_dsyms.rb +26 -3
  18. data/fastlane/lib/fastlane/actions/download_from_play_store.rb +1 -1
  19. data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +58 -0
  20. data/fastlane/lib/fastlane/actions/get_version_number.rb +12 -3
  21. data/fastlane/lib/fastlane/actions/google_play_track_version_codes.rb +5 -1
  22. data/fastlane/lib/fastlane/actions/onesignal.rb +59 -29
  23. data/fastlane/lib/fastlane/actions/pod_push.rb +10 -1
  24. data/fastlane/lib/fastlane/actions/register_devices.rb +1 -1
  25. data/fastlane/lib/fastlane/actions/sonar.rb +16 -0
  26. data/fastlane/lib/fastlane/actions/testfairy.rb +1 -1
  27. data/fastlane/lib/fastlane/actions/update_fastlane.rb +9 -49
  28. data/fastlane/lib/fastlane/actions/update_keychain_access_groups.rb +94 -0
  29. data/fastlane/lib/fastlane/environment_printer.rb +9 -3
  30. data/fastlane/lib/fastlane/fast_file.rb +10 -4
  31. data/fastlane/lib/fastlane/lane_manager.rb +1 -1
  32. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +12 -2
  33. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +1 -0
  34. data/fastlane/lib/fastlane/runner.rb +2 -2
  35. data/fastlane/lib/fastlane/setup/setup_android.rb +1 -1
  36. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +10 -2
  37. data/fastlane/lib/fastlane/swift_fastlane_function.rb +72 -3
  38. data/fastlane/lib/fastlane/version.rb +1 -1
  39. data/fastlane/swift/Deliverfile.swift +1 -1
  40. data/fastlane/swift/DeliverfileProtocol.swift +121 -1
  41. data/fastlane/swift/Fastlane.swift +3928 -18
  42. data/fastlane/swift/Gymfile.swift +1 -1
  43. data/fastlane/swift/GymfileProtocol.swift +81 -1
  44. data/fastlane/swift/Matchfile.swift +1 -1
  45. data/fastlane/swift/MatchfileProtocol.swift +63 -1
  46. data/fastlane/swift/Precheckfile.swift +1 -1
  47. data/fastlane/swift/PrecheckfileProtocol.swift +15 -2
  48. data/fastlane/swift/Scanfile.swift +1 -1
  49. data/fastlane/swift/ScanfileProtocol.swift +109 -1
  50. data/fastlane/swift/Screengrabfile.swift +1 -1
  51. data/fastlane/swift/ScreengrabfileProtocol.swift +39 -2
  52. data/fastlane/swift/Snapshotfile.swift +1 -1
  53. data/fastlane/swift/SnapshotfileProtocol.swift +71 -1
  54. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +3 -3
  55. data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +1 -1
  56. data/fastlane_core/lib/fastlane_core/device_manager.rb +1 -1
  57. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +1 -3
  58. data/fastlane_core/lib/fastlane_core/swag.rb +1 -1
  59. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +1 -1
  60. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +3 -2
  61. data/frameit/lib/frameit/screenshot.rb +4 -0
  62. data/match/lib/match/generator.rb +1 -0
  63. data/match/lib/match/importer.rb +1 -1
  64. data/match/lib/match/module.rb +2 -0
  65. data/match/lib/match/nuke.rb +5 -5
  66. data/match/lib/match/options.rb +12 -0
  67. data/match/lib/match/runner.rb +2 -0
  68. data/match/lib/match/storage/git_storage.rb +8 -2
  69. data/match/lib/match/storage/google_cloud_storage.rb +85 -33
  70. data/produce/lib/produce/service.rb +7 -1
  71. data/scan/lib/scan/error_handler.rb +9 -4
  72. data/scan/lib/scan/runner.rb +1 -1
  73. data/sigh/lib/assets/resign.sh +2 -2
  74. data/sigh/lib/sigh/runner.rb +13 -5
  75. data/snapshot/lib/snapshot/options.rb +5 -0
  76. data/snapshot/lib/snapshot/reports_generator.rb +3 -0
  77. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  78. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +2 -2
  79. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +16 -1
  80. data/spaceship/lib/spaceship/client.rb +2 -2
  81. data/spaceship/lib/spaceship/connect_api/models/app.rb +6 -6
  82. data/spaceship/lib/spaceship/connect_api/models/build.rb +3 -3
  83. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +1 -1
  84. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +1 -1
  85. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +1 -1
  86. data/spaceship/lib/spaceship/connect_api/models/device.rb +1 -1
  87. data/spaceship/lib/spaceship/connect_api/models/profile.rb +1 -1
  88. data/spaceship/lib/spaceship/portal/provisioning_profile.rb +1 -1
  89. data/spaceship/lib/spaceship/tunes/app_version.rb +4 -0
  90. data/spaceship/lib/spaceship/tunes/application.rb +4 -0
  91. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +10 -2
  92. data/spaceship/lib/spaceship/tunes/tunes_client.rb +25 -0
  93. data/supply/lib/supply.rb +23 -0
  94. data/supply/lib/supply/client.rb +101 -55
  95. data/supply/lib/supply/options.rb +49 -14
  96. data/supply/lib/supply/release_listing.rb +18 -0
  97. data/supply/lib/supply/setup.rb +42 -34
  98. data/supply/lib/supply/uploader.rb +168 -93
  99. metadata +50 -53
  100. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  101. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  102. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  103. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  104. data/gym/lib/gym/.runner.rb.swp +0 -0
  105. data/spaceship/lib/spaceship/connect_api/.DS_Store +0 -0
@@ -33,7 +33,7 @@ module Fastlane
33
33
  req.url("/api/upload/")
34
34
  req.body = options
35
35
  end
36
- rescue Faraday::Error::TimeoutError
36
+ rescue Faraday::TimeoutError
37
37
  UI.crash!("Uploading build to TestFairy timed out ⏳")
38
38
  end
39
39
  end
@@ -10,18 +10,10 @@ module Fastlane
10
10
  def self.run(options)
11
11
  return if options[:no_update] # this is used to update itself
12
12
 
13
- tools_to_update = options[:tools].split(',') unless options[:tools].nil?
14
- tools_to_update ||= all_installed_tools
15
-
16
- if tools_to_update.count == 0
17
- UI.error("No tools specified or couldn't find any installed fastlane.tools")
18
- return
19
- end
20
-
13
+ tools_to_update = ALL_TOOLS
21
14
  UI.message("Looking for updates for #{tools_to_update.join(', ')}...")
22
15
 
23
16
  updater = Gem::CommandManager.instance[:update]
24
- updater.options[:prerelease] = true if options[:nightly]
25
17
  cleaner = Gem::CommandManager.instance[:cleanup]
26
18
 
27
19
  gem_dir = ENV['GEM_HOME'] || Gem.dir
@@ -49,7 +41,6 @@ module Fastlane
49
41
 
50
42
  if update_needed.count == 0
51
43
  UI.success("Nothing to update ✅")
52
- show_information_about_nightly_builds unless options[:nightly]
53
44
  return
54
45
  end
55
46
 
@@ -58,18 +49,13 @@ module Fastlane
58
49
 
59
50
  update_needed.each do |tool_info|
60
51
  tool = tool_info[0]
61
- gem_version = tool_info[1]
62
52
  local_version = Gem::Version.new(highest_versions[tool].version)
63
53
  latest_official_version = FastlaneCore::UpdateChecker.fetch_latest(tool)
64
54
 
65
- if options[:nightly]
66
- UI.message("Updating #{tool} from #{local_version.to_s.yellow} to nightly build #{gem_version.to_s.yellow}... (last official release #{latest_official_version.to_s.yellow}) 🚀")
67
- else
68
- UI.message("Updating #{tool} from #{local_version.to_s.yellow} to #{latest_official_version.to_s.yellow}... 🚀")
69
- end
55
+ UI.message("Updating #{tool} from #{local_version.to_s.yellow} to #{latest_official_version.to_s.yellow}... 🚀")
70
56
 
71
57
  # Approximate_recommendation will create a string like "~> 0.10" from a version 0.10.0, e.g. one that is valid for versions >= 0.10 and <1.0
72
- requirement_version = options[:nightly] ? gem_version : local_version.approximate_recommendation
58
+ requirement_version = local_version.approximate_recommendation
73
59
  updater.update_gem(tool, Gem::Requirement.new(requirement_version))
74
60
 
75
61
  UI.success("Finished updating #{tool}")
@@ -79,34 +65,12 @@ module Fastlane
79
65
  cleaner.options[:args] = tools_to_update
80
66
  cleaner.execute
81
67
 
82
- if options[:nightly]
83
- UI.success("Thanks for using fastlane's nightly builds! This makes it easier for everyone to detect regressions earlier.")
84
- UI.success("Please submit an issue on GitHub if anything behaves differently than it should 🍪")
85
- else
86
- show_information_about_nightly_builds
87
- end
88
-
89
68
  UI.message("fastlane.tools successfully updated! I will now restart myself... 😴")
90
69
 
91
70
  # Set no_update to true so we don't try to update again
92
71
  exec("FL_NO_UPDATE=true #{$PROGRAM_NAME} #{ARGV.join(' ')}")
93
72
  end
94
73
 
95
- def self.show_information_about_nightly_builds
96
- UI.message("")
97
- UI.message("Please help us test early releases of fastlane by opting into nightly builds 🌃")
98
- UI.message("Just replace your `update_fastlane` call with")
99
- UI.message("")
100
- UI.command_output("update_fastlane(nightly: true)")
101
- UI.message("")
102
- UI.message("Nightly builds are reviewed and tested just like the public releases 🚂")
103
- UI.message("")
104
- end
105
-
106
- def self.all_installed_tools
107
- Gem::Specification.select { |s| ALL_TOOLS.include?(s.name) }.map(&:name).uniq
108
- end
109
-
110
74
  def self.description
111
75
  "Makes sure fastlane-tools are up-to-date when running fastlane"
112
76
  end
@@ -134,21 +98,17 @@ module Fastlane
134
98
 
135
99
  def self.available_options
136
100
  [
137
- FastlaneCore::ConfigItem.new(key: :nightly,
138
- env_name: "FL_UPDATE_FASTLANE_NIGHTLY",
139
- description: "Opt-in to install and use nightly fastlane builds",
140
- is_string: false,
141
- default_value: false),
142
101
  FastlaneCore::ConfigItem.new(key: :no_update,
143
102
  env_name: "FL_NO_UPDATE",
144
103
  description: "Don't update during this run. This is used internally",
145
104
  is_string: false,
146
105
  default_value: false),
147
- FastlaneCore::ConfigItem.new(key: :tools,
148
- env_name: "FL_TOOLS_TO_UPDATE",
149
- description: "Comma separated list of fastlane tools to update (e.g. `fastlane,deliver,sigh`)",
150
- deprecated: true,
151
- optional: true)
106
+ FastlaneCore::ConfigItem.new(key: :nightly,
107
+ env_name: "FL_UPDATE_FASTLANE_NIGHTLY",
108
+ description: "Opt-in to install and use nightly fastlane builds",
109
+ is_string: false,
110
+ default_value: false,
111
+ deprecated: "Nightly builds are no longer being made available")
152
112
  ]
153
113
  end
154
114
 
@@ -0,0 +1,94 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ KEYCHAIN_ACCESS_GROUPS = :KEYCHAIN_ACCESS_GROUPS
5
+ end
6
+
7
+ class UpdateKeychainAccessGroupsAction < Action
8
+ require 'plist'
9
+
10
+ def self.run(params)
11
+ UI.message("Entitlements File: #{params[:entitlements_file]}")
12
+ UI.message("New keychain access groups: #{params[:identifiers]}")
13
+
14
+ entitlements_file = params[:entitlements_file]
15
+ UI.user_error!("Could not find entitlements file at path '#{entitlements_file}'") unless File.exist?(entitlements_file)
16
+
17
+ # parse entitlements
18
+ result = Plist.parse_xml(entitlements_file)
19
+ UI.user_error!("Entitlements file at '#{entitlements_file}' cannot be parsed.") unless result
20
+
21
+ # keychain access groups key
22
+ keychain_access_groups_key = 'keychain-access-groups'
23
+
24
+ # get keychain access groups
25
+ keychain_access_groups_field = result[keychain_access_groups_key]
26
+ UI.user_error!("No existing keychain access groups field specified. Please specify an keychain access groups in the entitlements file.") unless keychain_access_groups_field
27
+
28
+ # set new keychain access groups
29
+ UI.message("Old keychain access groups: #{keychain_access_groups_field}")
30
+ result[keychain_access_groups_key] = params[:identifiers]
31
+
32
+ # save entitlements file
33
+ result.save_plist(entitlements_file)
34
+ UI.message("New keychain access groups: #{result[keychain_access_groups_key]}")
35
+
36
+ Actions.lane_context[SharedValues::KEYCHAIN_ACCESS_GROUPS] = result[keychain_access_groups_key]
37
+ end
38
+
39
+ def self.description
40
+ "This action changes the keychain access groups in the entitlements file"
41
+ end
42
+
43
+ def self.details
44
+ "Updates the Keychain Group Access Groups in the given Entitlements file, so you can have keychain access groups for the app store build and keychain access groups for an enterprise build."
45
+ end
46
+
47
+ def self.available_options
48
+ [
49
+ FastlaneCore::ConfigItem.new(key: :entitlements_file,
50
+ env_name: "FL_UPDATE_KEYCHAIN_ACCESS_GROUPS_ENTITLEMENTS_FILE_PATH", # The name of the environment variable
51
+ description: "The path to the entitlement file which contains the keychain access groups", # a short description of this parameter
52
+ verify_block: proc do |value|
53
+ UI.user_error!("Please pass a path to an entitlements file. ") unless value.include?(".entitlements")
54
+ UI.user_error!("Could not find entitlements file") if !File.exist?(value) && !Helper.test?
55
+ end),
56
+ FastlaneCore::ConfigItem.new(key: :identifiers,
57
+ env_name: "FL_UPDATE_KEYCHAIN_ACCESS_GROUPS_IDENTIFIERS",
58
+ description: "An Array of unique identifiers for the keychain access groups. Eg. ['your.keychain.access.groups.identifiers']",
59
+ is_string: false,
60
+ verify_block: proc do |value|
61
+ UI.user_error!("The parameter identifiers need to be an Array.") unless value.kind_of?(Array)
62
+ end)
63
+ ]
64
+ end
65
+
66
+ def self.output
67
+ [
68
+ ['KEYCHAIN_ACCESS_GROUPS', 'The new Keychain Access Groups']
69
+ ]
70
+ end
71
+
72
+ def self.authors
73
+ ["yutae"]
74
+ end
75
+
76
+ def self.is_supported?(platform)
77
+ platform == :ios
78
+ end
79
+
80
+ def self.example_code
81
+ [
82
+ 'update_keychain_access_groups(
83
+ entitlements_file: "/path/to/entitlements_file.entitlements",
84
+ identifiers: ["your.keychain.access.groups.identifiers"]
85
+ )'
86
+ ]
87
+ end
88
+
89
+ def self.category
90
+ :project
91
+ end
92
+ end
93
+ end
94
+ end
@@ -50,11 +50,11 @@ module Fastlane
50
50
  end
51
51
 
52
52
  def self.print_loaded_plugins
53
- ENV["FASTLANE_ENV_PRINTER"] = "enabled"
54
53
  env_output = "### Loaded fastlane plugins:\n"
55
54
  env_output << "\n"
56
55
  plugin_manager = Fastlane::PluginManager.new
57
- plugin_manager.load_plugins
56
+ plugin_manager.load_plugins(print_table: false)
57
+
58
58
  if plugin_manager.available_plugins.length <= 0
59
59
  env_output << "**No plugins Loaded**\n"
60
60
  else
@@ -211,7 +211,7 @@ module Fastlane
211
211
  "OS" => os_version,
212
212
  "Ruby" => RUBY_VERSION,
213
213
  "Bundler?" => Helper.bundler?,
214
- "Git" => `git --version`.strip.split("\n").first,
214
+ "Git" => git_version,
215
215
  "Installation Source" => anonymized_path($PROGRAM_NAME),
216
216
  "Host" => "#{product} #{version} (#{build})",
217
217
  "Ruby Lib Dir" => anonymized_path(RbConfig::CONFIG['libdir']),
@@ -293,5 +293,11 @@ module Fastlane
293
293
  require 'open3'
294
294
  Open3.popen3('pbcopy') { |input, _, _| input << string }
295
295
  end
296
+
297
+ def self.git_version
298
+ return `git --version`.strip.split("\n").first
299
+ rescue
300
+ return "not found"
301
+ end
296
302
  end
297
303
  end
@@ -26,10 +26,15 @@ module Fastlane
26
26
  'you should turn off smart quotes in your editor of choice.')
27
27
  end
28
28
 
29
- content.scan(/^\s*require (.*)/).each do |current|
29
+ content.scan(/^\s*require ["'](.*?)["']/).each do |current|
30
30
  gem_name = current.last
31
31
  next if gem_name.include?(".") # these are local gems
32
- UI.important("You have required a gem, if this is a third party gem, please use `fastlane_require #{gem_name}` to ensure the gem is installed locally.")
32
+
33
+ begin
34
+ require(gem_name)
35
+ rescue LoadError
36
+ UI.important("You have required a gem, if this is a third party gem, please use `fastlane_require '#{gem_name}'` to ensure the gem is installed locally.")
37
+ end
33
38
  end
34
39
 
35
40
  parse(content, @path)
@@ -190,6 +195,7 @@ module Fastlane
190
195
  # sh("ls")
191
196
  # sh("ls", log: false)
192
197
  # sh(command: "ls")
198
+ # sh(command: "ls", step_name: "listing the files")
193
199
  # sh(command: "ls", log: false)
194
200
  def sh(*args, &b)
195
201
  # First accepts hash (or named keywords) like other actions
@@ -207,8 +213,8 @@ module Fastlane
207
213
  end
208
214
  end
209
215
 
210
- def self.sh(*command, log: true, error_callback: nil, &b)
211
- command_header = log ? Actions.shell_command_from_args(*command) : "shell command"
216
+ def self.sh(*command, step_name: nil, log: true, error_callback: nil, &b)
217
+ command_header = log ? step_name || Actions.shell_command_from_args(*command) : "shell command"
212
218
  Actions.execute_action(command_header) do
213
219
  Actions.sh_no_action(*command, log: log, error_callback: error_callback, &b)
214
220
  end
@@ -113,7 +113,7 @@ module Fastlane
113
113
  rows: FastlaneCore::PrintTable.transform_output(rows)
114
114
  )
115
115
 
116
- UI.message("Welcome to fastlane! Here's what your app is setup to do:")
116
+ UI.message("Welcome to fastlane! Here's what your app is set up to do:")
117
117
 
118
118
  puts(table)
119
119
 
@@ -278,7 +278,7 @@ module Fastlane
278
278
  # fastlane-plugin-[plugin_name]
279
279
  # This will make sure to load the action
280
280
  # and all its helpers
281
- def load_plugins
281
+ def load_plugins(print_table: true)
282
282
  UI.verbose("Checking if there are any plugins that should be loaded...")
283
283
 
284
284
  loaded_plugins = false
@@ -311,7 +311,7 @@ module Fastlane
311
311
  UI.error("Please follow the troubleshooting guide: #{TROUBLESHOOTING_URL}")
312
312
  end
313
313
 
314
- skip_print_plugin_info = self.plugin_references.empty? || CLIToolsDistributor.running_version_command? || FastlaneCore::Env.truthy?("FASTLANE_ENV_PRINTER")
314
+ skip_print_plugin_info = self.plugin_references.empty? || CLIToolsDistributor.running_version_command? || !print_table
315
315
 
316
316
  # We want to avoid printing output other than the version number if we are running `fastlane -v`
317
317
  print_plugin_information(self.plugin_references) unless skip_print_plugin_info
@@ -319,9 +319,12 @@ module Fastlane
319
319
 
320
320
  # Prints a table all the plugins that were loaded
321
321
  def print_plugin_information(references)
322
+ no_action_found = false
323
+
322
324
  rows = references.collect do |current|
323
325
  if current[1][:actions].empty?
324
326
  # Something is wrong with this plugin, no available actions
327
+ no_action_found = true
325
328
  [current[0].red, current[1][:version_number], "No actions found".red]
326
329
  else
327
330
  [current[0], current[1][:version_number], current[1][:actions].join("\n")]
@@ -335,6 +338,13 @@ module Fastlane
335
338
  headings: ["Plugin", "Version", "Action"]
336
339
  }))
337
340
  puts("")
341
+
342
+ if no_action_found
343
+ puts("[!] No actions were found while loading one or more plugins".red)
344
+ puts(" Please use `bundle exec fastlane` with plugins".red)
345
+ puts(" More info - https://docs.fastlane.tools/plugins/using-plugins/#run-with-plugins".red)
346
+ puts("")
347
+ end
338
348
  end
339
349
 
340
350
  #####################################################
@@ -158,6 +158,7 @@ CrossPlatform/ForkUsage:
158
158
  Lint/IsStringUsage:
159
159
  Include:
160
160
  - gym/**/*
161
+ - supply/**/*
161
162
  Style/MethodCallWithArgsParentheses:
162
163
  Enabled: true
163
164
  IgnoredMethods:
@@ -252,13 +252,13 @@ module Fastlane
252
252
  puts(class_ref.deprecated_notes.to_s.remove_markdown.deprecated) if class_ref.deprecated_notes
253
253
  puts("==========================================\n".deprecated)
254
254
  end
255
- class_ref.runner = self # needed to call another action form an action
255
+ class_ref.runner = self # needed to call another action from an action
256
256
  return class_ref.run(arguments)
257
257
  end
258
258
  end
259
259
  rescue Interrupt => e
260
260
  raise e # reraise the interruption to avoid logging this as a crash
261
- rescue FastlaneCore::Interface::FastlaneCommonException => e # these are exceptions that we dont count as crashes
261
+ rescue FastlaneCore::Interface::FastlaneCommonException => e # these are exceptions that we don't count as crashes
262
262
  raise e
263
263
  rescue FastlaneCore::Interface::FastlaneError => e # user_error!
264
264
  action_completed(method_sym.to_s, status: FastlaneCore::ActionCompletionStatus::USER_ERROR, exception: e)
@@ -55,7 +55,7 @@ module Fastlane
55
55
 
56
56
  self.package_name = UI.input("Package Name (com.krausefx.app): ")
57
57
  puts("")
58
- puts("To automatically upload builds and metadata to Google Play, fastlane needs a service action json secret file".yellow)
58
+ puts("To automatically upload builds and metadata to Google Play, fastlane needs a service account json secret file".yellow)
59
59
  puts("Follow the Setup Guide on how to get the Json file: https://docs.fastlane.tools/actions/supply/".yellow)
60
60
  puts("Feel free to press Enter at any time in order to skip providing pieces of information when asked")
61
61
  self.json_key_file = UI.input("Path to the json secret file: ")
@@ -439,13 +439,17 @@ func parseInt(fromString: String, function: String = #function) -> Int {
439
439
  if self.tools_option_files.include?(action_name.to_s.downcase)
440
440
  tool_swift_function = ToolSwiftFunction.new(
441
441
  action_name: action_name,
442
+ action_description: action.description,
443
+ action_details: action.details,
442
444
  keys: keys,
443
445
  key_descriptions: key_descriptions,
444
446
  key_default_values: key_default_values,
445
447
  key_optionality_values: key_optionality_values,
446
448
  key_type_overrides: key_type_overrides,
447
449
  key_is_strings: key_is_strings,
448
- return_type: action_return_type
450
+ return_type: action_return_type,
451
+ return_value: action.return_value,
452
+ sample_return_value: action.sample_return_value
449
453
  )
450
454
  generated_protocol_file_path = generate_tool_protocol(tool_swift_function: tool_swift_function)
451
455
  self.generated_paths << generated_protocol_file_path unless generated_protocol_file_path.nil?
@@ -453,13 +457,17 @@ func parseInt(fromString: String, function: String = #function) -> Int {
453
457
  else
454
458
  return SwiftFunction.new(
455
459
  action_name: action_name,
460
+ action_description: action.description,
461
+ action_details: action.details,
456
462
  keys: keys,
457
463
  key_descriptions: key_descriptions,
458
464
  key_default_values: key_default_values,
459
465
  key_optionality_values: key_optionality_values,
460
466
  key_type_overrides: key_type_overrides,
461
467
  key_is_strings: key_is_strings,
462
- return_type: action_return_type
468
+ return_type: action_return_type,
469
+ return_value: action.return_value,
470
+ sample_return_value: action.sample_return_value
463
471
  )
464
472
  end
465
473
  end
@@ -1,7 +1,11 @@
1
1
  module Fastlane
2
2
  class SwiftFunction
3
3
  attr_accessor :function_name
4
+ attr_accessor :function_description
5
+ attr_accessor :function_details
4
6
  attr_accessor :return_type
7
+ attr_accessor :return_value
8
+ attr_accessor :sample_return_value
5
9
  attr_accessor :param_names
6
10
  attr_accessor :param_descriptions
7
11
  attr_accessor :param_default_values
@@ -11,14 +15,18 @@ module Fastlane
11
15
  attr_accessor :reserved_words
12
16
  attr_accessor :default_values_to_ignore
13
17
 
14
- def initialize(action_name: nil, keys: nil, key_descriptions: nil, key_default_values: nil, key_optionality_values: nil, key_type_overrides: nil, key_is_strings: nil, return_type: nil)
18
+ def initialize(action_name: nil, action_description: nil, action_details: nil, keys: nil, key_descriptions: nil, key_default_values: nil, key_optionality_values: nil, key_type_overrides: nil, key_is_strings: nil, return_type: nil, return_value: nil, sample_return_value: nil)
15
19
  @function_name = action_name
20
+ @function_description = action_description
21
+ @function_details = action_details
16
22
  @param_names = keys
17
23
  @param_descriptions = key_descriptions
18
24
  @param_default_values = key_default_values
19
25
  @param_optionality_values = key_optionality_values
20
26
  @param_is_strings = key_is_strings
21
27
  @return_type = return_type
28
+ @return_value = non_empty(string: return_value)
29
+ @sample_return_value = non_empty(string: sample_return_value)
22
30
  @param_type_overrides = key_type_overrides
23
31
 
24
32
  # rubocop:disable LineLength
@@ -34,6 +42,14 @@ module Fastlane
34
42
  return "`#{word}`"
35
43
  end
36
44
 
45
+ def non_empty(string: nil)
46
+ if string.nil? || string.to_s.empty?
47
+ return nil
48
+ else
49
+ return string
50
+ end
51
+ end
52
+
37
53
  def return_declaration
38
54
  expected_type = swift_type_for_return_type
39
55
  unless expected_type.to_s.length > 0
@@ -178,7 +194,54 @@ module Fastlane
178
194
  indent = ' ' * (discardable_result.length + function_name.length + function_keyword_definition.length + open_paren.length)
179
195
  params = self.parameters.join(",\n#{indent}")
180
196
 
181
- return "#{discardable_result}#{function_keyword_definition}#{function_name}#{open_paren}#{params}#{closed_paren}#{function_return_declaration} {\n#{self.implementation}\n}"
197
+ return "#{swift_documentation}#{discardable_result}#{function_keyword_definition}#{function_name}#{open_paren}#{params}#{closed_paren}#{function_return_declaration} {\n#{self.implementation}\n}\n"
198
+ end
199
+
200
+ def swift_documentation
201
+ has_parameters = @param_names && @param_names.length > 0
202
+ unless @function_description || @function_details || has_parameters
203
+ return ''
204
+ end
205
+
206
+ description = " #{fix_documentation_indentation(string: @function_description)}" if @function_description
207
+ details = " #{fix_documentation_indentation(string: @function_details)}" if @function_details
208
+ separator = ''
209
+ documentation_elements = [description, swift_parameter_documentation, swift_return_value_documentation, details].compact
210
+ # Adds newlines between each documentation element.
211
+ documentation = documentation_elements.flat_map { |element| [element, separator] }.tap(&:pop).join("\n")
212
+
213
+ return "/**\n#{documentation}\n*/\n"
214
+ end
215
+
216
+ def swift_parameter_documentation
217
+ unless @param_names && @param_names.length > 0
218
+ return nil
219
+ end
220
+
221
+ names_and_descriptions = @param_names.zip(@param_descriptions)
222
+
223
+ if @param_names.length == 1
224
+ detail_strings = names_and_descriptions.map { |name, description| " - parameter #{camel_case_lower(string: name)}: #{description}" }
225
+ return detail_strings.first
226
+ else
227
+ detail_strings = names_and_descriptions.map { |name, description| " - #{camel_case_lower(string: name)}: #{description}" }
228
+ return " - parameters:\n#{detail_strings.join("\n")}"
229
+ end
230
+ end
231
+
232
+ def swift_return_value_documentation
233
+ unless @return_value
234
+ return nil
235
+ end
236
+
237
+ sample = ". Example: #{@sample_return_value}" if @sample_return_value
238
+
239
+ return " - returns: #{return_value}#{sample}"
240
+ end
241
+
242
+ def fix_documentation_indentation(string: nil)
243
+ indent = ' '
244
+ string.gsub("\n", "\n#{indent}")
182
245
  end
183
246
 
184
247
  def build_argument_list
@@ -248,12 +311,18 @@ module Fastlane
248
311
  unless @param_names
249
312
  return []
250
313
  end
251
- swift_vars = @param_names.zip(param_default_values, param_optionality_values, param_type_overrides).map do |param, default_value, optional, param_type_override|
314
+ swift_vars = @param_names.zip(param_default_values, param_optionality_values, param_type_overrides, param_descriptions).map do |param, default_value, optional, param_type_override, param_description|
252
315
  type = get_type(param: param, default_value: default_value, optional: optional, param_type_override: param_type_override)
253
316
 
254
317
  param = camel_case_lower(string: param)
255
318
  param = sanitize_reserved_word(word: param)
256
319
  static_var_for_parameter_name = param
320
+
321
+ if param_description
322
+ documentation = " /// #{param_description}\n"
323
+ end
324
+
325
+ "\n#{documentation}"\
257
326
  " var #{static_var_for_parameter_name}: #{type} { get }"
258
327
  end
259
328