Class: Fastlane::Actions::AnalyzeIosLinkmapAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



62
63
64
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 62

def self.authors
  ["xiongzenghui"]
end

.available_optionsObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 40

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :filepath,
      description: "/your/path/to/linkmap.txt",
      verify_block: ->(value) { 
        UI.user_error("❌ filepath not pass") unless value
        UI.user_error!("❌ filepath #{value} not exist") unless File.exist?(value)
      }
    ),
    FastlaneCore::ConfigItem.new(
      key: :search_symbol,
      description: "search your give symbol in linkmap.txt from what library",
      optional: true
    )
  ]
end

.descriptionObject



58
59
60
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 58

def self.description
  "iOS parse linkmap.txt to ruby Hash or JSON"
end

.detailsObject



70
71
72
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 70

def self.details
  "iOS parse linkmap.txt to ruby Hash"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 74

def self.is_supported?(platform)
  :ios == platform
end

.return_valueObject



66
67
68
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 66

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fastlane/plugin/analyze_ios_linkmap/actions/analyze_ios_linkmap_action.rb', line 13

def self.run(params)
  filepath = params[:filepath]
  search_symbol = params[:search_symbol]

  parser = Fastlane::Helper::LinkMap::Parser.new(filepath)

  if search_symbol
    Fastlane::Actions.lane_context[Fastlane::Actions::ShatedValues::ANALYZE_IOS_LINKMAP_SEARCH_SYMBOL] = []
    parser.pretty_hash[:librarys].each do |lib|
      lib[:objects].each do |obj|
        obj[:symbols].each do |symol|
          next unless symol[:name].include?(search_symbol)

          Fastlane::Actions.lane_context[Fastlane::Actions::ShatedValues::ANALYZE_IOS_LINKMAP_SEARCH_SYMBOL] << {
            library: lib[:library],
            object_file: obj[:object],
            symbol: symol[:name]
          }
        end
      end
    end
  end

  Fastlane::Actions.lane_context[Fastlane::Actions::ShatedValues::ANALYZE_IOS_LINKMAP_PARED_HASH] = parser.pretty_hash
  Fastlane::Actions.lane_context[Fastlane::Actions::ShatedValues::ANALYZE_IOS_LINKMAP_PARED_JSON] = parser.pretty_json
end