fastlane 2.198.0 → 2.201.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +88 -88
  4. data/deliver/lib/deliver/app_screenshot.rb +8 -0
  5. data/deliver/lib/deliver/app_screenshot_iterator.rb +1 -1
  6. data/fastlane/lib/.DS_Store +0 -0
  7. data/fastlane/lib/fastlane/.DS_Store +0 -0
  8. data/fastlane/lib/fastlane/actions/.DS_Store +0 -0
  9. data/fastlane/lib/fastlane/actions/download_dsyms.rb +26 -27
  10. data/fastlane/lib/fastlane/actions/ensure_xcode_version.rb +1 -1
  11. data/fastlane/lib/fastlane/actions/get_version_number.rb +1 -0
  12. data/fastlane/lib/fastlane/actions/trainer.rb +49 -0
  13. data/fastlane/lib/fastlane/actions/update_code_signing_settings.rb +18 -1
  14. data/fastlane/lib/fastlane/actions/xcversion.rb +18 -3
  15. data/fastlane/lib/fastlane/documentation/docs_generator.rb +17 -12
  16. data/fastlane/lib/fastlane/helper/xcodebuild_formatter_helper.rb +9 -0
  17. data/fastlane/lib/fastlane/tools.rb +2 -1
  18. data/fastlane/lib/fastlane/version.rb +1 -1
  19. data/fastlane/swift/Actions.swift +1 -1
  20. data/fastlane/swift/Appfile.swift +1 -1
  21. data/fastlane/swift/ArgumentProcessor.swift +1 -1
  22. data/fastlane/swift/ControlCommand.swift +1 -1
  23. data/fastlane/swift/Deliverfile.swift +2 -2
  24. data/fastlane/swift/DeliverfileProtocol.swift +2 -2
  25. data/fastlane/swift/Fastlane.swift +44 -15
  26. data/fastlane/swift/Gymfile.swift +2 -2
  27. data/fastlane/swift/GymfileProtocol.swift +6 -2
  28. data/fastlane/swift/LaneFileProtocol.swift +1 -1
  29. data/fastlane/swift/MainProcess.swift +1 -1
  30. data/fastlane/swift/Matchfile.swift +2 -2
  31. data/fastlane/swift/MatchfileProtocol.swift +2 -2
  32. data/fastlane/swift/OptionalConfigValue.swift +1 -1
  33. data/fastlane/swift/Plugins.swift +1 -1
  34. data/fastlane/swift/Precheckfile.swift +2 -2
  35. data/fastlane/swift/PrecheckfileProtocol.swift +2 -2
  36. data/fastlane/swift/RubyCommand.swift +1 -1
  37. data/fastlane/swift/RubyCommandable.swift +1 -1
  38. data/fastlane/swift/Runner.swift +4 -8
  39. data/fastlane/swift/RunnerArgument.swift +1 -1
  40. data/fastlane/swift/Scanfile.swift +2 -2
  41. data/fastlane/swift/ScanfileProtocol.swift +4 -4
  42. data/fastlane/swift/Screengrabfile.swift +2 -2
  43. data/fastlane/swift/ScreengrabfileProtocol.swift +2 -2
  44. data/fastlane/swift/Snapshotfile.swift +2 -2
  45. data/fastlane/swift/SnapshotfileProtocol.swift +2 -2
  46. data/fastlane/swift/SocketClient.swift +1 -1
  47. data/fastlane/swift/SocketClientDelegateProtocol.swift +1 -1
  48. data/fastlane/swift/SocketResponse.swift +1 -1
  49. data/fastlane/swift/formatting/Brewfile.lock.json +14 -14
  50. data/fastlane/swift/main.swift +1 -1
  51. data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +10 -5
  52. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +15 -5
  53. data/gym/lib/gym/generators/build_command_generator.rb +69 -23
  54. data/gym/lib/gym/options.rb +23 -5
  55. data/scan/lib/scan/options.rb +27 -7
  56. data/scan/lib/scan/runner.rb +58 -15
  57. data/scan/lib/scan/test_command_generator.rb +54 -5
  58. data/snapshot/lib/snapshot/options.rb +23 -7
  59. data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +1 -1
  60. data/snapshot/lib/snapshot/test_command_generator.rb +37 -2
  61. data/spaceship/lib/spaceship/client.rb +35 -15
  62. data/spaceship/lib/spaceship/commands_generator.rb +1 -1
  63. data/spaceship/lib/spaceship/connect_api/models/app.rb +43 -0
  64. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  65. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +2 -0
  66. data/spaceship/lib/spaceship/connect_api/models/review_submission.rb +73 -0
  67. data/spaceship/lib/spaceship/connect_api/models/review_submission_item.rb +40 -0
  68. data/spaceship/lib/spaceship/connect_api/response.rb +13 -0
  69. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +83 -0
  70. data/spaceship/lib/spaceship/connect_api.rb +2 -0
  71. data/spaceship/lib/spaceship/globals.rb +9 -0
  72. data/spaceship/lib/spaceship/spaceauth_runner.rb +1 -1
  73. data/supply/lib/supply/options.rb +8 -0
  74. data/supply/lib/supply/uploader.rb +6 -2
  75. data/trainer/lib/.DS_Store +0 -0
  76. data/trainer/lib/assets/junit.xml.erb +20 -0
  77. data/trainer/lib/trainer/commands_generator.rb +51 -0
  78. data/trainer/lib/trainer/junit_generator.rb +31 -0
  79. data/trainer/lib/trainer/module.rb +10 -0
  80. data/trainer/lib/trainer/options.rb +55 -0
  81. data/trainer/lib/trainer/test_parser.rb +335 -0
  82. data/trainer/lib/trainer/xcresult.rb +403 -0
  83. data/trainer/lib/trainer.rb +7 -0
  84. metadata +38 -21
@@ -1,5 +1,5 @@
1
1
  // RunnerArgument.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  //
5
5
  // ** NOTE **
@@ -1,5 +1,5 @@
1
1
  // Scanfile.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  // This class is automatically included in FastlaneRunner during build
5
5
 
@@ -17,4 +17,4 @@ public class Scanfile: ScanfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.198.0
20
+ // Generated with fastlane 2.200.0
@@ -1,5 +1,5 @@
1
1
  // ScanfileProtocol.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  public protocol ScanfileProtocol: class {
5
5
  /// Path to the workspace file
@@ -14,10 +14,10 @@ public protocol ScanfileProtocol: class {
14
14
  /// The project's scheme. Make sure it's marked as `Shared`
15
15
  var scheme: String? { get }
16
16
 
17
- /// The name of the simulator type you want to run tests on (e.g. 'iPhone 6')
17
+ /// The name of the simulator type you want to run tests on (e.g. 'iPhone 6' or 'iPhone SE (2nd generation) (14.5)')
18
18
  var device: String? { get }
19
19
 
20
- /// Array of devices to run the tests on (e.g. ['iPhone 6', 'iPad Air'])
20
+ /// Array of devices to run the tests on (e.g. ['iPhone 6', 'iPad Air', 'iPhone SE (2nd generation) (14.5)'])
21
21
  var devices: [String]? { get }
22
22
 
23
23
  /// Should skip auto detecting of devices if none were specified
@@ -296,4 +296,4 @@ public extension ScanfileProtocol {
296
296
 
297
297
  // Please don't remove the lines below
298
298
  // They are used to detect outdated files
299
- // FastlaneRunnerAPIVersion [0.9.95]
299
+ // FastlaneRunnerAPIVersion [0.9.98]
@@ -1,5 +1,5 @@
1
1
  // Screengrabfile.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  // This class is automatically included in FastlaneRunner during build
5
5
 
@@ -17,4 +17,4 @@ public class Screengrabfile: ScreengrabfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.198.0
20
+ // Generated with fastlane 2.200.0
@@ -1,5 +1,5 @@
1
1
  // ScreengrabfileProtocol.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  public protocol ScreengrabfileProtocol: class {
5
5
  /// Path to the root of your Android SDK installation, e.g. ~/tools/android-sdk-macosx
@@ -96,4 +96,4 @@ public extension ScreengrabfileProtocol {
96
96
 
97
97
  // Please don't remove the lines below
98
98
  // They are used to detect outdated files
99
- // FastlaneRunnerAPIVersion [0.9.85]
99
+ // FastlaneRunnerAPIVersion [0.9.88]
@@ -1,5 +1,5 @@
1
1
  // Snapshotfile.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  // This class is automatically included in FastlaneRunner during build
5
5
 
@@ -17,4 +17,4 @@ public class Snapshotfile: SnapshotfileProtocol {
17
17
  // during the `init` process, and you won't see this message
18
18
  }
19
19
 
20
- // Generated with fastlane 2.198.0
20
+ // Generated with fastlane 2.200.0
@@ -1,5 +1,5 @@
1
1
  // SnapshotfileProtocol.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  public protocol SnapshotfileProtocol: class {
5
5
  /// Path the workspace file
@@ -200,4 +200,4 @@ public extension SnapshotfileProtocol {
200
200
 
201
201
  // Please don't remove the lines below
202
202
  // They are used to detect outdated files
203
- // FastlaneRunnerAPIVersion [0.9.79]
203
+ // FastlaneRunnerAPIVersion [0.9.82]
@@ -1,5 +1,5 @@
1
1
  // SocketClient.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  //
5
5
  // ** NOTE **
@@ -1,5 +1,5 @@
1
1
  // SocketClientDelegateProtocol.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  //
5
5
  // ** NOTE **
@@ -1,5 +1,5 @@
1
1
  // SocketResponse.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  //
5
5
  // ** NOTE **
@@ -2,35 +2,35 @@
2
2
  "entries": {
3
3
  "brew": {
4
4
  "swiftformat": {
5
- "version": "0.48.18",
5
+ "version": "0.49.1",
6
6
  "bottle": {
7
7
  "rebuild": 0,
8
8
  "root_url": "https://ghcr.io/v2/homebrew/core",
9
9
  "files": {
10
10
  "arm64_monterey": {
11
11
  "cellar": ":any_skip_relocation",
12
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:adbb11cdda0596a1f40e920f826a2e1ffe6aeb1643c43ddb108f25f30755be39",
13
- "sha256": "adbb11cdda0596a1f40e920f826a2e1ffe6aeb1643c43ddb108f25f30755be39"
12
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:c43caffb4d2cf9546b0a8fa732ffe5d95b1b1fd7ab03f1c5da39c8e7a0e8ecb4",
13
+ "sha256": "c43caffb4d2cf9546b0a8fa732ffe5d95b1b1fd7ab03f1c5da39c8e7a0e8ecb4"
14
14
  },
15
15
  "arm64_big_sur": {
16
16
  "cellar": ":any_skip_relocation",
17
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:74691b21c40d34459c5825306828039bdbdfdd02c80d1cea5c449c3f59760ab1",
18
- "sha256": "74691b21c40d34459c5825306828039bdbdfdd02c80d1cea5c449c3f59760ab1"
17
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:ad0ce5fc15fe1d339d366ece18694fdc1d14021684462a126ed20b537a1a9bf5",
18
+ "sha256": "ad0ce5fc15fe1d339d366ece18694fdc1d14021684462a126ed20b537a1a9bf5"
19
19
  },
20
20
  "monterey": {
21
21
  "cellar": ":any_skip_relocation",
22
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:14e4b90f29b55b06c92f90b6e81e8dd55c54ff258ee8b0bab2bb479ce0cc8daf",
23
- "sha256": "14e4b90f29b55b06c92f90b6e81e8dd55c54ff258ee8b0bab2bb479ce0cc8daf"
22
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:33652b8015d31dbe45e00bdc598f1b228cb63c7083b90137fdec66318a88010f",
23
+ "sha256": "33652b8015d31dbe45e00bdc598f1b228cb63c7083b90137fdec66318a88010f"
24
24
  },
25
25
  "big_sur": {
26
26
  "cellar": ":any_skip_relocation",
27
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:73f0497b504f87159bc2d133371014e0372799d89f62bc78068b3b5427ae614f",
28
- "sha256": "73f0497b504f87159bc2d133371014e0372799d89f62bc78068b3b5427ae614f"
27
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:f0ad88e5594a6a3e5a35834a9a22473a05511375942dbb046d1085cc537d60b8",
28
+ "sha256": "f0ad88e5594a6a3e5a35834a9a22473a05511375942dbb046d1085cc537d60b8"
29
29
  },
30
30
  "catalina": {
31
31
  "cellar": ":any_skip_relocation",
32
- "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:11543d157b589acdf9de93133a68fa32aa00372b574a64c40292aead20f6f6cb",
33
- "sha256": "11543d157b589acdf9de93133a68fa32aa00372b574a64c40292aead20f6f6cb"
32
+ "url": "https://ghcr.io/v2/homebrew/core/swiftformat/blobs/sha256:564f5daf9cd82407843aed590bd4190f3e5aaa73a30b3bc8ae07135f1319ac97",
33
+ "sha256": "564f5daf9cd82407843aed590bd4190f3e5aaa73a30b3bc8ae07135f1319ac97"
34
34
  }
35
35
  }
36
36
  }
@@ -56,11 +56,11 @@
56
56
  "macOS": "11.6"
57
57
  },
58
58
  "monterey": {
59
- "HOMEBREW_VERSION": "3.3.4",
59
+ "HOMEBREW_VERSION": "3.3.10-21-g3ba6afb",
60
60
  "HOMEBREW_PREFIX": "/opt/homebrew",
61
- "Homebrew/homebrew-core": "446005a8fbbc1a51d0bd8efd8e03bf82f1f78fab",
61
+ "Homebrew/homebrew-core": "54f307bcd04cec374c7fd3f22fe7e6b13f1ad783",
62
62
  "CLT": "13.1.0.0.1.1633545042",
63
- "Xcode": "13.1",
63
+ "Xcode": "13.2.1",
64
64
  "macOS": "12.0.1"
65
65
  }
66
66
  }
@@ -1,5 +1,5 @@
1
1
  // main.swift
2
- // Copyright (c) 2021 FastlaneTools
2
+ // Copyright (c) 2022 FastlaneTools
3
3
 
4
4
  //
5
5
  // ** NOTE **
@@ -73,12 +73,17 @@ module FastlaneCore
73
73
  end
74
74
 
75
75
  def self.fetch_info_plist_with_unzip(path)
76
- list, error, = Open3.capture3("unzip", "-Z", "-1", path)
76
+ entry, error, = Open3.capture3("unzip", "-Z", "-1", path, "*Payload/*.app/Info.plist")
77
+
78
+ # unzip can return multiple Info.plist files if is an embedded app bundle (a WatchKit app)
79
+ # - ContainsWatchApp/Payload/Sample.app/Watch/Sample WatchKit App.app/Info.plist
80
+ # - ContainsWatchApp/Payload/Sample.app/Info.plist
81
+ #
82
+ # we can determine the main Info.plist by the shortest path
83
+ entry = entry.lines.map(&:chomp).min_by(&:size)
84
+
77
85
  UI.command_output(error) unless error.empty?
78
- return nil if list.empty?
79
- entry = list.chomp.split("\n").find do |e|
80
- File.fnmatch("**/Payload/*.app/Info.plist", e, File::FNM_PATHNAME)
81
- end
86
+ return nil if entry.nil? || entry.empty?
82
87
  data, error, = Open3.capture3("unzip", "-p", path, entry)
83
88
  UI.command_output(error) unless error.empty?
84
89
  return nil if data.empty?
@@ -2,6 +2,7 @@ require 'shellwords'
2
2
  require 'tmpdir'
3
3
  require 'fileutils'
4
4
  require 'credentials_manager/account_manager'
5
+ require 'securerandom'
5
6
 
6
7
  require_relative 'features'
7
8
  require_relative 'helper'
@@ -150,10 +151,13 @@ module FastlaneCore
150
151
  end
151
152
 
152
153
  def file_upload_option(source)
153
- if File.extname(source) == ".itmsp"
154
- return "-f #{source.shellescape}"
155
- else
154
+ ext = File.extname(source).downcase
155
+ is_asset_file_type = !File.directory?(source) && [".ipa", ".pkg", ".dmg", ".zip"].include?(ext)
156
+
157
+ if is_asset_file_type
156
158
  return "-assetFile #{source.shellescape}"
159
+ else
160
+ return "-f #{source.shellescape}"
157
161
  end
158
162
  end
159
163
 
@@ -492,9 +496,15 @@ module FastlaneCore
492
496
  # However, -assetFile requires -assetDescription if Linux or Windows
493
497
  # This will give the asset directly if macOS and asset_path exists
494
498
  # otherwise it will use the .itmsp package
495
- actual_dir = if Helper.is_mac? && asset_path
499
+
500
+ force_itmsp = FastlaneCore::Env.truthy?("ITMSTRANSPORTER_FORCE_ITMS_PACKAGE_UPLOAD")
501
+ can_use_asset_path = Helper.is_mac? && asset_path
502
+
503
+ actual_dir = if can_use_asset_path && !force_itmsp
496
504
  # The asset gets deleted upon completion so copying to a temp directory
497
- tmp_asset_path = File.join(Dir.tmpdir, File.basename(asset_path))
505
+ # (with randomized filename, for multibyte-mixed filename upload fails)
506
+ new_file_name = "#{SecureRandom.uuid}#{File.extname(asset_path)}"
507
+ tmp_asset_path = File.join(Dir.tmpdir, new_file_name)
498
508
  FileUtils.cp(asset_path, tmp_asset_path)
499
509
  tmp_asset_path
500
510
  elsif package_path
@@ -7,7 +7,7 @@ module Gym
7
7
  class << self
8
8
  def generate
9
9
  parts = prefix
10
- parts << "xcodebuild"
10
+ parts << Gym.config[:xcodebuild_command]
11
11
  parts += options
12
12
  parts += buildactions
13
13
  parts += setting
@@ -43,7 +43,7 @@ module Gym
43
43
  options << "-scmProvider system"
44
44
  end
45
45
  options << config[:xcargs] if config[:xcargs]
46
- options << "OTHER_SWIFT_FLAGS=\"-Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
46
+ options << "OTHER_SWIFT_FLAGS=\"\\\$(value) -Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
47
47
 
48
48
  options
49
49
  end
@@ -72,32 +72,78 @@ module Gym
72
72
  def pipe
73
73
  pipe = []
74
74
  pipe << "| tee #{xcodebuild_log_path.shellescape}"
75
- unless Gym.config[:disable_xcpretty]
76
- formatter = Gym.config[:xcpretty_formatter]
77
- pipe << "| xcpretty"
78
- pipe << " --test" if Gym.config[:xcpretty_test_format]
79
- pipe << " --no-color" if Helper.colors_disabled?
80
- pipe << " --formatter " if formatter
81
- pipe << formatter if formatter
82
- pipe << "--utf" if Gym.config[:xcpretty_utf]
83
- report_output_junit = Gym.config[:xcpretty_report_junit]
84
- report_output_html = Gym.config[:xcpretty_report_html]
85
- report_output_json = Gym.config[:xcpretty_report_json]
86
- if report_output_junit
87
- pipe << " --report junit --output "
88
- pipe << report_output_junit.shellescape
89
- elsif report_output_html
90
- pipe << " --report html --output "
91
- pipe << report_output_html.shellescape
92
- elsif report_output_json
93
- pipe << " --report json-compilation-database --output "
94
- pipe << report_output_json.shellescape
95
- end
75
+
76
+ formatter = Gym.config[:xcodebuild_formatter].chomp
77
+ options = legacy_xcpretty_options
78
+
79
+ if Gym.config[:disable_xcpretty] || formatter == ''
80
+ UI.verbose("Not using an xcodebuild formatter")
81
+ elsif !options.empty?
82
+ UI.important("Detected legacy xcpretty being used so formatting wth xcpretty")
83
+ UI.important("Option(s) used: #{options.join(', ')}")
84
+ pipe += pipe_xcpretty
85
+ elsif formatter == 'xcpretty'
86
+ pipe += pipe_xcpretty
87
+ elsif formatter == 'xcbeautify'
88
+ pipe += pipe_xcbeautify
89
+ else
90
+ pipe << "| #{formatter}"
96
91
  end
92
+
97
93
  pipe << "> /dev/null" if Gym.config[:suppress_xcode_output]
98
94
  pipe
99
95
  end
100
96
 
97
+ def pipe_xcbeautify
98
+ pipe = ['| xcbeautify']
99
+
100
+ if FastlaneCore::Helper.colors_disabled?
101
+ pipe << '--disable-colored-output'
102
+ end
103
+
104
+ return pipe
105
+ end
106
+
107
+ def legacy_xcpretty_options
108
+ options = []
109
+
110
+ options << "xcpretty_test_format" if Gym.config[:xcpretty_test_format]
111
+ options << "xcpretty_formatter" if Gym.config[:xcpretty_formatter]
112
+ options << "xcpretty_report_junit" if Gym.config[:xcpretty_report_junit]
113
+ options << "xcpretty_report_html" if Gym.config[:xcpretty_report_html]
114
+ options << "xcpretty_report_json" if Gym.config[:xcpretty_report_json]
115
+ options << "xcpretty_utf" if Gym.config[:xcpretty_utf]
116
+
117
+ return options
118
+ end
119
+
120
+ def pipe_xcpretty
121
+ pipe = []
122
+
123
+ formatter = Gym.config[:xcpretty_formatter]
124
+ pipe << "| xcpretty"
125
+ pipe << " --test" if Gym.config[:xcpretty_test_format]
126
+ pipe << " --no-color" if Helper.colors_disabled?
127
+ pipe << " --formatter " if formatter
128
+ pipe << formatter if formatter
129
+ pipe << "--utf" if Gym.config[:xcpretty_utf]
130
+ report_output_junit = Gym.config[:xcpretty_report_junit]
131
+ report_output_html = Gym.config[:xcpretty_report_html]
132
+ report_output_json = Gym.config[:xcpretty_report_json]
133
+ if report_output_junit
134
+ pipe << " --report junit --output "
135
+ pipe << report_output_junit.shellescape
136
+ elsif report_output_html
137
+ pipe << " --report html --output "
138
+ pipe << report_output_html.shellescape
139
+ elsif report_output_json
140
+ pipe << " --report json-compilation-database --output "
141
+ pipe << report_output_json.shellescape
142
+ end
143
+
144
+ pipe
145
+ end
146
+
101
147
  def post_build
102
148
  commands = []
103
149
  commands << %{grep -E '^[0-9.]+ms' #{xcodebuild_log_path.shellescape} | grep -vE '^0\.[0-9]' | sort -nr > culprits.txt} if Gym.config[:analyze_build_time]
@@ -1,4 +1,5 @@
1
1
  require 'fastlane_core/configuration/config_item'
2
+ require 'fastlane/helper/xcodebuild_formatter_helper'
2
3
  require 'credentials_manager/appfile_config'
3
4
  require_relative 'module'
4
5
 
@@ -230,8 +231,18 @@ module Gym
230
231
  description: "Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path",
231
232
  optional: true,
232
233
  type: Boolean),
234
+
235
+ FastlaneCore::ConfigItem.new(key: :xcodebuild_formatter,
236
+ env_names: ["GYM_XCODEBUILD_FORMATTER", "FASTLANE_XCODEBUILD_FORMATTER"],
237
+ description: "xcodebuild formatter to use (ex: 'xcbeautify', 'xcbeautify --quieter', 'xcpretty', 'xcpretty -test')",
238
+ type: String,
239
+ default_value: Fastlane::Helper::XcodebuildFormatterHelper.xcbeautify_installed? ? 'xcbeautify' : 'xcpretty',
240
+ default_value_dynamic: true),
241
+
242
+ # xcpretty
233
243
  FastlaneCore::ConfigItem.new(key: :disable_xcpretty,
234
244
  env_name: "DISABLE_XCPRETTY",
245
+ deprecated: "Use `xcodebuild_formatter: ''` instead",
235
246
  description: "Disable xcpretty formatting of build output",
236
247
  optional: true,
237
248
  type: Boolean),
@@ -259,22 +270,29 @@ module Gym
259
270
  env_name: "XCPRETTY_REPORT_JSON",
260
271
  description: "Have xcpretty create a JSON compilation database at the provided path",
261
272
  optional: true),
262
- FastlaneCore::ConfigItem.new(key: :analyze_build_time,
263
- env_name: "GYM_ANALYZE_BUILD_TIME",
264
- description: "Analyze the project build time and store the output in 'culprits.txt' file",
265
- optional: true,
266
- type: Boolean),
267
273
  FastlaneCore::ConfigItem.new(key: :xcpretty_utf,
268
274
  env_name: "XCPRETTY_UTF",
269
275
  description: "Have xcpretty use unicode encoding when reporting builds",
270
276
  optional: true,
271
277
  type: Boolean),
278
+
279
+ FastlaneCore::ConfigItem.new(key: :analyze_build_time,
280
+ env_name: "GYM_ANALYZE_BUILD_TIME",
281
+ description: "Analyze the project build time and store the output in 'culprits.txt' file",
282
+ optional: true,
283
+ type: Boolean),
272
284
  FastlaneCore::ConfigItem.new(key: :skip_profile_detection,
273
285
  env_name: "GYM_SKIP_PROFILE_DETECTION",
274
286
  description: "Do not try to build a profile mapping from the xcodeproj. Match or a manually provided mapping should be used",
275
287
  optional: true,
276
288
  type: Boolean,
277
289
  default_value: false),
290
+ FastlaneCore::ConfigItem.new(key: :xcodebuild_command,
291
+ env_name: "GYM_XCODE_BUILD_COMMAND",
292
+ description: "Allows for override of the default `xcodebuild` command",
293
+ type: String,
294
+ optional: true,
295
+ default_value: "xcodebuild"),
278
296
  FastlaneCore::ConfigItem.new(key: :cloned_source_packages_path,
279
297
  env_name: "GYM_CLONED_SOURCE_PACKAGES_PATH",
280
298
  description: "Sets a custom path for Swift Package Manager dependencies",
@@ -1,4 +1,5 @@
1
1
  require 'fastlane_core/configuration/config_item'
2
+ require 'fastlane/helper/xcodebuild_formatter_helper'
2
3
  require 'credentials_manager/appfile_config'
3
4
  require_relative 'module'
4
5
 
@@ -60,7 +61,7 @@ module Scan
60
61
  optional: true,
61
62
  is_string: true,
62
63
  env_name: "SCAN_DEVICE",
63
- description: "The name of the simulator type you want to run tests on (e.g. 'iPhone 6')",
64
+ description: "The name of the simulator type you want to run tests on (e.g. 'iPhone 6' or 'iPhone SE (2nd generation) (14.5)')",
64
65
  conflicting_options: [:devices],
65
66
  conflict_block: proc do |value|
66
67
  UI.user_error!("You can't use 'device' and 'devices' options in one run")
@@ -70,7 +71,7 @@ module Scan
70
71
  is_string: false,
71
72
  env_name: "SCAN_DEVICES",
72
73
  type: Array,
73
- description: "Array of devices to run the tests on (e.g. ['iPhone 6', 'iPad Air'])",
74
+ description: "Array of devices to run the tests on (e.g. ['iPhone 6', 'iPad Air', 'iPhone SE (2nd generation) (14.5)'])",
74
75
  conflicting_options: [:device],
75
76
  conflict_block: proc do |value|
76
77
  UI.user_error!("You can't use 'device' and 'devices' options in one run")
@@ -214,11 +215,7 @@ module Scan
214
215
  description: "Should the HTML report be opened when tests are completed?",
215
216
  is_string: false,
216
217
  default_value: false),
217
- FastlaneCore::ConfigItem.new(key: :disable_xcpretty,
218
- env_name: "SCAN_DISABLE_XCPRETTY",
219
- description: "Disable xcpretty formatting of build, similar to `output_style='raw'` but this will also skip the test results table",
220
- type: Boolean,
221
- optional: true),
218
+
222
219
  FastlaneCore::ConfigItem.new(key: :output_directory,
223
220
  short_option: "-o",
224
221
  env_name: "SCAN_OUTPUT_DIRECTORY",
@@ -227,6 +224,7 @@ module Scan
227
224
  code_gen_default_value: "./test_output",
228
225
  default_value: File.join(containing, "test_output"),
229
226
  default_value_dynamic: true),
227
+
230
228
  FastlaneCore::ConfigItem.new(key: :output_style,
231
229
  short_option: "-b",
232
230
  env_name: "SCAN_OUTPUT_STYLE",
@@ -263,9 +261,30 @@ module Scan
263
261
  description: "Suppress the output of xcodebuild to stdout. Output is still saved in buildlog_path",
264
262
  optional: true,
265
263
  type: Boolean),
264
+
265
+ FastlaneCore::ConfigItem.new(key: :xcodebuild_formatter,
266
+ env_names: ["SCAN_XCODEBUILD_FORMATTER", "FASTLANE_XCODEBUILD_FORMATTER"],
267
+ description: "xcodebuild formatter to use (ex: 'xcbeautify', 'xcbeautify --quieter', 'xcpretty', 'xcpretty -test')",
268
+ type: String,
269
+ default_value: Fastlane::Helper::XcodebuildFormatterHelper.xcbeautify_installed? ? 'xcbeautify' : 'xcpretty',
270
+ default_value_dynamic: true),
271
+
272
+ # xcpretty
273
+ FastlaneCore::ConfigItem.new(key: :disable_xcpretty,
274
+ env_name: "SCAN_DISABLE_XCPRETTY",
275
+ deprecated: "Use `output_style: 'raw'` instead",
276
+ description: "Disable xcpretty formatting of build, similar to `output_style='raw'` but this will also skip the test results table",
277
+ type: Boolean,
278
+ optional: true),
266
279
  FastlaneCore::ConfigItem.new(key: :formatter,
267
280
  short_option: "-n",
268
281
  env_name: "SCAN_FORMATTER",
282
+ deprecated: "Use 'xcpretty_formatter' instead",
283
+ description: "A custom xcpretty formatter to use",
284
+ optional: true),
285
+ FastlaneCore::ConfigItem.new(key: :xcpretty_formatter,
286
+ short_option: "-N",
287
+ env_name: "SCAN_XCPRETTY_FORMATTER",
269
288
  description: "A custom xcpretty formatter to use",
270
289
  optional: true),
271
290
  FastlaneCore::ConfigItem.new(key: :xcpretty_args,
@@ -273,6 +292,7 @@ module Scan
273
292
  description: "Pass in xcpretty additional command line arguments (e.g. '--test --no-color' or '--tap --no-utf')",
274
293
  type: String,
275
294
  optional: true),
295
+
276
296
  FastlaneCore::ConfigItem.new(key: :derived_data_path,
277
297
  short_option: "-j",
278
298
  env_name: "SCAN_DERIVED_DATA_PATH",
@@ -51,7 +51,9 @@ module Scan
51
51
  end
52
52
  end
53
53
 
54
- execute(retries: Scan.config[:number_of_retries])
54
+ # Set retries to 0 if Xcode 13 because TestCommandGenerator will set '-retry-tests-on-failure -test-iterations'
55
+ retries = Helper.xcode_at_least?(13) ? 0 : Scan.config[:number_of_retries]
56
+ execute(retries: retries)
55
57
  end
56
58
 
57
59
  def execute(retries: 0)
@@ -126,7 +128,7 @@ module Scan
126
128
 
127
129
  test_cases = suite.split(":\n").fetch(1, []).split("\n").each
128
130
  .select { |line| line.match?(/^\s+/) }
129
- .map { |line| line.strip.gsub(".", "/").gsub("()", "") }
131
+ .map { |line| line.strip.gsub(/[\s\.]/, "/").gsub(/[\-\[\]\(\)]/, "") }
130
132
  .map { |line| suite_name + "/" + line }
131
133
 
132
134
  retryable_tests += test_cases
@@ -135,27 +137,68 @@ module Scan
135
137
  return retryable_tests.uniq
136
138
  end
137
139
 
138
- def handle_results(tests_exit_status)
139
- if Scan.config[:disable_xcpretty]
140
- unless tests_exit_status == 0
141
- UI.test_failure!("Test execution failed. Exit status: #{tests_exit_status}")
142
- end
143
- return
140
+ def trainer_test_results
141
+ require "trainer"
142
+
143
+ results = {
144
+ number_of_tests: 0,
145
+ number_of_failures: 0,
146
+ number_of_retries: 0
147
+ }
148
+
149
+ result_bundle_path = Scan.cache[:result_bundle_path]
150
+ output_path = Scan.config[:output_directory] || Dir.mktmpdir
151
+
152
+ UI.crash!("A -resultBundlePath is needed to parse the test results. This should not have happened. Please file an issue.") unless result_bundle_path
153
+
154
+ params = {
155
+ path: result_bundle_path,
156
+ output_path: output_path,
157
+ silent: true,
158
+ extension: "xml"
159
+ }
160
+
161
+ resulting_paths = Trainer::TestParser.auto_convert(params)
162
+ resulting_paths.each do |path, data|
163
+ results[:number_of_tests] += data[:number_of_tests_excluding_retries]
164
+ results[:number_of_failures] += data[:number_of_failures_excluding_retries]
165
+ results[:number_of_retries] += data[:number_of_retries]
144
166
  end
145
167
 
146
- result = TestResultParser.new.parse_result(test_results)
147
- SlackPoster.new.run(result)
168
+ return results
169
+ end
170
+
171
+ def handle_results(tests_exit_status)
172
+ results = trainer_test_results
148
173
 
149
- if result[:failures] > 0
150
- failures_str = result[:failures].to_s.red
174
+ number_of_retries = results[:number_of_retries]
175
+ number_of_tests = results[:number_of_tests]
176
+ number_of_failures = results[:number_of_failures]
177
+
178
+ SlackPoster.new.run({
179
+ tests: number_of_tests,
180
+ failures: number_of_failures
181
+ })
182
+
183
+ if number_of_failures > 0
184
+ failures_str = number_of_failures.to_s.red
151
185
  else
152
- failures_str = result[:failures].to_s.green
186
+ failures_str = number_of_failures.to_s.green
153
187
  end
154
188
 
189
+ retries_str = case number_of_retries
190
+ when 0
191
+ ""
192
+ when 1
193
+ " (and 1 retry)"
194
+ else
195
+ " (and #{number_of_retries} retries)"
196
+ end
197
+
155
198
  puts(Terminal::Table.new({
156
199
  title: "Test Results",
157
200
  rows: [
158
- ["Number of tests", result[:tests]],
201
+ ["Number of tests", "#{number_of_tests}#{retries_str}"],
159
202
  ["Number of failures", failures_str]
160
203
  ]
161
204
  }))
@@ -165,7 +208,7 @@ module Scan
165
208
  zip_build_products
166
209
  copy_xctestrun
167
210
 
168
- if result[:failures] > 0
211
+ if number_of_failures > 0
169
212
  open_report
170
213
 
171
214
  UI.test_failure!("Tests have failed")