pilot/lib/pilot/build_manager.rb in fastlane-2.127.0.beta.20190709200015 vs pilot/lib/pilot/build_manager.rb in fastlane-2.127.0

- old
+ new

@@ -82,11 +82,11 @@ def wait_for_build_processing_to_be_complete 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, train_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_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 @@ -98,11 +98,15 @@ if config[:apple_id].to_s.length == 0 && config[:app_identifier].to_s.length == 0 config[:app_identifier] = UI.input("App Identifier: ") end # Get latest uploaded build if no build specified - build ||= Spaceship::ConnectAPI::Build.all(app_id: app.id, sort: "-uploadedDate", limit: 1).first + if build.nil? + UI.important("No build specified - fetching latest build") + platform = Spaceship::ConnectAPI::Platform.map(fetch_app_platform) + build ||= Spaceship::ConnectAPI::Build.all(app_id: app.id, sort: "-uploadedDate", platform: platform, limit: 1).first + end # Verify the build has all the includes that we need # and fetch a new build if not if build && (!build.app || !build.build_beta_detail || !build.pre_release_version) UI.important("Build did include information for app, build beta detail and pre release version") @@ -155,11 +159,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).reduce(:+) ] end # Only show table if there are any build deliveries unless build_deliveries.empty? @@ -291,11 +295,11 @@ def distribute_build(uploaded_build, options) UI.message("Distributing new build to testers: #{uploaded_build.app_version} - #{uploaded_build.version}") # This is where we could add a check to see if encryption is required and has been updated - set_export_compliance_if_needed(uploaded_build, options) + uploaded_build = set_export_compliance_if_needed(uploaded_build, options) if options[:groups] || options[:distribute_external] if uploaded_build.ready_for_beta_submission? uploaded_build.post_beta_app_review_submission else @@ -330,10 +334,12 @@ 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") - wait_for_build_processing_to_be_complete + return wait_for_build_processing_to_be_complete + else + return uploaded_build end end def update_review_detail(build, info) info = info.collect { |k, v| [k.to_sym, v] }.to_h