Skip to content

Commit 67df50f

Browse files
authored
Merge pull request #12055 from alvarhansen/alvar/always_out_of_date
Add support for always_out_of_date flag in script phase
2 parents 53893a2 + 0000000 commit 67df50f

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
1212
[Gabriel Donadel](https://github.com/gabrieldonadel)
1313
[#11965](https://github.com/CocoaPods/CocoaPods/pull/11965)
1414

15+
* Extend `script_phase` DSL to support `always_out_of_date` attribute.
16+
[Alvar Hansen](https://github.com/alvarhansen)
17+
[#12055](https://github.com/CocoaPods/CocoaPods/pull/12055)
18+
1519
##### Bug Fixes
1620

1721
* Use safe_load during custom YAML config loading.

lib/cocoapods/installer/user_project_integrator/target_integrator.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def create_or_update_user_script_phases(script_phases, native_target)
314314
phase.input_file_list_paths = script_phase[:input_file_lists]
315315
phase.output_file_list_paths = script_phase[:output_file_lists]
316316
phase.dependency_file = script_phase[:dependency_file]
317+
phase.always_out_of_date = script_phase[:always_out_of_date]
317318
# At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only
318319
# gets set to '0' if the user has explicitly disabled this.
319320
if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'

spec/unit/installer/user_project_integrator/target_integrator_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ module Pod
546546
phase.output_file_list_paths.should.be.nil
547547
phase.show_env_vars_in_log.should.be.nil
548548
phase.dependency_file.should.be.nil
549+
phase.always_out_of_date.should.be.nil
549550
end
550551

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

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

591594
it 'sets the show_env_vars_in_log value to 0 if its explicitly set' do
@@ -753,6 +756,28 @@ module Pod
753756
end
754757
end
755758

759+
it 'sets the always_out_of_date value to 1 if its explicitly set' do
760+
@pod_bundle.target_definition.stubs(:script_phases).returns([:name => 'Custom Script',
761+
:script => 'echo "Hello World"',
762+
:always_out_of_date => '1'])
763+
@target_integrator.integrate!
764+
target = @target_integrator.send(:native_targets).first
765+
phase = target.shell_script_build_phases.find { |bp| bp.name == @user_script_phase_name }
766+
phase.should.not.be.nil?
767+
phase.always_out_of_date.should == '1'
768+
end
769+
770+
it 'sets the always_out_of_date value to 1 if its explicitly set' do
771+
@pod_bundle.target_definition.stubs(:script_phases).returns([:name => 'Custom Script',
772+
:script => 'echo "Hello World"',
773+
:always_out_of_date => '1'])
774+
@target_integrator.integrate!
775+
target = @target_integrator.send(:native_targets).first
776+
phase = target.shell_script_build_phases.find { |bp| bp.name == @user_script_phase_name }
777+
phase.should.not.be.nil?
778+
phase.always_out_of_date.should == '1'
779+
end
780+
756781
it 'adds and remove on demand resources to the user target resources build phase' do
757782
on_demand_resources = { 'tag1' => { :paths => [config.sandbox.root + 'banana-lib/path/to/resource.png'], :category => :download_on_demand } }
758783
@banana_pod_target.file_accessors.first.stubs(:on_demand_resources).returns(on_demand_resources)

0 commit comments

Comments
 (0)