pilot/lib/pilot/build_manager.rb in fastlane-2.138.0 vs pilot/lib/pilot/build_manager.rb in fastlane-2.139.0

- old
+ new

@@ -37,21 +37,29 @@ UI.user_error!("Error uploading ipa file, for more information see above") 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 + # Otherwise we may partially wait until the build appears so the changelog can be set, and then bail. + return_when_build_appears = false if config[:skip_waiting_for_build_processing] - UI.important("Skip waiting for build processing") - UI.important("This means that no changelog will be set and no build will be distributed to testers") - return + if config[:changelog].nil? + UI.important("`skip_waiting_for_build_processing` used and no `changelog` supplied - skipping waiting for build processing") + return + else + return_when_build_appears = true + end end # Calling login again here is needed if login was not called during 'start' login unless should_login_in_start UI.message("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option") - latest_build = wait_for_build_processing_to_be_complete + UI.message("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on AppStoreConnect, update the changelog and then skip the remaining of the processing steps.") + + latest_build = wait_for_build_processing_to_be_complete(return_when_build_appears) distribute(options, build: latest_build) end def has_changelog_or_whats_new?(options) # Look for legacy :changelog option @@ -78,16 +86,25 @@ UI.user_error!("No changelog provided for new build. Please either disable `distribute_external` or provide a changelog using the `changelog` option") end end end - def wait_for_build_processing_to_be_complete + 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]) - 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], return_spaceship_testflight_build: false) + 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], + return_when_build_appears: return_when_build_appears, + return_spaceship_testflight_build: false + ) + 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 return latest_build @@ -135,9 +152,17 @@ UI.important("Deleting beta app review submission for build: #{waiting_for_review_build.app_version} - #{waiting_for_review_build.version}") waiting_for_review_build.beta_app_review_submission.delete! UI.success("Deleted beta app review submission for previous build: #{waiting_for_review_build.app_version} - #{waiting_for_review_build.version}") end end + + if !build.ready_for_internal_testing? && options[:skip_waiting_for_build_processing] + # Meta can be uploaded for a build still in processing + # Returning before distribute if skip_waiting_for_build_processing + # because can't distribute an app that is still processing + return + end + distribute_build(build, options) type = options[:distribute_external] ? 'External' : 'Internal' UI.success("Successfully distributed build to #{type} testers 🚀") end