class Fastlane::Actions::DsymAction

Constants

ARCHIVE_PATH
OUTPUT_PATH

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 140
def self.authors
  ['icyleaf']
end
available_options() click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 69
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :archive_path,
                                 env_name: 'DF_DSYM_ARCHIVE_PATH',
                                 description: 'The archive path of xcode',
                                 default_value: Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE] || ::DebugFile::Runner::ARCHIVE_PATH,
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :scheme,
                                 env_name: 'DF_DSYM_SCHEME',
                                 description: 'The scheme name of app',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :extra_dsym,
                                 env_name: 'DF_DSYM_EXTRA_DSYM',
                                 description: 'A set file name of dSYM',
                                 optional: true,
                                 default_value: [],
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :release_version,
                                 env_name: 'DF_DSYM_RELEASE_VERSION',
                                 description: 'Use the given release version of app',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :build,
                                 env_name: 'DF_DSYM_BUILD',
                                 description: 'Use the given build version of app',
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :output_path,
                                 env_name: 'DF_DSYM_OUTPUT_PATH',
                                 description: "The output path of compressed dSYM file",
                                 default_value: OUTPUT_PATH,
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :overwrite,
                                 env_name: 'DF_DSYM_OVERWRITE',
                                 description: "Overwrite output compressed file if it existed",
                                 default_value: false,
                                 type: Boolean)
  ]
end
category() click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 126
def self.category
  :misc
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 65
def self.description
  'Find and generate iOS/MacOS dSYM file(s) to zip file'
end
example_code() click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 112
def self.example_code
  [
    'dsym',
    'dsym(
      archive_path: "~/Library/Developer/Xcode/Archives",
      overwrite: true,
      extra_dsym: [
        "AFNetworking.framework.dSYM",
        "Masonry.framework.dSYM"
      ]
    )'
  ]
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 144
def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end
output() click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 134
def self.output
  [
    ['DF_DSYM_ZIP_PATH', 'the path of compressed proguard file']
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 130
def self.return_value
  String
end
run(params) click to toggle source
# File lib/fastlane/plugin/debug_file/actions/dsym_action.rb, line 16
def self.run(params)
  overwrite = params[:overwrite]

  archive_path = params[:archive_path]
  scheme = params[:scheme]
  runner = ::DebugFile::Runner.new({
    archive_path: archive_path,
    scheme: scheme
  })

  dsym = runner.latest_dsym
  unless dsym
    UI.user_error! "Not matched any archive [#{archive_path}] with scheme [#{scheme}]"
  end

  Fastlane::UI.success "Selected #{dsym[:name]} #{dsym[:release_version]} (#{dsym[:build]}) - #{dsym[:created_at]}"
  dsym[:machos].each do |macho|
    Fastlane::UI.message " • #{macho[:uuid]} (#{macho[:arch]})"
  end

  app_dsym_filename = File.basename(dsym[:dsym_path])
  output_file = File.join(params[:output_path], "#{app_dsym_filename}.zip")
  Helper::DebugFileHelper.determine_output_file(output_file, overwrite)

  archive_dsym_path = File.dirname(dsym[:dsym_path])
  extra_dsym = params[:extra_dsym] || []

  dsym_files = [app_dsym_filename].concat(extra_dsym).uniq
  dsym_files.each_with_index do |filename, i|
    path = File.join(archive_dsym_path, filename)
    if Dir.exist?(path)
      dsym_files[i] = path
    else
      dsym_files.delete_at(i)
    end
  end

  UI.message "Prepare #{dsym_files.size} dSYM file(s) compressing"
  UI.verbose dsym_files
  Helper::DebugFileHelper.compress(dsym_files, output_file)

  UI.success "Compressed dSYM file: #{output_file}"
  Helper::DebugFileHelper.store_shard_value SharedValues::DF_DSYM_ZIP_PATH, output_file
end