Class: Fastlane::Actions::XcsizeAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



19
20
21
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_action.rb', line 19

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

.available_optionsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_action.rb', line 23

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

.descriptionObject



15
16
17
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_action.rb', line 15

def self.description
  'Profile iOS and macOS binary size using linkmap.'
end

.example_codeObject



40
41
42
43
44
45
46
47
48
49
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_action.rb', line 40

def self.example_code
  [
    'report = xcsize(
      linkmap: "path/to/your/linkmap.txt",
      threshold: 1024
    )
    p report[:total_size]
    p report[:details]'
  ]
end

.is_supported?(platform) ⇒ Boolean



51
52
53
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_action.rb', line 51

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

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/fastlane/plugin/xcsize/actions/xcsize_action.rb', line 4

def self.run(params)
  options = {}
  params.all_keys.each { |k| options[k] = params[k] }

  profiler = ::Xcsize::Profiler.new(
    linkmap_path: options[:linkmap],
    threshold: options[:threshold]
  )
  profiler.profile
end