Class: Fastlane::Actions::NativeSymbolsAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



46
47
48
# File 'lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb', line 46

def self.authors
  ["Nuno Pinge"]
end

.available_optionsObject



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

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :app_path,
      description: "Root path of the Android application project",
      optional: true,
      default_value: Dir.pwd,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :variant,
      description: "Android build variant to inspect for native symbols",
      optional: true,
      default_value: "release",
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :raise,
      description: "Raise an error when the native symbols path cannot be found",
      optional: true,
      default_value: true,
      type: Fastlane::Boolean
    )
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb', line 34

def self.description
  "Native debug symbols for Play Store"
end

.detailsObject



38
39
40
# File 'lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb', line 38

def self.details
  "Use this action to zip native symbols and get the retrace mapping file as part of a fastlane lane."
end

.example_codeObject



76
77
78
79
80
81
82
83
84
# File 'lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb', line 76

def self.example_code
  [
    'native_symbols(
      app_path: "./android",
      variant: "release",
      raise: true
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb', line 86

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

.return_valueObject



42
43
44
# File 'lib/fastlane/plugin/native_symbols/actions/native_symbols_action.rb', line 42

def self.return_value
  "Array with 2 elements: the native symbols zip path (string) and the retrace mapping path (string or nil)"
end

.run(params) ⇒ Object



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

def self.run(params)
  config = params || FastlaneCore::Configuration.create(available_options, {})
  app_path = Pathname.new(config[:app_path])
  unless app_path.directory?
    UI.user_error!("native_symbols: app_path '#{app_path}' does not exist or is not a directory")
  end
  variant = config[:variant].to_s
  UI.user_error!("native_symbols: variant is required") if variant.empty?
  native_symbols_path = Helper::NativeSymbolsHelper.find_native_symbols_path(app_path, variant)
  unless native_symbols_path
    message = "native_symbols: could not find native symbols path for '#{variant}' variant"
    if config[:raise]
      UI.user_error!(message)
    else
      UI.important("#{message}, skipping...")
      return nil
    end
  end
  temp_dir = Pathname.new(Dir.mktmpdir("fastlane-native-symbols-"))
  output_path = Helper::NativeSymbolsHelper.initialize_output_path(temp_dir)
  zip_path = Helper::NativeSymbolsHelper.zip_native_symbols(native_symbols_path, output_path)
  retrace_mapping_path = Helper::NativeSymbolsHelper.find_retrace_mapping(app_path, variant)
  [zip_path, retrace_mapping_path]
end