Class: Fastlane::Actions::XcresulttoolMergeAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



41
42
43
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 41

def self.authors
  ["crazymanish"]
end

.available_optionsObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 53

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :source_results,
      description: "Array of paths to .xcresult bundles to merge",
      optional: false,
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_path,
      description: "Path where to save the merged result bundle",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :verbose,
      description: "Enable verbose output",
      optional: true,
      default_value: false,
      is_string: false
    )
  ]
end

.categoryObject



90
91
92
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 90

def self.category
  :testing
end

.descriptionObject



37
38
39
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 37

def self.description
  "Merge multiple Result Bundles using xcresulttool"
end

.detailsObject



49
50
51
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 49

def self.details
  "This action merges multiple Xcode result bundles (.xcresult) into a single bundle using Apple's xcresulttool merge subcommand"
end

.example_codeObject



81
82
83
84
85
86
87
88
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 81

def self.example_code
  [
    'xcresulttool_merge(
      source_results: ["path/to/Test1.xcresult", "path/to/Test2.xcresult"],
      output_path: "path/to/MergedResults.xcresult"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 77

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.return_valueObject



45
46
47
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 45

def self.return_value
  nil
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fastlane/plugin/xcresulttool/actions/xcresulttool_merge_action.rb', line 7

def self.run(params)
  args = ["merge"]
  
  # Validate source result bundles
  source_results = params[:source_results]
  UI.user_error!("At least one source result bundle path must be provided") if source_results.nil? || source_results.empty?
  
  source_results.each do |path|
    Helper::XcresulttoolHelper.validate_result_bundle_path(path)
  end
  
  # Add required output path
  output_path = params[:output_path]
  UI.user_error!("Output path must be provided") if output_path.nil? || output_path.empty?
  args << "--output-path" << output_path
  
  # Add source result bundle paths directly as arguments
  source_results.each do |path|
    args << path
  end
  
  # Add verbose option if needed
  args << "--verbose" if params[:verbose]
  
  # Execute the command
  Helper::XcresulttoolHelper.execute_command(args)
  
  UI.success("Result bundles merged to #{output_path}")
end