Class: Fastlane::Actions::DsymZipAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorObject



75
76
77
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 75

def self.author
  'lmirosevic'
end

.available_optionsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 45

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],
                                 default_value_dynamic: true,
                                 optional: true,
                                 env_name: 'DSYM_ZIP_XCARCHIVE_PATH',
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't find xcarchive file at path '#{value}'") if !Helper.test? && !File.exist?(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'),
    FastlaneCore::ConfigItem.new(key: :all,
                                 description: 'Whether or not all dSYM files are to be included. Optional, default is false in which only your app dSYM is included',
                                 default_value: false,
                                 optional: true,
                                 type: Boolean,
                                 env_name: 'DSYM_ZIP_ALL')
  ]
end

.categoryObject



88
89
90
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 88

def self.category
  :misc
end

.descriptionObject



37
38
39
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 37

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

.detailsObject



41
42
43
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 41

def self.details
  "You can manually specify the path to the xcarchive (not needed if you use `xcodebuild`/`xcarchive` to build your archive)"
end

.example_codeObject



79
80
81
82
83
84
85
86
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 79

def self.example_code
  [
    'dsym_zip',
    'dsym_zip(
      archive_path: "MyApp.xcarchive"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



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

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

.outputObject



69
70
71
72
73
# File 'fastlane/lib/fastlane/actions/dsym_zip.rb', line 69

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
24
25
26
27
# File 'fastlane/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")

  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

  if params[:all]
    Actions.sh(%(cd "#{dsym_folder_path}" && zip -r "#{zipped_dsym_path}" "#{dsym_folder_path}"/*.dSYM))
  else
    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"
    Actions.sh(%(cd "#{dsym_folder_path}" && zip -r "#{zipped_dsym_path}" "#{dsym_name}"))
  end
end