Skip to content

Commit

Permalink
[pilot] app_version and app_build should not be fetched from a local …
Browse files Browse the repository at this point in the history
…IPA or PKG when distribute_only is set (#20488)

* app_version and app_build should not be fetched from a local IPA or PKG when distribute_only is set

* add a test for the new behavior, remove a duplicate test
  • Loading branch information
tremblay authored Jul 22, 2022
1 parent c6ef9b1 commit f221c95
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pilot/lib/pilot/build_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def check_for_changelog_or_whats_new!(options)

def wait_for_build_processing_to_be_complete(return_when_build_appears = false)
platform = fetch_app_platform
if config[:ipa] && platform != "osx"
if config[:ipa] && platform != "osx" && !config[:distribute_only]
app_version = FastlaneCore::IpaFileAnalyser.fetch_app_version(config[:ipa])
app_build = FastlaneCore::IpaFileAnalyser.fetch_app_build(config[:ipa])
elsif config[:pkg]
elsif config[:pkg] && !config[:distribute_only]
app_version = FastlaneCore::PkgFileAnalyser.fetch_app_version(config[:pkg])
app_build = FastlaneCore::PkgFileAnalyser.fetch_app_build(config[:pkg])
else
Expand Down
32 changes: 18 additions & 14 deletions pilot/spec/build_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,24 @@
fake_build_manager.wait_for_build_processing_to_be_complete
end

it "wait given :distribute_only" do
options = { pkg: "some_path.pkg", build_number: "234", app_version: "2.3.4", distribute_only: true }
fake_build_manager.instance_variable_set(:@config, options)

expect(fake_build_manager).to receive(:fetch_app_platform)
expect(FastlaneCore::IpaFileAnalyser).to_not(receive(:fetch_app_version))
expect(FastlaneCore::IpaFileAnalyser).to_not(receive(:fetch_app_build))
expect(FastlaneCore::PkgFileAnalyser).to_not(receive(:fetch_app_version))
expect(FastlaneCore::PkgFileAnalyser).to_not(receive(:fetch_app_build))

fake_build = double
expect(fake_build).to receive(:app_version).and_return("2.3.4")
expect(fake_build).to receive(:version).and_return("234")
expect(FastlaneCore::BuildWatcher).to receive(:wait_for_build_processing_to_be_complete).and_return(fake_build)

fake_build_manager.wait_for_build_processing_to_be_complete
end

it "wait given :ipa and :pkg and platform ios" do
options = { ipa: "some_path.ipa", pkg: "some_path.pkg" }
fake_build_manager.instance_variable_set(:@config, options)
Expand Down Expand Up @@ -520,20 +538,6 @@
fake_build_manager.wait_for_build_processing_to_be_complete
end

it "wait given :app_version and :build_number" do
options = { app_version: "1.2.3", build_number: "123" }
fake_build_manager.instance_variable_set(:@config, options)

expect(fake_build_manager).to receive(:fetch_app_platform)

fake_build = double
expect(fake_build).to receive(:app_version).and_return("1.2.3")
expect(fake_build).to receive(:version).and_return("123")
expect(FastlaneCore::BuildWatcher).to receive(:wait_for_build_processing_to_be_complete).and_return(fake_build)

fake_build_manager.wait_for_build_processing_to_be_complete
end

it "wait given :ipa, :app_version and :build_number" do
options = { app_version: "4.5.6", build_number: "456", ipa: "some_path.ipa" }
fake_build_manager.instance_variable_set(:@config, options)
Expand Down

0 comments on commit f221c95

Please sign in to comment.