Class: Fastlane::Actions::DownloadDsymsAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::DownloadDsymsAction
- Defined in:
- lib/fastlane/actions/download_dsyms.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, lane_context, method_missing, other_action, sample_return_value, sh, step_text
Class Method Details
.authors ⇒ Object
164 165 166 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 164 def self. ["KrauseFx"] 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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 101 def self. user = CredentialsManager::AppfileConfig.try_fetch_value(:itunes_connect_id) user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) [ FastlaneCore::ConfigItem.new(key: :username, short_option: "-u", env_name: "DOWNLOAD_DSYMS_USERNAME", description: "Your Apple ID Username for iTunes Connect", default_value: user), FastlaneCore::ConfigItem.new(key: :app_identifier, short_option: "-a", env_name: "DOWNLOAD_DSYMS_APP_IDENTIFIER", description: "The bundle identifier of your app", optional: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)), FastlaneCore::ConfigItem.new(key: :team_id, short_option: "-k", env_name: "DOWNLOAD_DSYMS_TEAM_ID", description: "The ID of your team if you're in multiple teams", optional: true, is_string: false, # as we also allow integers, which we convert to strings anyway default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id), verify_block: proc do |value| ENV["FASTLANE_ITC_TEAM_ID"] = value.to_s end), FastlaneCore::ConfigItem.new(key: :team_name, short_option: "-e", env_name: "DOWNLOAD_DSYMS_TEAM_NAME", description: "The name of your team if you're in multiple teams", optional: true, default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name), verify_block: proc do |value| ENV["FASTLANE_ITC_TEAM_NAME"] = value end), FastlaneCore::ConfigItem.new(key: :platform, short_option: "-p", env_name: "DOWNLOAD_DSYMS_PLATFORM", description: "The app platform for dSYMs you wish to download", optional: true), FastlaneCore::ConfigItem.new(key: :version, short_option: "-v", env_name: "DOWNLOAD_DSYMS_VERSION", description: "The app version for dSYMs you wish to download", optional: true), FastlaneCore::ConfigItem.new(key: :build_number, short_option: "-b", env_name: "DOWNLOAD_DSYMS_BUILD_NUMBER", description: "The app build_number for dSYMs you wish to download", optional: true) ] end |
.category ⇒ Object
179 180 181 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 179 def self.category :misc end |
.description ⇒ Object
83 84 85 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 83 def self.description "Download dSYM files from Apple iTunes Connect for Bitcode apps" end |
.details ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 87 def self.details [ "This action downloads dSYM files from Apple iTunes Connect after", "the ipa got re-compiled by Apple. Useful if you have Bitcode enabled", "```ruby", "lane :refresh_dsyms do", " download_dsyms # Download dSYM files from iTC", " upload_symbols_to_crashlytics # Upload them to Crashlytics", " clean_build_artifacts # Delete the local dSYM files", "end", "```" ].join("\n") end |
.download(url) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 71 def self.download(url) uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == "https") res = http.get(uri.request_uri) res.body end |
.example_code ⇒ Object
172 173 174 175 176 177 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 172 def self.example_code [ 'download_dsyms', 'download_dsyms(version: "1.0.0", build_number: "345")' ] end |
.is_supported?(platform) ⇒ Boolean
168 169 170 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 168 def self.is_supported?(platform) platform == :ios end |
.output ⇒ Object
154 155 156 157 158 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 154 def self.output [ ['DSYM_PATHS', 'An array to all the zipped dSYM files'] ] end |
.return_value ⇒ Object
160 161 162 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 160 def self.return_value nil end |
.run(params) ⇒ Object
8 9 10 11 12 13 14 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fastlane/actions/download_dsyms.rb', line 8 def self.run(params) require 'spaceship' require 'net/http' UI.("Login to iTunes Connect (#{params[:username]})") Spaceship::Tunes.login(params[:username]) Spaceship::Tunes.select_team UI.("Login successful") version = params[:version] build_number = params[:build_number] platform = params[:platform] = [] << "Looking for dSYM files for #{params[:app_identifier]}" if version << "v#{version}" end if build_number << "(#{build_number})" end UI.(.join(" ")) app = Spaceship::Application.find(params[:app_identifier]) unless app UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}") end app.all_build_train_numbers(platform: platform).each do |train_number| if version && version != train_number next end app.all_builds_for_train(train: train_number, platform: platform).each do |build| if build_number && build.build_version != build_number next end begin download_url = build.details.dsym_url rescue Spaceship::TunesClient::ITunesConnectError => ex UI.error("Error accessing dSYM file for build\n\n#{build}\n\nException: #{ex}") end if download_url result = self.download download_url file_name = "#{app.bundle_id}-#{train_number}-#{build.build_version}.dSYM.zip" File.write(file_name, result) UI.success("🔑 Successfully downloaded dSYM file for #{train_number} - #{build.build_version} to '#{file_name}'") Actions.lane_context[SharedValues::DSYM_PATHS] ||= [] Actions.lane_context[SharedValues::DSYM_PATHS] << File.(file_name) else UI.("No dSYM URL for #{build.build_version} (#{build.train_version})") end end end if (Actions.lane_context[SharedValues::DSYM_PATHS] || []).count == 0 UI.error("No dSYM files found on iTunes Connect - this usually happens when no recompling happened yet") end end |