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 shell script input/output paths #195

Merged
merged 1 commit into from
Jan 13, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/xcake/dsl/build_phase/shell_script_build_phase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ class ShellScriptBuildPhase < BuildPhase
# String coataining the contents of the script to run
attr_accessor :script

# input/output paths
attr_accessor :input_paths
attr_accessor :output_paths
attr_accessor :input_file_list_paths
attr_accessor :output_file_list_paths

def build_phase_type
Xcodeproj::Project::Object::PBXShellScriptBuildPhase
end

def configure_native_build_phase(native_build_phase, _context)
native_build_phase.name = name
native_build_phase.shell_script = script.strip_heredoc
native_build_phase.input_paths = input_paths || []
native_build_phase.output_paths = output_paths || []
native_build_phase.input_file_list_paths = input_file_list_paths || []
native_build_phase.output_file_list_paths = output_file_list_paths || []
end

def to_s
Expand Down
33 changes: 33 additions & 0 deletions spec/dsl/build_phase/shell_script_build_phase_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ module Xcake

allow(@native_build_phase).to receive(:name=)
allow(@native_build_phase).to receive(:shell_script=)

@paths = %w(path1 path2 path3 path4 path5).shuffle

allow(@native_build_phase).to receive(:input_paths=)
allow(@native_build_phase).to receive(:output_paths=)
allow(@native_build_phase).to receive(:input_file_list_paths=)
allow(@native_build_phase).to receive(:output_file_list_paths=)
end

it 'should use correct build phase type' do
Expand All @@ -30,5 +37,31 @@ module Xcake
expect(@native_build_phase).to receive(:shell_script=).with(@script.strip_heredoc)
@phase.configure_native_build_phase(@native_build_phase, nil)
end

context 'Input/Ouput paths' do
it 'should set input paths' do
@phase.input_paths = @paths
expect(@native_build_phase).to receive(:input_paths=).with(@paths)
@phase.configure_native_build_phase(@native_build_phase, nil)
end

it 'should set output paths' do
@phase.output_paths = @paths
expect(@native_build_phase).to receive(:output_paths=).with(@paths)
@phase.configure_native_build_phase(@native_build_phase, nil)
end

it 'should set input file list paths' do
@phase.input_file_list_paths = @paths
expect(@native_build_phase).to receive(:input_file_list_paths=).with(@paths)
@phase.configure_native_build_phase(@native_build_phase, nil)
end

it 'should set output file list paths' do
@phase.output_file_list_paths = @paths
expect(@native_build_phase).to receive(:output_file_list_paths=).with(@paths)
@phase.configure_native_build_phase(@native_build_phase, nil)
end
end
end
end