Commit 44d20e49 authored by Marius Rackwitz's avatar Marius Rackwitz

[PodTargetInstaller] Create a build phase to symlink header folders

parent 5496974a
...@@ -32,6 +32,7 @@ module Pod ...@@ -32,6 +32,7 @@ module Pod
target.file_accessors.flat_map(&:public_headers).map(&:basename) target.file_accessors.flat_map(&:public_headers).map(&:basename)
end end
end end
create_build_phase_to_symlink_header_folders
end end
create_prefix_header create_prefix_header
create_dummy_source create_dummy_source
...@@ -216,6 +217,26 @@ module Pod ...@@ -216,6 +217,26 @@ module Pod
end end
end end
# Creates a build phase which links the versioned header folders
# of the OS X into the framework bundle's root root directory.
# This is only necessary because the way how headers are copied
# via custom copy file build phases in combination with
# header_mappings_dir interferes with xcodebuild's expectations
# about the existence of private or public headers.
#
# @return [void]
#
def create_build_phase_to_symlink_header_folders
return unless target.platform.name == :osx && header_mappings_dir
build_phase = native_target.new_shell_script_build_phase('Create Symlinks to Header Folders')
build_phase.shell_script = <<-eos.strip_heredoc
cd $CONFIGURATION_BUILD_DIR/$WRAPPER_NAME
ln -fs ${PUBLIC_HEADERS_FOLDER_PATH\#$WRAPPER_NAME/} ${PUBLIC_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
ln -fs ${PRIVATE_HEADERS_FOLDER_PATH\#\$WRAPPER_NAME/} ${PRIVATE_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
eos
end
# Creates a prefix header file which imports `UIKit` or `Cocoa` according # Creates a prefix header file which imports `UIKit` or `Cocoa` according
# to the platform of the target. This file also include any prefix header # to the platform of the target. This file also include any prefix header
# content reported by the specification of the pods. # content reported by the specification of the pods.
......
...@@ -300,10 +300,11 @@ module Pod ...@@ -300,10 +300,11 @@ module Pod
@project.add_file_reference(file, group) @project.add_file_reference(file, group)
end end
@installer.stubs(:target).returns(@pod_target) @installer.stubs(:target).returns(@pod_target)
@installer.install!
end end
it 'creates custom copy files phases for framework pods' do it 'creates custom copy files phases for framework pods' do
@installer.install!
target = @project.native_targets.first target = @project.native_targets.first
target.name.should == 'snake' target.name.should == 'snake'
...@@ -340,12 +341,34 @@ module Pod ...@@ -340,12 +341,34 @@ module Pod
end end
it 'uses relative file paths to generate umbrella header' do it 'uses relative file paths to generate umbrella header' do
content = @pod_target.umbrella_header_path.read @installer.install!
content = @pod_target.umbrella_header_path.read
content.should =~ %r{"A/Boa.h"} content.should =~ %r{"A/Boa.h"}
content.should =~ %r{"A/Garden.h"} content.should =~ %r{"A/Garden.h"}
content.should =~ %r{"A/Rattle.h"} content.should =~ %r{"A/Rattle.h"}
end end
it 'creates a build phase to symlink header folders on OS X' do
@pod_target.stubs(:platform).returns(Platform.osx)
@installer.install!
target = @project.native_targets.first
build_phase = target.shell_script_build_phases.find do |bp|
bp.name == 'Create Symlinks to Header Folders'
end
build_phase.should.not.be.nil
end
end
it "doesn't create a build phase to symlink header folders by default on OS X" do
@pod_target.stubs(:platform).returns(Platform.osx)
@installer.install!
target = @project.native_targets.first
target.shell_script_build_phases.should == []
end end
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment