pilot/lib/pilot/build_manager.rb in fastlane-2.123.0.beta.20190507200014 vs pilot/lib/pilot/build_manager.rb in fastlane-2.123.0.beta.20190508200056
- old
+ new
@@ -8,11 +8,14 @@
require_relative 'manager'
module Pilot
class BuildManager < Manager
def upload(options)
- start(options)
+ # Only need to login before upload if no apple_id was given
+ # 'login' will be deferred until before waiting for build processing
+ should_login_in_start = options[:apple_id].nil?
+ start(options, should_login: should_login_in_start)
options[:changelog] = self.class.sanitize_changelog(options[:changelog]) if options[:changelog]
UI.user_error!("No ipa file given") unless config[:ipa]
@@ -22,22 +25,22 @@
else
UI.user_error!("No changelog provided for new build. Please either disable `distribute_external` or provide a changelog using the `changelog` option")
end
end
- UI.success("Ready to upload new build to TestFlight (App: #{app.apple_id})...")
+ UI.success("Ready to upload new build to TestFlight (App: #{fetch_apple_id})...")
dir = Dir.mktmpdir
platform = fetch_app_platform
- package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(app_id: app.apple_id,
- ipa_path: config[:ipa],
+ package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(app_id: fetch_apple_id,
+ ipa_path: options[:ipa],
package_path: dir,
platform: platform)
transporter = transporter_for_selected_team(options)
- result = transporter.upload(app.apple_id, package_path)
+ result = transporter.upload(fetch_apple_id, package_path)
unless result
UI.user_error!("Error uploading ipa file, for more information see above")
end
@@ -47,20 +50,23 @@
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
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
distribute(options, build: latest_build)
end
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.apple_id, platform: platform, train_version: app_version, build_version: app_build, poll_interval: config[:wait_processing_interval])
+ latest_build = FastlaneCore::BuildWatcher.wait_for_build_processing_to_be_complete(app_id: app.apple_id, platform: platform, train_version: app_version, build_version: app_build, poll_interval: config[:wait_processing_interval], strict_build_watch: config[:wait_for_uploaded_build])
unless latest_build.train_version == app_version && latest_build.build_version == app_build
UI.important("Uploaded app #{app_version} - #{app_build}, but received build #{latest_build.train_version} - #{latest_build.build_version}.")
end
@@ -218,10 +224,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)
generic_transporter = FastlaneCore::ItunesTransporter.new(options[:username], nil, false, options[:itc_provider])
- return generic_transporter unless options[:itc_provider].nil? && Spaceship::Tunes.client.teams.count > 1
+ return generic_transporter if options[:itc_provider] || Spaceship::Tunes.client.nil?
+ return generic_transporter unless Spaceship::Tunes.client.teams.count > 1
begin
team = Spaceship::Tunes.client.teams.find { |t| t['contentProvider']['contentProviderId'].to_s == Spaceship::Tunes.client.team_id }
name = team['contentProvider']['name']
provider_id = generic_transporter.provider_ids[name]