Class: Fastlane::Actions::XcsizeDiffAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



24
25
26
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_diff_action.rb', line 24

def self.authors
  ['Alexey Alter-Pesotskiy']
end

.available_optionsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_diff_action.rb', line 28

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :old_linkmap,
      description: 'Set old linkmap path',
      is_string: true,
      optional: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :new_linkmap,
      description: 'Set new linkmap path',
      is_string: true,
      optional: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :threshold,
      description: 'Set minimum size difference threshold in bytes',
      is_string: false,
      optional: true
    )
  ]
end

.descriptionObject



20
21
22
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_diff_action.rb', line 20

def self.description
  'Compare two iOS and macOS binary sizes using linkmaps.'
end

.example_codeObject



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_diff_action.rb', line 51

def self.example_code
  [
    'report = xcsize_diff(
      old_linkmap: "path/to/your/old_linkmap.txt",
      new_linkmap: "path/to/your/new_linkmap.txt",
      threshold: 1024
    )
    p report[:old_total_size]
    p report[:new_total_size]
    p report[:difference]
    p report[:details]'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_diff_action.rb', line 65

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

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_diff_action.rb', line 4

def self.run(params)
  Actions.verify_gem!('xcsize')

  require 'xcsize'

  options = {}
  params.all_keys.each { |k| options[k] = params[k] }

  comparator = ::Xcsize::Comparator.new(
    old_linkmap_path: options[:old_linkmap],
    new_linkmap_path: options[:new_linkmap],
    threshold: options[:threshold]
  )
  comparator.compare
end