Class: Fastlane::Actions::UploadSymbolsToNewRelicAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::UploadSymbolsToNewRelicAction
- Defined in:
- lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
- .get_all_dsym_paths(params) ⇒ Object
- .handle_dsym(params, current_path) ⇒ Object
- .run(params) ⇒ Object
- .transform_architecture_symbol_info(architecture_symbol_info) ⇒ Object
- .upload_dsym(params, path, dwarf_dump) ⇒ Object
Class Method Details
.authors ⇒ Object
141 142 143 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 141 def self. ["bitwit", "hjanuschka"] end |
.available_options ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 101 def self. [ FastlaneCore::ConfigItem.new(key: :new_relic_app_name, env_name: "FL_UPLOAD_SYMBOLS_TO_NEW_RELIC_APP_NAME", description: "The name of your app", optional: false, verify_block: proc do |value| UI.user_error!("No app name for New Relic given, pass using `new_relic_app_name: 'app name'`") if value.to_s.length.zero? end), FastlaneCore::ConfigItem.new(key: :new_relic_license_key, env_name: "FL_UPLOAD_SYMBOLS_TO_NEW_RELIC_LICENSE_KEY", description: "Your New Relic app license key", optional: false, verify_block: proc do |value| UI.user_error!("No license key for New Relic given, pass using `new_relic_license_key: 'key'`") if value.to_s.length.zero? end), FastlaneCore::ConfigItem.new(key: :dsym_path, env_name: "FL_UPLOAD_SYMBOLS_TO_NEW_RELIC_DSYM_PATH", description: "Path to the DSYM file or zip to upload", default_value: ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] || (Dir["./**/*.dSYM"] + Dir["./**/*.dSYM.zip"]).first, optional: true, verify_block: proc do |value| UI.user_error!("Couldn't find file at path '#{File.(value)}'") unless File.exist?(value) UI.user_error!("Symbolication file needs to be dSYM or zip") unless value.end_with?(".zip", ".dSYM") end), FastlaneCore::ConfigItem.new(key: :new_relic_upload_libs, env_name: "FL_UPLOAD_SYMBOLS_TO_NEW_RELIC_UPLOAD_LIBS", description: "The library names to upload", optional: true) ] end |
.description ⇒ Object
93 94 95 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 93 def self.description "Upload all dsyms (possibly in a zip file) to new relic" end |
.details ⇒ Object
97 98 99 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 97 def self.details "Upload all dsyms (possibly in a zip file) to new relic" end |
.get_all_dsym_paths(params) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 17 def self.get_all_dsym_paths(params) dsym_paths = [] dsym_paths << params[:dsym_path] if params[:dsym_path] dsym_paths += Actions.lane_context[SharedValues::DSYM_PATHS] if Actions.lane_context[SharedValues::DSYM_PATHS] # Get rid of duplicates (which might occur when both passed and detected) dsym_paths = dsym_paths.collect { |a| File.(a) } dsym_paths.uniq! return dsym_paths end |
.handle_dsym(params, current_path) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 31 def self.handle_dsym(params, current_path) if current_path.end_with?(".dSYM") dwarf_dump = Actions.sh("xcrun dwarfdump --uuid '#{current_path}'") upload_dsym(params, current_path, dwarf_dump) elsif current_path.end_with?(".zip") UI.("Extracting '#{current_path}'...") current_path = File.(current_path) Dir.mktmpdir do |dir| Dir.chdir(dir) do Actions.sh("unzip -qo #{current_path.shellescape}") Dir["*.dSYM"].each do |path| handle_dsym(params, path) end end end else UI.error "Don't know how to handle '#{current_path}'" end end |
.is_supported?(platform) ⇒ Boolean
145 146 147 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 145 def self.is_supported?(platform) platform == :ios end |
.output ⇒ Object
133 134 135 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 133 def self.output [] end |
.return_value ⇒ Object
137 138 139 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 137 def self.return_value nil end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 4 def self.run(params) dsym_paths = get_all_dsym_paths(params) if dsym_paths.count.zero? UI.error("Couldn't find any dSYMs, please pass them using the dsym_path option") return nil end dsym_paths.each do |current_path| handle_dsym(params, current_path) end end |
.transform_architecture_symbol_info(architecture_symbol_info) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 76 def self.transform_architecture_symbol_info(architecture_symbol_info) # dwarfdump returns lines in the format "UUID: THE-dSYM-UUID-HERE (architecture) path/to/lib" dsym_info_components = architecture_symbol_info.split(" ") uuid = dsym_info_components[1] uuid.delete! '-' uuid = uuid.downcase lib_path = dsym_info_components.last lib_name = lib_path.split("/").last return { uuid: uuid, lib_name: lib_name } end |
.upload_dsym(params, path, dwarf_dump) ⇒ Object
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/upload_symbols_to_new_relic/actions/upload_symbols_to_new_relic_action.rb', line 53 def self.upload_dsym(params, path, dwarf_dump) if dwarf_dump.nil? return end app_name = params[:new_relic_app_name] uploadable_lib_names = (params[:new_relic_upload_libs] || "").split(",") new_relic_key = params[:new_relic_license_key] all_included_architecture_info = dwarf_dump.split("\n").map { |line| transform_architecture_symbol_info(line) } lib_name = all_included_architecture_info[0][:lib_name] # if we haven't specified any upload libs, we'll upload them all # otherwise, check that the lib+name from the dwarfdump is in our list puts "123123" if uploadable_lib_names.count.zero? || uploadable_lib_names.include?(lib_name) build_ids = all_included_architecture_info.map { |info| info[:uuid] } .join(",") zip_file_name = "#{path}.zip" sh "zip --recurse-paths --quiet '#{zip_file_name}' '#{path}'" sh "curl -F dsym=@'#{zip_file_name}' -F buildId='#{build_ids}' -F appName='#{app_name}' -H 'X-APP-LICENSE-KEY: #{new_relic_key}' https://mobile-symbol-upload.newrelic.com/symbol" end end |