Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for always_out_of_date flag in script phase #12055

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Gabriel Donadel](https://github.com/gabrieldonadel)
[#11965](https://github.com/CocoaPods/CocoaPods/pull/11965)

* Extend `script_phase` DSL to support `always_out_of_date` attribute.
[Alvar Hansen](https://github.com/alvarhansen)
[#12055](https://github.com/CocoaPods/CocoaPods/pull/12055)

##### Bug Fixes

* Use safe_load during custom YAML config loading.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ def create_or_update_user_script_phases(script_phases, native_target)
phase.input_file_list_paths = script_phase[:input_file_lists]
phase.output_file_list_paths = script_phase[:output_file_lists]
phase.dependency_file = script_phase[:dependency_file]
phase.always_out_of_date = script_phase[:always_out_of_date]
# At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only
# gets set to '0' if the user has explicitly disabled this.
if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ module Pod
phase.output_file_list_paths.should.be.nil
phase.show_env_vars_in_log.should.be.nil
phase.dependency_file.should.be.nil
phase.always_out_of_date.should.be.nil
end

it 'adds a custom shell script phase with input/output paths' do
Expand All @@ -567,6 +568,7 @@ module Pod
phase.output_file_list_paths.should == ['/path/to/output_file.xcfilelist']
phase.show_env_vars_in_log.should.be.nil
phase.dependency_file.should.be.nil
phase.always_out_of_date.should.be.nil
end

it 'adds a custom shell script phase with dependency file' do
Expand All @@ -586,6 +588,7 @@ module Pod
phase.output_file_list_paths.should.be.nil
phase.show_env_vars_in_log.should.be.nil
phase.dependency_file.should == '/path/to/depfile.d'
phase.always_out_of_date.should.be.nil
end

it 'sets the show_env_vars_in_log value to 0 if its explicitly set' do
Expand Down Expand Up @@ -753,6 +756,28 @@ module Pod
end
end

it 'sets the always_out_of_date value to 1 if its explicitly set' do
@pod_bundle.target_definition.stubs(:script_phases).returns([:name => 'Custom Script',
:script => 'echo "Hello World"',
:always_out_of_date => '1'])
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == @user_script_phase_name }
phase.should.not.be.nil?
phase.always_out_of_date.should == '1'
end

it 'sets the always_out_of_date value to 1 if its explicitly set' do
@pod_bundle.target_definition.stubs(:script_phases).returns([:name => 'Custom Script',
:script => 'echo "Hello World"',
:always_out_of_date => '1'])
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == @user_script_phase_name }
phase.should.not.be.nil?
phase.always_out_of_date.should == '1'
end

it 'adds and remove on demand resources to the user target resources build phase' do
on_demand_resources = { 'tag1' => { :paths => [config.sandbox.root + 'banana-lib/path/to/resource.png'], :category => :download_on_demand } }
@banana_pod_target.file_accessors.first.stubs(:on_demand_resources).returns(on_demand_resources)
Expand Down