From ea0932ab6837bd7da57ff1f48ef55cd03ef5004a Mon Sep 17 00:00:00 2001 From: Dimitris Koutsogiorgas Date: Wed, 6 Mar 2019 11:49:16 -0800 Subject: [PATCH] Add support for `xcfilelist` in `script_phase` DSL. --- CHANGELOG.md | 4 +++- lib/cocoapods-core/podfile/dsl.rb | 20 ++++++++++++++------ lib/cocoapods-core/specification/dsl.rb | 15 ++++++++++++++- spec/podfile/target_definition_spec.rb | 3 ++- spec/specification/linter_spec.rb | 5 +++-- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e9cbb5f0..474a1500d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ ##### Enhancements -* None. +* Add support for `xcfilelist` in `script_phase` DSL. + [Dimitris Koutsogiorgas](https://github.com/dnkoutso) + [#517](https://github.com/CocoaPods/Core/pull/517) ##### Bug Fixes diff --git a/lib/cocoapods-core/podfile/dsl.rb b/lib/cocoapods-core/podfile/dsl.rb index 0c36698fa..c89a9a775 100644 --- a/lib/cocoapods-core/podfile/dsl.rb +++ b/lib/cocoapods-core/podfile/dsl.rb @@ -399,13 +399,21 @@ def target(name, options = nil) # @option options [String] :shell_path # the shell path to use for this script phase, for example `/usr/bin/ruby` to use Ruby for this phase. # - # @option options [Array] :input_paths - # the input paths to use for script. This is used by Xcode to determine whether to re-execute this - # script phase if the input paths have changed or not. + # @option options [Array] :input_files + # the input paths to use for this script phase. This is used by Xcode to determine whether to re-execute + # this script phase if the input paths have changed or not. # - # @option options [Array] :output_paths - # the output paths to use for script. This is used by Xcode to avoid re-executing this script phase if - # none of the output paths have changed. + # @option options [Array] :output_files + # the output paths to use for this script phase. This is used by Xcode to avoid re-executing this script + # phase if none of the output paths have changed. + # + # @option options [Array] :input_file_lists + # the input file lists to use for this script phase. This is used by Xcode to determine whether to + # re-execute this script phase if the input paths have changed or not. + # + # @option options [Array] :output_file_lists + # the output file lists to use for this script phase. This is used by Xcode to avoid re-executing this + # script phase if none of the output paths have changed. # # @option options [Boolean] :show_env_vars_in_log # whether this script phase should output the environment variables during execution. diff --git a/lib/cocoapods-core/specification/dsl.rb b/lib/cocoapods-core/specification/dsl.rb index e235a6deb..f546946f4 100644 --- a/lib/cocoapods-core/specification/dsl.rb +++ b/lib/cocoapods-core/specification/dsl.rb @@ -990,7 +990,8 @@ def dependency=(args) SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze - SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :show_env_vars_in_log, :execution_position].freeze + SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :input_file_lists, :output_file_lists, + :show_env_vars_in_log, :execution_position].freeze EXECUTION_POSITION_KEYS = [:before_compile, :after_compile, :any].freeze @@ -1022,6 +1023,18 @@ def dependency=(args) # # @example # + # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', + # :input_files => ['/path/to/input_file.txt'], :output_files => ['/path/to/output_file.txt'] + # } + # + # @example + # + # spec.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"', + # :input_file_lists => ['/path/to/input_files.xcfilelist'], :output_files => ['/path/to/output_files.xcfilelist'] + # } + # + # @example + # # spec.script_phases = [ # { :name => 'Hello World', :script => 'echo "Hello World"' }, # { :name => 'Hello Ruby World', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby' }, diff --git a/spec/podfile/target_definition_spec.rb b/spec/podfile/target_definition_spec.rb index b26fb4ff4..29c543ea2 100644 --- a/spec/podfile/target_definition_spec.rb +++ b/spec/podfile/target_definition_spec.rb @@ -418,7 +418,8 @@ module Pod it 'raises if script phase includes an unrecognized key' do e = lambda { @parent.store_script_phase(:name => 'PhaseName', :unknown => 'Unknown') }.should.raise Podfile::StandardError e.message.should == 'Unrecognized options `[:unknown]` in shell script `PhaseName` within `MyApp` target. ' \ - 'Available options are `[:name, :script, :shell_path, :input_files, :output_files, :show_env_vars_in_log, :execution_position]`.' + 'Available options are `[:name, :script, :shell_path, :input_files, :output_files, :input_file_lists, ' \ + ':output_file_lists, :show_env_vars_in_log, :execution_position]`.' end it 'raises if script phase includes an invalid execution position key' do diff --git a/spec/specification/linter_spec.rb b/spec/specification/linter_spec.rb index 8709cdb29..fe0b6ab93 100644 --- a/spec/specification/linter_spec.rb +++ b/spec/specification/linter_spec.rb @@ -462,10 +462,11 @@ def result_should_include(*values) result_should_include('script_phases', 'Missing required shell script phase options `script` in script phase `Hello World`.') end - it 'checks script phases include the required keys' do + it 'checks script phases that include unknown keys' do @spec.script_phases = { :name => 'Hello World', :script => 'echo "Hello World"', :unknown => 'unknown' } result_should_include('script_phases', 'Unrecognized option(s) `unknown` in script phase `Hello World`. ' \ - 'Available options are `name, script, shell_path, input_files, output_files, show_env_vars_in_log, execution_position`.') + 'Available options are `name, script, shell_path, input_files, output_files, input_file_lists, ' \ + 'output_file_lists, show_env_vars_in_log, execution_position`.') end it 'checks script phases include a valid execution position value' do