Browse files

[CocoaPods/CocoaPods#904] Separate header paths for different targets…

… in .xcconfig files.
  • Loading branch information...
1 parent 3c03c85 commit 771b31c3ff42032664ea7c007b136c3af64399b2 @michaelmelanson michaelmelanson committed Nov 13, 2013
View
2 lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
@@ -46,7 +46,7 @@ def save_as(path)
def generate
@xcconfig = Xcodeproj::Config.new({
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
- 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths),
+ 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths(target.platform)),
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
})
View
6 lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb
@@ -47,7 +47,11 @@ def save_as(path)
# @return [Xcodeproj::Config]
#
def generate
- search_pahts = target.build_headers.search_paths.concat(target.sandbox.public_headers.search_paths)
+
+ target_build_headers = target.build_headers.search_paths(target.platform)
+ sandbox_public_headers = target.sandbox.public_headers.search_paths(target.platform)
+
+ search_pahts = target_build_headers.concat(sandbox_public_headers)
@drodriguez
drodriguez added a line comment Nov 16, 2013

Probably harmless, since the original code already contained the typo, but it should be paths, not pahts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
config = {
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
'PODS_ROOT' => '${SRCROOT}',
View
8 lib/cocoapods/installer/file_references_installer.rb
@@ -116,15 +116,15 @@ def link_headers
libraries.each do |library|
library.file_accessors.each do |file_accessor|
headers_sandbox = Pathname.new(file_accessor.spec.root.name)
- library.build_headers.add_search_path(headers_sandbox)
- sandbox.public_headers.add_search_path(headers_sandbox)
+ library.build_headers.add_search_path(headers_sandbox, library.platform)
+ sandbox.public_headers.add_search_path(headers_sandbox, library.platform)
header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
- library.build_headers.add_files(namespaced_path, files)
+ library.build_headers.add_files(namespaced_path, files, library.platform)
end
header_mappings(headers_sandbox, file_accessor, file_accessor.public_headers).each do |namespaced_path, files|
- sandbox.public_headers.add_files(namespaced_path, files)
+ sandbox.public_headers.add_files(namespaced_path, files, library.platform)
end
end
end
View
2 lib/cocoapods/installer/target_installer/pod_target_installer.rb
@@ -93,7 +93,7 @@ def create_xcconfig_file
path = library.xcconfig_private_path
private_gen = Generator::XCConfig::PrivatePodXCConfig.new(library, public_gen.xcconfig)
- UI.message "- Generating private xcconfig file at #{UI.path(path)}" do
+ UI.message "- Generating private xcconfig file for #{library.label} at #{UI.path(path)}" do
private_gen.save_as(path)
xcconfig_file_ref = add_file_to_support_group(path)
View
19 lib/cocoapods/sandbox/headers_store.rb
@@ -25,15 +25,17 @@ def root
def initialize(sandbox, relative_path)
@sandbox = sandbox
@relative_path = relative_path
- @search_paths = [relative_path]
+ @search_paths = []
end
# @return [Array<String>] All the search paths of the header directory in
# xcconfig format. The paths are specified relative to the pods
# root with the `${PODS_ROOT}` variable.
#
- def search_paths
- @search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" }
+ def search_paths(platform)
+ platform_path_entries = @search_paths.select {|entry| entry[:platform] == platform }
+
+ ["${PODS_ROOT}/#{@relative_path}"] + platform_path_entries.uniq.map { |entry| "${PODS_ROOT}/#{entry[:path]}" }
end
# Removes the directory as it is regenerated from scratch during each
@@ -64,8 +66,8 @@ def implode!
#
# @return [Pathname]
#
- def add_files(namespace, relative_header_paths)
- add_search_path(namespace)
+ def add_files(namespace, relative_header_paths, platform)
+ add_search_path(namespace, platform)
namespaced_path = root + namespace
namespaced_path.mkpath unless File.exist?(namespaced_path)
@@ -83,10 +85,13 @@ def add_files(namespace, relative_header_paths)
# @param [Pathname] path
# the path tho add.
#
+ # @param [String] platform
+ # the platform the search path applies to
+ #
# @return [void]
#
- def add_search_path(path)
- @search_paths << Pathname.new(@relative_path) + path
+ def add_search_path(path, platform)
+ @search_paths << {:platform => platform, :path => (Pathname.new(@relative_path) + path) }
end
#-----------------------------------------------------------------------#

0 comments on commit 771b31c

Please sign in to comment.