Class: Fastlane::Actions::PharenUploadSymbolsAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



65
66
67
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 65

def self.authors
  ["Pharen (Lucubra LLC)"]
end

.available_optionsObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 77

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :dsym_paths,
                                 env_name: "PHAREN_DSYM_PATHS",
                                 description: "dSYM inputs (.dSYM bundles, dSYM .zip files, or raw DWARF binaries). Defaults to what gym/download_dsyms left in the lane context",
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :pharen_binary,
                                 env_name: "PHAREN_BINARY",
                                 description: "Command that invokes the Pharen CLI (may include arguments, e.g. `node /path/to/cli.js`)",
                                 optional: true,
                                 default_value: "pharen",
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :strict,
                                 env_name: "PHAREN_STRICT",
                                 description: "Fail the lane on error (true) instead of warning and continuing (false)",
                                 optional: true,
                                 default_value: false,
                                 is_string: false)
  ]
end

.default_dsym_pathsObject

The two places fastlane already put dSYMs, in build order: gym's zip, then any App Store Connect downloads. Duplicates collapse; the CLI dedupes by debug id anyway (re-uploads answer 'duplicate' and exit 0, so this is always re-run safe).



50
51
52
53
54
55
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 50

def self.default_dsym_paths
  candidates = []
  candidates << Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH]
  candidates.concat(Array(Actions.lane_context[SharedValues::DSYM_PATHS]))
  candidates.compact.map(&:to_s).reject(&:empty?).uniq
end

.descriptionObject



61
62
63
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 61

def self.description
  "Upload dSYMs to Pharen for crash symbolication (zero-arg after gym/download_dsyms)"
end

.detailsObject



69
70
71
72
73
74
75
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 69

def self.details
  "Thin wrapper over `pharen upload-symbols`: dSYM paths default from " \
    "SharedValues::DSYM_OUTPUT_PATH (gym) and SharedValues::DSYM_PATHS " \
    "(download_dsyms); .zip inputs are expanded to .dSYM bundles. Debug ids, " \
    "org/app (.pharen.yml) and auth (PHAREN_AUTH_TOKEN) are the CLI's job. " \
    "Server dedupes by debug id, so re-runs are safe."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 103

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

.return_valueObject



99
100
101
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 99

def self.return_value
  "The CLI's parsed JSON ({ archives, summary }) on success; nil on skipped/failed-but-not-strict"
end

.run(params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fastlane/plugin/pharen/actions/pharen_upload_symbols_action.rb', line 15

def self.run(params)
  helper = Helper::PharenHelper

  paths = params[:dsym_paths]
  paths = default_dsym_paths if paths.nil? || Array(paths).empty?
  if Array(paths).empty?
    helper.fail_or_warn(
      params[:strict],
      "pharen_upload_symbols: no dSYMs to upload — run after build_app/gym or " \
        "download_dsyms, or pass dsym_paths"
    )
    return nil
  end

  begin
    expanded = helper.expand_dsym_inputs(paths)
  rescue Helper::PharenHelper::Failure => e
    helper.fail_or_warn(params[:strict], "pharen_upload_symbols: #{e.message}")
    return nil
  end

  result = helper.run_pharen(params[:pharen_binary], ["upload-symbols"] + expanded)
  unless result[:ok]
    helper.fail_or_warn(params[:strict], helper.cli_failure_message("pharen upload-symbols", result))
    return nil
  end

  summary = result[:json].is_a?(Hash) ? result[:json]["summary"] : nil
  UI.success("pharen_upload_symbols: #{summary || 'symbols uploaded'}")
  result[:json]
end