Class: Fastlane::Actions::DsymZipAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/dsym_zip.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, details, sh

Class Method Details

.authorObject



61
62
63
# File 'lib/fastlane/actions/dsym_zip.rb', line 61

def self.author
  'lmirosevic'
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fastlane/actions/dsym_zip.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :archive_path,
                                 description: 'Path to your xcarchive file. Optional if you use the `xcodebuild` action',
                                 default_value: Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE],
                                 optional: true,
                                 env_name: 'DSYM_ZIP_XCARCHIVE_PATH',
                                 verify_block: Proc.new do |value|
                                  raise "Couldn't find xcarchive file at path '#{value}'".red if !Helper.test? && !File.exists?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :dsym_path,
                                 description: 'Path for generated dsym. Optional, default is your apps root directory',
                                 optional: true,
                                 env_name: 'DSYM_ZIP_DSYM_PATH')
  ]
end

.descriptionObject



34
35
36
# File 'lib/fastlane/actions/dsym_zip.rb', line 34

def self.description
  'Creates a zipped dSYM in the project root from the .xcarchive'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fastlane/actions/dsym_zip.rb', line 30

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

.outputObject



55
56
57
58
59
# File 'lib/fastlane/actions/dsym_zip.rb', line 55

def self.output
  [
    ['DSYM_ZIP_PATH', 'The named of the zipped dSYM']
  ]
end

.run(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/actions/dsym_zip.rb', line 10

def self.run(params)
  archive = params[:archive_path]
  params[:dsym_path] ||= File.join("#{File.basename(archive, '.*')}.app.dSYM.zip")

  plist = Plist::parse_xml(File.join(archive, 'Info.plist'))
  app_name = Helper.test? ? 'MyApp.app' : File.basename(plist['ApplicationProperties']['ApplicationPath'])
  dsym_name = "#{app_name}.dSYM"
  dsym_folder_path = File.expand_path(File.join(archive, 'dSYMs'))
  zipped_dsym_path = File.expand_path(params[:dsym_path])

  Actions.lane_context[SharedValues::DSYM_ZIP_PATH] = zipped_dsym_path

  Actions.sh(%Q[cd "#{dsym_folder_path}" && zip -r "#{zipped_dsym_path}" "#{dsym_name}"])
end