pilot/lib/pilot/build_manager.rb in fastlane_hotfix-2.165.1 vs pilot/lib/pilot/build_manager.rb in fastlane_hotfix-2.187.0

- old
+ new

@@ -29,14 +29,15 @@ ipa_path: options[:ipa], package_path: dir, platform: platform) transporter = transporter_for_selected_team(options) - result = transporter.upload(fetch_app_id, package_path) + result = transporter.upload(package_path: package_path) unless result - UI.user_error!("Error uploading ipa file, for more information see above") + transporter_errors = transporter.displayable_errors + UI.user_error!("Error uploading ipa file: \n #{transporter_errors}") end UI.success("Successfully uploaded the new binary to App Store Connect") # We will fully skip waiting for build processing *only* if no changelog is supplied @@ -88,21 +89,28 @@ end end def wait_for_build_processing_to_be_complete(return_when_build_appears = false) platform = fetch_app_platform - app_version = FastlaneCore::IpaFileAnalyser.fetch_app_version(config[:ipa]) - app_build = FastlaneCore::IpaFileAnalyser.fetch_app_build(config[:ipa]) + if config[:ipa] + app_version = FastlaneCore::IpaFileAnalyser.fetch_app_version(config[:ipa]) + app_build = FastlaneCore::IpaFileAnalyser.fetch_app_build(config[:ipa]) + else + app_version = config[:app_version] + app_build = config[:build_number] + end latest_build = FastlaneCore::BuildWatcher.wait_for_build_processing_to_be_complete( app_id: app.id, platform: platform, app_version: app_version, build_version: app_build, poll_interval: config[:wait_processing_interval], + timeout_duration: config[:wait_processing_timeout_duration], return_when_build_appears: return_when_build_appears, - return_spaceship_testflight_build: false + return_spaceship_testflight_build: false, + select_latest: config[:distribute_only] ) unless latest_build.app_version == app_version && latest_build.version == app_build UI.important("Uploaded app #{app_version} - #{app_build}, but received build #{latest_build.app_version} - #{latest_build.version}.") end @@ -190,11 +198,11 @@ # Get processed builds builds = app.get_builds(includes: "betaBuildMetrics,preReleaseVersion", sort: "-uploadedDate").map do |build| [ build.app_version, build.version, - (build.beta_build_metrics || []).map(&:install_count).reduce(:+) + (build.beta_build_metrics || []).map(&:install_count).compact.reduce(:+) ] end # Only show table if there are any build deliveries unless build_deliveries.empty? @@ -246,13 +254,17 @@ rescue => ex UI.user_error!("Could not set changelog: #{ex}") end end - update_build_beta_details(build, { - auto_notify_enabled: options[:notify_external_testers] - }) + if options[:notify_external_testers].nil? + UI.important("Using App Store Connect's default for notifying external testers (which is true) - set `notify_external_testers` for full control") + else + update_build_beta_details(build, { + auto_notify_enabled: options[:notify_external_testers] + }) + end end def self.truncate_changelog(changelog) max_changelog_bytes = 4000 if changelog @@ -271,13 +283,19 @@ end end changelog end + def self.emoji_regex + # EmojiRegex::RGIEmoji is now preferred over EmojiRegex::Regex which is deprecated as of 3.2.0 + # https://github.com/ticky/ruby-emoji-regex/releases/tag/v3.2.0 + return defined?(EmojiRegex::RGIEmoji) ? EmojiRegex::RGIEmoji : EmojiRegex::Regex + end + def self.strip_emoji(changelog) - if changelog && changelog =~ EmojiRegex::Regex - changelog.gsub!(EmojiRegex::Regex, "") + if changelog && changelog =~ emoji_regex + changelog.gsub!(emoji_regex, "") UI.important("Emoji symbols have been removed from the changelog, since they're not allowed by Apple.") end changelog end @@ -347,10 +365,11 @@ # If itc_provider was explicitly specified, use it. # If there are multiple teams, infer the provider from the selected team name. # If there are fewer than two teams, don't infer the provider. def transporter_for_selected_team(options) # Use JWT auth + api_token = Spaceship::ConnectAPI.token unless api_token.nil? api_token.refresh! if api_token.expired? return FastlaneCore::ItunesTransporter.new(nil, nil, false, nil, api_token.text) end @@ -415,18 +434,25 @@ Spaceship::ConnectAPI.patch_builds(build_id: uploaded_build.id, attributes: attributes) UI.important("Export compliance has been set to '#{uses_non_exempt_encryption}'. Need to wait for build to finishing processing again...") UI.important("Set 'ITSAppUsesNonExemptEncryption' in the 'Info.plist' to skip this step and speed up the submission") - return wait_for_build_processing_to_be_complete + + loop do + build = Spaceship::ConnectAPI::Build.get(build_id: uploaded_build.id) + return build unless build.missing_export_compliance? + + UI.message("Waiting for build #{uploaded_build.id} to process export compliance") + sleep(5) + end else return uploaded_build end end def update_review_detail(build, info) - info = info.collect { |k, v| [k.to_sym, v] }.to_h + info = info.transform_keys(&:to_sym) attributes = {} attributes[:contactEmail] = info[:contact_email] if info.key?(:contact_email) attributes[:contactFirstName] = info[:contact_first_name] if info.key?(:contact_first_name) attributes[:contactLastName] = info[:contact_last_name] if info.key?(:contact_last_name) @@ -438,11 +464,11 @@ Spaceship::ConnectAPI.patch_beta_app_review_detail(app_id: build.app.id, attributes: attributes) end def update_localized_app_review(build, info_by_lang, default_info: nil) - info_by_lang = info_by_lang.collect { |k, v| [k.to_sym, v] }.to_h + info_by_lang = info_by_lang.transform_keys(&:to_sym) if default_info info_by_lang.delete(:default) else default_info = info_by_lang.delete(:default) @@ -484,10 +510,10 @@ Spaceship::ConnectAPI.post_beta_app_localizations(app_id: app.id, attributes: attributes) end end def update_localized_build_review(build, info_by_lang, default_info: nil) - info_by_lang = info_by_lang.collect { |k, v| [k.to_sym, v] }.to_h + info_by_lang = info_by_lang.transform_keys(&:to_sym) if default_info info_by_lang.delete(:default) else default_info = info_by_lang.delete(:default)