pilot/lib/pilot/build_manager.rb in fastlane-2.118.0.beta.20190314200016 vs pilot/lib/pilot/build_manager.rb in fastlane-2.118.0.beta.20190315200105
- old
+ new
@@ -48,19 +48,25 @@
UI.important("This means that no changelog will be set and no build will be distributed to testers")
return
end
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], 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}. If you want to wait for uploaded build to be finished processing, use the `wait_for_uploaded_build` option")
end
- distribute(options, build: latest_build)
+ return latest_build
end
def distribute(options, build: nil)
start(options)
if config[:apple_id].to_s.length == 0 && config[:app_identifier].to_s.length == 0
@@ -208,11 +214,11 @@
def distribute_build(uploaded_build, options)
UI.message("Distributing new build to testers: #{uploaded_build.train_version} - #{uploaded_build.build_version}")
# This is where we could add a check to see if encryption is required and has been updated
- uploaded_build.export_compliance.encryption_updated = false
+ set_export_compliance_if_needed(uploaded_build, options)
if options[:groups] || options[:distribute_external]
begin
uploaded_build.submit_for_testflight_review!
rescue => ex
@@ -239,17 +245,28 @@
uploaded_build.add_group!(external_group) unless external_group.nil?
if external_group.nil? && options[:groups].nil?
UI.user_error!("You must specify at least one group using the `:groups` option to distribute externally")
end
- else # distribute internally
- # in case any changes to export_compliance are required
- if uploaded_build.export_compliance_missing?
- uploaded_build.save!
- end
end
true
+ end
+
+ def set_export_compliance_if_needed(uploaded_build, options)
+ build = uploaded_build.find_app_store_connect_build
+ build_attributes = build["attributes"] || {}
+ if build_attributes["usesNonExemptEncryption"].nil?
+ uses_non_exempt_encryption = options[:uses_non_exempt_encryption]
+ attributes = { usesNonExemptEncryption: uses_non_exempt_encryption }
+
+ client = Spaceship::ConnectAPI::Base.client
+ client.patch_builds(build_id: build["id"], attributes: attributes)
+
+ UI.important("Export comlpiance 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
+ end
end
def update_review_detail(app_id, info)
info = info.collect { |k, v| [k.to_sym, v] }.to_h