fastlane 2.128.1 → 2.133.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +72 -72
  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/deliver/lib/deliver/submit_for_review.rb +1 -1
  7. data/fastlane/lib/fastlane.rb +4 -1
  8. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  9. data/fastlane/lib/fastlane/actions/actions_helper.rb +4 -0
  10. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +11 -3
  11. data/fastlane/lib/fastlane/actions/appetize_viewing_url_generator.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/automatic_code_signing.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/carthage.rb +4 -3
  14. data/fastlane/lib/fastlane/actions/commit_github_file.rb +1 -1
  15. data/fastlane/lib/fastlane/actions/copy_artifacts.rb +1 -1
  16. data/fastlane/lib/fastlane/actions/danger.rb +7 -0
  17. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +23 -4
  18. data/fastlane/lib/fastlane/actions/download_dsyms.rb +35 -9
  19. data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +58 -0
  20. data/fastlane/lib/fastlane/actions/get_version_number.rb +21 -2
  21. data/fastlane/lib/fastlane/actions/github_api.rb +1 -1
  22. data/fastlane/lib/fastlane/actions/gradle.rb +37 -8
  23. data/fastlane/lib/fastlane/actions/import_from_git.rb +1 -1
  24. data/fastlane/lib/fastlane/actions/onesignal.rb +59 -29
  25. data/fastlane/lib/fastlane/actions/pod_push.rb +29 -10
  26. data/fastlane/lib/fastlane/actions/puts.rb +1 -1
  27. data/fastlane/lib/fastlane/actions/register_devices.rb +38 -22
  28. data/fastlane/lib/fastlane/actions/resign.rb +2 -2
  29. data/fastlane/lib/fastlane/actions/slather.rb +1 -0
  30. data/fastlane/lib/fastlane/actions/sonar.rb +18 -0
  31. data/fastlane/lib/fastlane/actions/update_fastlane.rb +1 -1
  32. data/fastlane/lib/fastlane/commands_generator.rb +17 -1
  33. data/fastlane/lib/fastlane/fast_file.rb +7 -2
  34. data/fastlane/lib/fastlane/helper/adb_helper.rb +5 -0
  35. data/fastlane/lib/fastlane/helper/crashlytics_helper.rb +12 -6
  36. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +2 -0
  37. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +3 -0
  38. data/fastlane/lib/fastlane/setup/setup_android.rb +1 -1
  39. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +126 -34
  40. data/fastlane/lib/fastlane/swift_fastlane_function.rb +82 -9
  41. data/fastlane/lib/fastlane/swift_runner_upgrader.rb +4 -0
  42. data/fastlane/lib/fastlane/version.rb +1 -1
  43. data/fastlane/swift/Actions.swift +15 -0
  44. data/fastlane/swift/Deliverfile.swift +1 -1
  45. data/fastlane/swift/DeliverfileProtocol.swift +121 -1
  46. data/fastlane/swift/Fastlane.swift +4164 -291
  47. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +9 -0
  48. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  49. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  50. data/fastlane/swift/Gymfile.swift +1 -1
  51. data/fastlane/swift/GymfileProtocol.swift +93 -11
  52. data/fastlane/swift/Matchfile.swift +1 -1
  53. data/fastlane/swift/MatchfileProtocol.swift +65 -1
  54. data/fastlane/swift/Plugins.swift +15 -0
  55. data/fastlane/swift/Precheckfile.swift +1 -1
  56. data/fastlane/swift/PrecheckfileProtocol.swift +15 -2
  57. data/fastlane/swift/Scanfile.swift +1 -1
  58. data/fastlane/swift/ScanfileProtocol.swift +111 -3
  59. data/fastlane/swift/Screengrabfile.swift +1 -1
  60. data/fastlane/swift/ScreengrabfileProtocol.swift +39 -2
  61. data/fastlane/swift/Snapshotfile.swift +1 -1
  62. data/fastlane/swift/SnapshotfileProtocol.swift +71 -1
  63. data/fastlane/swift/upgrade_manifest.json +1 -1
  64. data/fastlane_core/lib/fastlane_core/analytics/analytics_event_builder.rb +1 -1
  65. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -1
  66. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -1
  67. data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
  68. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +1 -3
  69. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +3 -2
  70. data/frameit/lib/frameit/editor.rb +1 -1
  71. data/frameit/lib/frameit/screenshot.rb +4 -0
  72. data/gym/lib/gym/.runner.rb.swp +0 -0
  73. data/gym/lib/gym/generators/build_command_generator.rb +5 -1
  74. data/gym/lib/gym/options.rb +17 -17
  75. data/gym/lib/gym/runner.rb +33 -5
  76. data/match/lib/match/generator.rb +1 -0
  77. data/match/lib/match/importer.rb +1 -1
  78. data/match/lib/match/module.rb +2 -0
  79. data/match/lib/match/nuke.rb +6 -6
  80. data/match/lib/match/options.rb +17 -0
  81. data/match/lib/match/runner.rb +12 -8
  82. data/match/lib/match/storage/git_storage.rb +8 -2
  83. data/match/lib/match/storage/google_cloud_storage.rb +85 -33
  84. data/match/lib/match/storage/interface.rb +1 -1
  85. data/produce/lib/produce/service.rb +7 -1
  86. data/scan/lib/scan/options.rb +1 -1
  87. data/scan/lib/scan/runner.rb +1 -1
  88. data/sigh/lib/sigh/download_all.rb +48 -8
  89. data/sigh/lib/sigh/runner.rb +13 -5
  90. data/snapshot/lib/assets/SnapshotHelper.swift +3 -3
  91. data/snapshot/lib/snapshot/commands_generator.rb +2 -2
  92. data/snapshot/lib/snapshot/options.rb +5 -0
  93. data/snapshot/lib/snapshot/reports_generator.rb +3 -0
  94. data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
  95. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +1 -1
  96. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +16 -1
  97. data/snapshot/lib/snapshot/update.rb +4 -2
  98. data/spaceship/lib/spaceship/client.rb +1 -1
  99. data/spaceship/lib/spaceship/connect_api/models/app.rb +6 -6
  100. data/spaceship/lib/spaceship/connect_api/models/beta_tester_metric.rb +1 -0
  101. data/spaceship/lib/spaceship/connect_api/models/build.rb +3 -3
  102. data/spaceship/lib/spaceship/connect_api/models/build_delivery.rb +1 -1
  103. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +1 -1
  104. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +1 -1
  105. data/spaceship/lib/spaceship/connect_api/models/device.rb +1 -1
  106. data/spaceship/lib/spaceship/connect_api/models/profile.rb +1 -1
  107. data/spaceship/lib/spaceship/du/du_client.rb +4 -0
  108. data/spaceship/lib/spaceship/portal/.certificate.rb.swp +0 -0
  109. data/spaceship/lib/spaceship/portal/certificate.rb +15 -1
  110. data/spaceship/lib/spaceship/portal/provisioning_profile.rb +1 -1
  111. data/spaceship/lib/spaceship/spaceauth_runner.rb +1 -1
  112. data/spaceship/lib/spaceship/test_flight/tester.rb +1 -1
  113. data/spaceship/lib/spaceship/tunes/app_version.rb +4 -0
  114. data/spaceship/lib/spaceship/tunes/application.rb +4 -0
  115. data/spaceship/lib/spaceship/tunes/availability.rb +40 -8
  116. data/spaceship/lib/spaceship/tunes/b2b_organization.rb +50 -0
  117. data/spaceship/lib/spaceship/tunes/build_details.rb +160 -18
  118. data/spaceship/lib/spaceship/tunes/display_family.rb +3 -3
  119. data/spaceship/lib/spaceship/tunes/iap.rb +2 -0
  120. data/spaceship/lib/spaceship/tunes/iap_detail.rb +17 -0
  121. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +10 -2
  122. data/spaceship/lib/spaceship/tunes/tunes_client.rb +63 -2
  123. data/supply/lib/supply/client.rb +1 -1
  124. metadata +54 -47
@@ -47,6 +47,10 @@ module Fastlane
47
47
  command << "--verbose"
48
48
  end
49
49
 
50
+ if params[:use_modular_headers]
51
+ command << "--use-modular-headers"
52
+ end
53
+
50
54
  result = Actions.sh(command.join(' '))
51
55
  UI.success("Successfully pushed Podspec ⬆️ ")
52
56
  return result
@@ -65,25 +69,30 @@ module Fastlane
65
69
  FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
66
70
  description: "Use bundle exec when there is a Gemfile presented",
67
71
  type: Boolean,
68
- default_value: false),
72
+ default_value: false,
73
+ env_name: "FL_POD_PUSH_USE_BUNDLE_EXEC"),
69
74
  FastlaneCore::ConfigItem.new(key: :path,
70
75
  description: "The Podspec you want to push",
71
76
  optional: true,
72
77
  verify_block: proc do |value|
73
78
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
74
79
  UI.user_error!("File must be a `.podspec` or `.podspec.json`") unless value.end_with?(".podspec", ".podspec.json")
75
- end),
80
+ end,
81
+ env_name: "FL_POD_PUSH_PATH"),
76
82
  FastlaneCore::ConfigItem.new(key: :repo,
77
83
  description: "The repo you want to push. Pushes to Trunk by default",
78
- optional: true),
84
+ optional: true,
85
+ env_name: "FL_POD_PUSH_REPO"),
79
86
  FastlaneCore::ConfigItem.new(key: :allow_warnings,
80
87
  description: "Allow warnings during pod push",
81
88
  optional: true,
82
- type: Boolean),
89
+ type: Boolean,
90
+ env_name: "FL_POD_PUSH_ALLOW_WARNINGS"),
83
91
  FastlaneCore::ConfigItem.new(key: :use_libraries,
84
92
  description: "Allow lint to use static libraries to install the spec",
85
93
  optional: true,
86
- type: Boolean),
94
+ type: Boolean,
95
+ env_name: "FL_POD_PUSH_USE_LIBRARIES"),
87
96
  FastlaneCore::ConfigItem.new(key: :sources,
88
97
  description: "The sources of repos you want the pod spec to lint with, separated by commas",
89
98
  optional: true,
@@ -91,24 +100,34 @@ module Fastlane
91
100
  type: Array,
92
101
  verify_block: proc do |value|
93
102
  UI.user_error!("Sources must be an array.") unless value.kind_of?(Array)
94
- end),
103
+ end,
104
+ env_name: "FL_POD_PUSH_SOURCES"),
95
105
  FastlaneCore::ConfigItem.new(key: :swift_version,
96
106
  description: "The SWIFT_VERSION that should be used to lint the spec. This takes precedence over a .swift-version file",
97
107
  optional: true,
98
- is_string: true),
108
+ is_string: true,
109
+ env_name: "FL_POD_PUSH_SWIFT_VERSION"),
99
110
  FastlaneCore::ConfigItem.new(key: :skip_import_validation,
100
111
  description: "Lint skips validating that the pod can be imported",
101
112
  optional: true,
102
- type: Boolean),
113
+ type: Boolean,
114
+ env_name: "FL_POD_PUSH_SKIP_IMPORT_VALIDATION"),
103
115
  FastlaneCore::ConfigItem.new(key: :skip_tests,
104
116
  description: "Lint skips building and running tests during validation",
105
117
  optional: true,
106
- type: Boolean),
118
+ type: Boolean,
119
+ env_name: "FL_POD_PUSH_SKIP_TESTS"),
107
120
  FastlaneCore::ConfigItem.new(key: :verbose,
108
121
  description: "Show more debugging information",
109
122
  optional: true,
110
123
  type: Boolean,
111
- default_value: false)
124
+ default_value: false,
125
+ env_name: "FL_POD_PUSH_VERBOSE"),
126
+ FastlaneCore::ConfigItem.new(key: :use_modular_headers,
127
+ description: "Use modular headers option during validation",
128
+ optional: true,
129
+ type: Boolean,
130
+ env_name: "FL_POD_PUSH_USE_MODULAR_HEADERS")
112
131
  ]
113
132
  end
114
133
 
@@ -9,7 +9,7 @@ module Fastlane
9
9
  return
10
10
  end
11
11
 
12
- # no paramter included in the call means treat this like a normal fastlane ruby call
12
+ # no parameter included in the call means treat this like a normal fastlane ruby call
13
13
  UI.message(params.join(' '))
14
14
  end
15
15
 
@@ -7,41 +7,53 @@ module Fastlane
7
7
  [:ios, :mac].include?(platform)
8
8
  end
9
9
 
10
+ def self.file_column_headers
11
+ ['Device ID', 'Device Name', 'Device Platform']
12
+ end
13
+
10
14
  def self.run(params)
11
- require 'spaceship'
15
+ if params[:devices]
16
+ new_devices = params[:devices].map do |name, udid|
17
+ [udid, name]
18
+ end
19
+ elsif params[:devices_file]
20
+ require 'csv'
12
21
 
13
- devices = params[:devices]
14
- devices_file = params[:devices_file]
22
+ devices_file = CSV.read(File.expand_path(File.join(params[:devices_file])), col_sep: "\t")
23
+ unless devices_file.first == file_column_headers.first(2) || devices_file.first == file_column_headers
24
+ UI.user_error!("Please provide a file according to the Apple Sample UDID file (https://developer.apple.com/account/resources/downloads/Multiple-Upload-Samples.zip)")
25
+ end
15
26
 
16
- mac = params[:platform] == "mac"
27
+ new_devices = devices_file.drop(1).map do |row|
28
+ UI.user_error!("Invalid device line, please provide a file according to the Apple Sample UDID file (https://developer.apple.com/account/resources/downloads/Multiple-Upload-Samples.zip)") unless (2..3).cover?(row.count)
29
+ row
30
+ end
31
+ else
32
+ UI.user_error!("You must pass either a valid `devices` or `devices_file`. Please check the readme.")
33
+ end
17
34
 
35
+ require 'spaceship'
18
36
  credentials = CredentialsManager::AccountManager.new(user: params[:username])
19
37
  Spaceship.login(credentials.user, credentials.password)
20
38
  Spaceship.select_team
21
39
 
22
40
  UI.message("Fetching list of currently registered devices...")
23
- existing_devices = Spaceship::Device.all(mac: mac)
24
-
25
- if devices
26
- device_objs = devices.map do |k, v|
27
- next if existing_devices.map(&:udid).include?(v)
28
- try_create_device(name: k, udid: v, mac: mac)
29
- end
30
- elsif devices_file
31
- require 'csv'
41
+ all_platforms = Set[params[:platform]]
42
+ new_devices.each do |device|
43
+ next if device[2].nil?
44
+ all_platforms.add(device[2])
45
+ end
46
+ supported_platforms = all_platforms.select { |platform| self.is_supported?(platform.to_sym) }
32
47
 
33
- devices_file = CSV.read(File.expand_path(File.join(devices_file)), col_sep: "\t")
34
- UI.user_error!("Please provide a file according to the Apple Sample UDID file (https://devimages.apple.com.edgekey.net/downloads/devices/Multiple-Upload-Samples.zip)") unless devices_file.first == ['Device ID', 'Device Name']
48
+ existing_devices = supported_platforms.flat_map { |platform| Spaceship::Device.all(mac: platform == "mac") }
35
49
 
36
- device_objs = devices_file.drop(1).map do |device|
37
- next if existing_devices.map(&:udid).include?(device[0])
50
+ device_objs = new_devices.map do |device|
51
+ next if existing_devices.map(&:udid).include?(device[0])
38
52
 
39
- UI.user_error!("Invalid device line, please provide a file according to the Apple Sample UDID file (http://devimages.apple.com/downloads/devices/Multiple-Upload-Samples.zip)") unless device.count == 2
53
+ device_platform_supported = !device[2].nil? && self.is_supported?(device[2].to_sym)
54
+ mac = (device_platform_supported ? device[2] : params[:platform]) == "mac"
40
55
 
41
- try_create_device(name: device[1], udid: device[0], mac: mac)
42
- end
43
- else
44
- UI.user_error!("You must pass either a valid `devices` or `devices_file`. Please check the readme.")
56
+ try_create_device(name: device[1], udid: device[0], mac: mac)
45
57
  end
46
58
 
47
59
  UI.success("Successfully registered new devices.")
@@ -55,6 +67,10 @@ module Fastlane
55
67
  UI.crash!("Failed to register new device (name: #{name}, UDID: #{udid})")
56
68
  end
57
69
 
70
+ #####################################################
71
+ # @!group Documentation
72
+ #####################################################
73
+
58
74
  def self.description
59
75
  "Registers new devices to the Apple Dev Portal"
60
76
  end
@@ -26,7 +26,7 @@ module Fastlane
26
26
  )',
27
27
  '# You may provide multiple provisioning profiles if the application contains nested
28
28
  # applications or app extensions, which need their own provisioning profile.
29
- # You can do so by passing an array of provisiong profile strings or a hash
29
+ # You can do so by passing an array of provisioning profile strings or a hash
30
30
  # that associates provisioning profile values to bundle identifier keys.
31
31
  resign(
32
32
  ipa: "path/to/ipa", # can omit if using the `ipa` action
@@ -75,7 +75,7 @@ module Fastlane
75
75
  else [value]
76
76
  end
77
77
  files.each do |file|
78
- UI.user_error!("Couldn't find provisiong profile at path '#{file}'") unless File.exist?(file)
78
+ UI.user_error!("Couldn't find provisioning profile at path '#{file}'") unless File.exist?(file)
79
79
  end
80
80
  end),
81
81
  FastlaneCore::ConfigItem.new(key: :version,
@@ -263,6 +263,7 @@ module Fastlane
263
263
  FastlaneCore::ConfigItem.new(key: :binary_file,
264
264
  env_name: "FL_SLATHER_BINARY_FILE",
265
265
  description: "Binary file name to be used for code coverage",
266
+ type: Array,
266
267
  skip_type_validation: true, # skipping validation for backwards compatibility with Boolean type
267
268
  optional: true),
268
269
  FastlaneCore::ConfigItem.new(key: :arch,
@@ -21,6 +21,9 @@ module Fastlane
21
21
  sonar_scanner_args << "-Dsonar.login=\"#{params[:sonar_login]}\"" if params[:sonar_login]
22
22
  sonar_scanner_args << "-Dsonar.host.url=\"#{params[:sonar_url]}\"" if params[:sonar_url]
23
23
  sonar_scanner_args << "-Dsonar.branch.name=\"#{params[:branch_name]}\"" if params[:branch_name]
24
+ sonar_scanner_args << "-Dsonar.pullrequest.branch=\"#{params[:pull_request_branch]}\"" if params[:pull_request_branch]
25
+ sonar_scanner_args << "-Dsonar.pullrequest.base=\"#{params[:pull_request_base]}\"" if params[:pull_request_base]
26
+ sonar_scanner_args << "-Dsonar.pullrequest.key=\"#{params[:pull_request_key]}\"" if params[:pull_request_key]
24
27
  sonar_scanner_args << params[:sonar_runner_args] if params[:sonar_runner_args]
25
28
 
26
29
  command = [
@@ -103,6 +106,21 @@ module Fastlane
103
106
  env_name: "FL_SONAR_RUNNER_BRANCH_NAME",
104
107
  description: "Pass the branch name which is getting scanned",
105
108
  optional: true,
109
+ is_string: true),
110
+ FastlaneCore::ConfigItem.new(key: :pull_request_branch,
111
+ env_name: "FL_SONAR_RUNNER_PULL_REQUEST_BRANCH",
112
+ description: "The name of the branch that contains the changes to be merged",
113
+ optional: true,
114
+ is_string: true),
115
+ FastlaneCore::ConfigItem.new(key: :pull_request_base,
116
+ env_name: "FL_SONAR_RUNNER_PULL_REQUEST_BASE",
117
+ description: "The long-lived branch into which the PR will be merged",
118
+ optional: true,
119
+ is_string: true),
120
+ FastlaneCore::ConfigItem.new(key: :pull_request_key,
121
+ env_name: "FL_SONAR_RUNNER_PULL_REQUEST_KEY",
122
+ description: "Unique identifier of your PR. Must correspond to the key of the PR in GitHub or TFS",
123
+ optional: true,
106
124
  is_string: true)
107
125
  ]
108
126
  end
@@ -31,7 +31,7 @@ module Fastlane
31
31
  UI.important("It seems that your Gem directory is not writable by your current user.")
32
32
  UI.important("fastlane would need sudo rights to update itself, however, running 'sudo fastlane' is not recommended.")
33
33
  UI.important("If you still want to use this action, please read the documentation on how to set this up:")
34
- UI.important("https://docs.fastlane.tools/actions/#update_fastlane")
34
+ UI.important("https://docs.fastlane.tools/actions/update_fastlane/")
35
35
  return
36
36
  end
37
37
 
@@ -43,7 +43,7 @@ module Fastlane
43
43
  Fastlane::PluginUpdateManager.show_update_status
44
44
  if FastlaneCore::Globals.capture_output?
45
45
  if $stdout.respond_to?(:string)
46
- # Sometimes you can get NoMethodError: undefined method `string' for #<IO:<STDOUT>> when runing with FastlaneRunner (swift)
46
+ # Sometimes you can get NoMethodError: undefined method `string' for #<IO:<STDOUT>> when running with FastlaneRunner (swift)
47
47
  FastlaneCore::Globals.captured_output = Helper.strip_ansi_colors($stdout.string)
48
48
  end
49
49
  $stdout = STDOUT
@@ -329,6 +329,22 @@ module Fastlane
329
329
  end
330
330
  end
331
331
 
332
+ #####################################################
333
+ # @!group Swift
334
+ #####################################################
335
+
336
+ if FastlaneCore::FastlaneFolder.swift?
337
+ command :generate_swift do |c|
338
+ c.syntax = 'fastlane generate_swift'
339
+ c.description = 'Generates additional Swift APIs for plugins and local actions'
340
+
341
+ c.action do |args, options|
342
+ SwiftActionsAPIGenerator.new(target_output_path: FastlaneCore::FastlaneFolder.swift_folder_path).generate_swift
343
+ SwiftPluginsAPIGenerator.new(target_output_path: FastlaneCore::FastlaneFolder.swift_folder_path).generate_swift
344
+ end
345
+ end
346
+ end
347
+
332
348
  default_command(:trigger)
333
349
  run!
334
350
  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)
@@ -31,6 +31,11 @@ module Fastlane
31
31
  end
32
32
 
33
33
  def device_avalaible?(serial)
34
+ UI.deprecated("Please use `device_available?` instead... This will be removed in a future version of fastlane")
35
+ device_available?(serial)
36
+ end
37
+
38
+ def device_available?(serial)
34
39
  load_all_devices
35
40
  return devices.map(&:serial).include?(serial)
36
41
  end
@@ -7,7 +7,7 @@ module Fastlane
7
7
  def discover_crashlytics_path(params)
8
8
  path = params[:crashlytics_path]
9
9
 
10
- # Finding submit binary inside of given Crashlytics path (for backwards compatability)
10
+ # Finding submit binary inside of given Crashlytics path (for backwards compatibility)
11
11
  if path
12
12
  if File.basename(path) != "submit"
13
13
  path = Dir[File.join(path, '**', 'submit')].last
@@ -86,7 +86,6 @@ module Fastlane
86
86
  containing = File.join(File.expand_path("~/Library"), "CrashlyticsAndroid")
87
87
  zip_path = File.join(containing, "crashlytics-devtools.zip")
88
88
  jar_path = File.join(containing, "crashlytics-devtools.jar")
89
- return jar_path if File.exist?(jar_path)
90
89
 
91
90
  url = "https://ssl-download-crashlytics-com.s3.amazonaws.com/android/ant/crashlytics.zip"
92
91
  require 'net/http'
@@ -94,19 +93,26 @@ module Fastlane
94
93
  FileUtils.mkdir_p(containing)
95
94
 
96
95
  begin
97
- UI.important("Downloading Crashlytics Support Library - this might take a minute...")
98
-
99
96
  # Work around ruby defect, where HTTP#get_response and HTTP#post_form don't use ENV proxy settings
100
97
  # https://bugs.ruby-lang.org/issues/12724
101
98
  uri = URI(url)
102
99
  http_conn = Net::HTTP.new(uri.host, uri.port)
103
100
  http_conn.use_ssl = true
101
+ result = http_conn.request_head(uri.path)
102
+
103
+ # ETag is returned with quotes, which net/http does not handle. Clean that up
104
+ etag = result['ETag'] && result['ETag'].tr('"', '')
105
+
106
+ # This is a no-op if the current version on disk matches the file on S3
107
+ return jar_path if File.exist?(zip_path) && etag == Digest::MD5.file(zip_path).hexdigest
108
+
109
+ UI.important("Downloading Crashlytics Support Library - this might take a minute...")
104
110
  result = http_conn.request_get(uri.path)
105
- UI.error!("#{result.message} (#{result.code})") unless result.kind_of?(Net::HTTPSuccess)
111
+ UI.error("#{result.message} (#{result.code})") unless result.kind_of?(Net::HTTPSuccess)
106
112
  File.write(zip_path, result.body)
107
113
 
108
114
  # Now unzip the file
109
- Action.sh("unzip '#{zip_path}' -d '#{containing}'")
115
+ Action.sh("unzip -o '#{zip_path}' -d '#{containing}'")
110
116
 
111
117
  UI.user_error!("Couldn't find 'crashlytics-devtools.jar'") unless File.exist?(jar_path)
112
118
 
@@ -178,6 +178,7 @@ module Fastlane
178
178
  with_clean_bundler_env do
179
179
  cmd = "bundle install"
180
180
  cmd << " --quiet" unless FastlaneCore::Globals.verbose?
181
+ cmd << " && bundle exec fastlane generate_swift" if FastlaneCore::FastlaneFolder.swift?
181
182
  cmd << " && echo 'Successfully installed plugins'"
182
183
  UI.command(cmd) if FastlaneCore::Globals.verbose?
183
184
  exec(cmd)
@@ -197,6 +198,7 @@ module Fastlane
197
198
  cmd = "bundle update"
198
199
  cmd << " #{plugins.join(' ')}"
199
200
  cmd << " --quiet" unless FastlaneCore::Globals.verbose?
201
+ cmd << " && bundle exec fastlane generate_swift" if FastlaneCore::FastlaneFolder.swift?
200
202
  cmd << " && echo 'Successfully updated plugins'"
201
203
  UI.command(cmd) if FastlaneCore::Globals.verbose?
202
204
  exec(cmd)
@@ -155,6 +155,9 @@ Style/CollectionMethods:
155
155
  CrossPlatform/ForkUsage:
156
156
  Exclude:
157
157
  - "**/plugins/template/**/*"
158
+ Lint/IsStringUsage:
159
+ Include:
160
+ - gym/**/*
158
161
  Style/MethodCallWithArgsParentheses:
159
162
  Enabled: true
160
163
  IgnoredMethods:
@@ -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: ")
@@ -13,28 +13,18 @@ module Fastlane
13
13
  end
14
14
  end
15
15
 
16
- class SwiftFastlaneAPIGenerator
17
- DEFAULT_API_VERSION_STRING = "0.9.1"
18
- attr_accessor :tools_option_files
19
- attr_accessor :actions_not_supported
20
- attr_accessor :action_options_to_ignore
21
- attr_accessor :target_output_path
22
- attr_accessor :generated_paths # stores all file names of generated files (as they are generated)
16
+ class SwiftAPIGenerator
17
+ end
23
18
 
19
+ class SwiftFastlaneAPIGenerator < SwiftAPIGenerator
24
20
  def initialize(target_output_path: "swift")
21
+ @target_filename = "Fastlane.swift"
25
22
  @target_output_path = File.expand_path(target_output_path)
26
23
  @generated_paths = []
27
- require 'fastlane'
28
- require 'fastlane/documentation/actions_list'
29
- Fastlane.load_actions
30
- # Tools that can be used with <Toolname>file, like Deliverfile, Screengrabfile
31
- # this is important because we need to generate the proper api for these by creating a protocol
32
- # with default implementation we can use in the Fastlane.swift API if people want to use
33
- # <Toolname>file.swift files.
34
- self.tools_option_files = TOOL_CONFIG_FILES.map { |config_file| config_file.downcase.chomp("file") }.to_set
35
24
 
36
- self.actions_not_supported = ["import", "import_from_git"].to_set
25
+ super()
37
26
 
27
+ self.actions_not_supported = ["import", "import_from_git"].to_set
38
28
  self.action_options_to_ignore = {
39
29
 
40
30
  "precheck" => [
@@ -51,6 +41,109 @@ module Fastlane
51
41
  }
52
42
  end
53
43
 
44
+ def extend_content(file_content, tool_details)
45
+ file_content << "" # newline because we're adding an extension
46
+ file_content << "// These are all the parsing functions needed to transform our data into the expected types"
47
+ file_content << generate_lanefile_parsing_functions
48
+
49
+ tool_objects = generate_lanefile_tool_objects(classes: tool_details.map(&:swift_class))
50
+ file_content << tool_objects
51
+
52
+ old_file_content = File.read(fastlane_swift_api_path)
53
+ new_file_content = file_content.join("\n")
54
+
55
+ # compare old file content to potential new file content
56
+ api_version = determine_api_version(new_file_content: new_file_content, old_file_content: old_file_content)
57
+ old_api_version = find_api_version_string(content: old_file_content)
58
+
59
+ # if there is a change, we need to write out the new file
60
+ if api_version != old_api_version
61
+ file_content << autogen_version_warning_text(api_version: api_version)
62
+ else
63
+ file_content = nil
64
+ end
65
+
66
+ return file_content
67
+ end
68
+ end
69
+
70
+ class SwiftActionsAPIGenerator < SwiftAPIGenerator
71
+ def initialize(target_output_path: "swift")
72
+ @target_filename = "Actions.swift"
73
+ @target_output_path = File.expand_path(target_output_path)
74
+ @generated_paths = []
75
+
76
+ super()
77
+
78
+ # Excludes all actions that aren't external actions (including plugins)
79
+ available_external_actions = Fastlane.external_actions || []
80
+ available_actions = []
81
+ ActionsList.all_actions do |action|
82
+ available_actions << action.action_name unless available_external_actions.include?(action)
83
+ end
84
+
85
+ self.actions_not_supported = (["import", "import_from_git"] + available_actions).to_set
86
+ self.action_options_to_ignore = {}
87
+ end
88
+ end
89
+
90
+ class SwiftPluginsAPIGenerator < SwiftAPIGenerator
91
+ def initialize(target_output_path: "swift")
92
+ @target_filename = "Plugins.swift"
93
+ @target_output_path = File.expand_path(target_output_path)
94
+ @generated_paths = []
95
+
96
+ super()
97
+
98
+ # Gets list of plugin actions
99
+ plugin_actions = Fastlane.plugin_manager.plugin_references.values.flat_map do |info|
100
+ info[:actions]
101
+ end
102
+
103
+ # Action references from plugins
104
+ available_plugins = plugin_actions.map do |plugin_action|
105
+ Fastlane::Runner.new.class_reference_from_action_name(plugin_action)
106
+ end
107
+
108
+ # Excludes all actions that aren't pluign actions (including external actions)
109
+ available_actions = []
110
+ ActionsList.all_actions do |action|
111
+ available_actions << action.action_name unless available_plugins.include?(action)
112
+ end
113
+
114
+ self.actions_not_supported = (["import", "import_from_git"] + available_actions).to_set
115
+ self.action_options_to_ignore = {}
116
+ end
117
+ end
118
+
119
+ class SwiftAPIGenerator
120
+ DEFAULT_API_VERSION_STRING = "0.9.1"
121
+ attr_accessor :tools_option_files
122
+ attr_accessor :actions_not_supported
123
+ attr_accessor :action_options_to_ignore
124
+ attr_accessor :target_output_path
125
+ attr_accessor :target_filename
126
+ attr_accessor :generated_paths # stores all file names of generated files (as they are generated)
127
+
128
+ attr_accessor :fastlane_swift_api_path
129
+
130
+ def initialize
131
+ require 'fastlane'
132
+ require 'fastlane/documentation/actions_list'
133
+ Fastlane.load_actions
134
+ # Tools that can be used with <Toolname>file, like Deliverfile, Screengrabfile
135
+ # this is important because we need to generate the proper api for these by creating a protocol
136
+ # with default implementation we can use in the Fastlane.swift API if people want to use
137
+ # <Toolname>file.swift files.
138
+ self.tools_option_files = TOOL_CONFIG_FILES.map { |config_file| config_file.downcase.chomp("file") }.to_set
139
+
140
+ @fastlane_swift_api_path = File.join(@target_output_path, @target_filename)
141
+ end
142
+
143
+ def extend_content(content, tool_details)
144
+ return content
145
+ end
146
+
54
147
  def generate_swift
55
148
  self.generated_paths = [] # reset generated paths in case we're called multiple times
56
149
  file_content = []
@@ -74,24 +167,11 @@ module Fastlane
74
167
 
75
168
  file_content << swift_function.swift_code
76
169
  end
77
- file_content << "" # newline because we're adding an extension
78
- file_content << "// These are all the parsing functions needed to transform our data into the expected types"
79
- file_content << generate_lanefile_parsing_functions
80
-
81
- tool_objects = generate_lanefile_tool_objects(classes: tool_details.map(&:swift_class))
82
- file_content << tool_objects
83
- new_file_content = file_content.join("\n")
84
-
85
- fastlane_swift_api_path = File.join(@target_output_path, "Fastlane.swift")
86
- old_file_content = File.read(fastlane_swift_api_path)
87
170
 
88
- # compare old file content to potential new file content
89
- api_version = determine_api_version(new_file_content: new_file_content, old_file_content: old_file_content)
90
- old_api_version = find_api_version_string(content: old_file_content)
171
+ file_content = extend_content(file_content, tool_details)
91
172
 
92
- # if there is a change, we need to write out the new file
93
- if api_version != old_api_version
94
- new_file_content.concat(autogen_version_warning_text(api_version: api_version))
173
+ if file_content
174
+ new_file_content = file_content.join("\n")
95
175
 
96
176
  File.write(fastlane_swift_api_path, new_file_content)
97
177
  UI.success(fastlane_swift_api_path)
@@ -337,6 +417,7 @@ func parseInt(fromString: String, function: String = #function) -> Int {
337
417
  key_default_values = []
338
418
  key_optionality_values = []
339
419
  key_type_overrides = []
420
+ key_is_strings = []
340
421
 
341
422
  if options.kind_of?(Array)
342
423
  options.each do |current|
@@ -350,6 +431,7 @@ func parseInt(fromString: String, function: String = #function) -> Int {
350
431
  key_default_values << current.code_gen_default_value
351
432
  key_optionality_values << current.optional
352
433
  key_type_overrides << current.data_type
434
+ key_is_strings << current.is_string
353
435
  end
354
436
  end
355
437
  action_return_type = action.return_type
@@ -357,12 +439,17 @@ func parseInt(fromString: String, function: String = #function) -> Int {
357
439
  if self.tools_option_files.include?(action_name.to_s.downcase)
358
440
  tool_swift_function = ToolSwiftFunction.new(
359
441
  action_name: action_name,
442
+ action_description: action.description,
443
+ action_details: action.details,
360
444
  keys: keys,
361
445
  key_descriptions: key_descriptions,
362
446
  key_default_values: key_default_values,
363
447
  key_optionality_values: key_optionality_values,
364
448
  key_type_overrides: key_type_overrides,
365
- return_type: action_return_type
449
+ key_is_strings: key_is_strings,
450
+ return_type: action_return_type,
451
+ return_value: action.return_value,
452
+ sample_return_value: action.sample_return_value
366
453
  )
367
454
  generated_protocol_file_path = generate_tool_protocol(tool_swift_function: tool_swift_function)
368
455
  self.generated_paths << generated_protocol_file_path unless generated_protocol_file_path.nil?
@@ -370,12 +457,17 @@ func parseInt(fromString: String, function: String = #function) -> Int {
370
457
  else
371
458
  return SwiftFunction.new(
372
459
  action_name: action_name,
460
+ action_description: action.description,
461
+ action_details: action.details,
373
462
  keys: keys,
374
463
  key_descriptions: key_descriptions,
375
464
  key_default_values: key_default_values,
376
465
  key_optionality_values: key_optionality_values,
377
466
  key_type_overrides: key_type_overrides,
378
- return_type: action_return_type
467
+ key_is_strings: key_is_strings,
468
+ return_type: action_return_type,
469
+ return_value: action.return_value,
470
+ sample_return_value: action.sample_return_value
379
471
  )
380
472
  end
381
473
  end