Commit 239c92b2 authored by Eloy Duran's avatar Eloy Duran

Copy headers first then build Pod. This ensures that Pod sources have access to…

Copy headers first then build Pod. This ensures that Pod sources have access to the same header dir structure. Fixes #70.
parent 75b072d6
...@@ -61,7 +61,7 @@ module Pod ...@@ -61,7 +61,7 @@ module Pod
"#{@definition.lib_name}.bridgesupport" "#{@definition.lib_name}.bridgesupport"
end end
# TODO move out # TODO move out to Generator::PrefixHeader
def save_prefix_header_as(pathname) def save_prefix_header_as(pathname)
pathname.open('w') do |header| pathname.open('w') do |header|
header.puts "#ifdef __OBJC__" header.puts "#ifdef __OBJC__"
...@@ -99,6 +99,12 @@ module Pod ...@@ -99,6 +99,12 @@ module Pod
end end
xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" ")) xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" "))
# Now that we have added all the source files and copy header phases,
# move the compile build phase to the end, so that headers are copied
# to the build products dir first, and thus Pod source files can enjoy
# the same namespacing of headers as the app would.
@target.move_compile_phase_to_end!
# Add all the target related support files to the group, even the copy # Add all the target related support files to the group, even the copy
# resources script although the project doesn't actually use them. # resources script although the project doesn't actually use them.
support_files_group = @project.groups.find do |group| support_files_group = @project.groups.find do |group|
......
...@@ -12,6 +12,19 @@ module Xcodeproj ...@@ -12,6 +12,19 @@ module Xcodeproj
pods.groups.new('name' => name) pods.groups.new('name' => name)
end end
class PBXNativeTarget
def move_compile_phase_to_end!
reflection = self.class.reflection(:buildPhases)
uuids = send(reflection.uuids_getter)
phase = buildPhases.find { |phase| phase.is_a?(PBXSourcesBuildPhase) }
uuids.delete(phase.uuid)
uuids << phase.uuid
phase = buildPhases.find { |phase| phase.is_a?(PBXFrameworksBuildPhase) }
uuids.delete(phase.uuid)
uuids << phase.uuid
end
end
class PBXCopyFilesBuildPhase class PBXCopyFilesBuildPhase
def self.new_pod_dir(project, pod_name, path) def self.new_pod_dir(project, pod_name, path)
new(project, nil, { new(project, nil, {
......
...@@ -17,8 +17,6 @@ describe "Pod::Installer" do ...@@ -17,8 +17,6 @@ describe "Pod::Installer" do
end end
before do before do
fixture('spec-repos/master') # ensure the archive is unpacked
@config_before = config @config_before = config
Pod::Config.instance = nil Pod::Config.instance = nil
config.silent = true config.silent = true
...@@ -46,4 +44,15 @@ describe "Pod::Installer" do ...@@ -46,4 +44,15 @@ describe "Pod::Installer" do
end end
installer.target_installers.first.bridge_support_generator.headers.should == expected installer.target_installers.first.bridge_support_generator.headers.should == expected
end end
it "moves the compile and link phases to the end of the build phases list, so Pod headers are copied first and sources can use the same header dir structure" do
podfile = Pod::Podfile.new do
platform :osx
dependency 'ASIHTTPRequest'
end
installer = Pod::Installer.new(podfile)
installer.target_installers.first.install!
phases = installer.project.targets.first.buildPhases
phases.to_a.last(2).map(&:class).should == [Xcodeproj::Project::PBXSourcesBuildPhase, Xcodeproj::Project::PBXFrameworksBuildPhase]
end
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