Commit 337ef587 authored by Fabio Pelosin's avatar Fabio Pelosin

[LocalPod] Sandbox header files.

parent 1f5c7f4a
...@@ -312,6 +312,7 @@ module Pod ...@@ -312,6 +312,7 @@ module Pod
# @return [void] Copies the pods headers to the sandbox. # @return [void] Copies the pods headers to the sandbox.
# #
def link_headers def link_headers
@sandbox.add_header_search_path(headers_sandbox)
header_mappings.each do |namespaced_path, files| header_mappings.each do |namespaced_path, files|
@sandbox.add_header_files(namespaced_path, files) @sandbox.add_header_files(namespaced_path, files)
end end
...@@ -367,13 +368,17 @@ module Pod ...@@ -367,13 +368,17 @@ module Pod
paths = paths - headers_excluded_from_search_paths paths = paths - headers_excluded_from_search_paths
paths.each do |from| paths.each do |from|
from_relative = from.relative_path_from(root) from_relative = from.relative_path_from(root)
to = spec.header_dir + spec.copy_header_mapping(from_relative) to = headers_sandbox + (spec.header_dir) + spec.copy_header_mapping(from_relative)
(mappings[to.dirname] ||= []) << from (mappings[to.dirname] ||= []) << from
end end
end end
mappings mappings
end end
def headers_sandbox
@headers_sandbox ||= Pathname.new(top_specification.name)
end
# @return [<Pathname>] The relative path of the headers that should not be # @return [<Pathname>] The relative path of the headers that should not be
# included in the linker search paths. # included in the linker search paths.
# #
......
...@@ -42,6 +42,16 @@ module Pod ...@@ -42,6 +42,16 @@ module Pod
@header_search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" } @header_search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" }
end end
# Adds an header search path to the sandbox.
#
# @param path [Pathname] The path tho add.
#
# @return [void]
#
def add_header_search_path(path)
@header_search_paths << Pathname.new(HEADERS_DIR) + path
end
def prepare_for_install def prepare_for_install
headers_root.rmtree if headers_root.exist? headers_root.rmtree if headers_root.exist?
end end
......
...@@ -192,9 +192,6 @@ module Pod ...@@ -192,9 +192,6 @@ module Pod
top_attr_accessor :license, lambda { |l| ( l.kind_of? String ) ? { :type => l } : l } top_attr_accessor :license, lambda { |l| ( l.kind_of? String ) ? { :type => l } : l }
top_attr_accessor :version, lambda { |v| Version.new(v) } top_attr_accessor :version, lambda { |v| Version.new(v) }
top_attr_accessor :authors, lambda { |a| parse_authors(a) } top_attr_accessor :authors, lambda { |a| parse_authors(a) }
top_attr_accessor :header_mappings_dir, lambda { |file| Pathname.new(file) } # If not provided the headers files are flattened
top_attr_accessor :prefix_header_file, lambda { |file| Pathname.new(file) }
top_attr_accessor :prefix_header_contents
top_attr_reader :description, lambda {|instance, ivar| ivar || instance.summary } top_attr_reader :description, lambda {|instance, ivar| ivar || instance.summary }
top_attr_writer :description top_attr_writer :description
...@@ -212,6 +209,13 @@ module Pod ...@@ -212,6 +209,13 @@ module Pod
### Attributes **with** multiple platform support ### Attributes **with** multiple platform support
# @todo allow for subspecs
#
top_attr_accessor :header_mappings_dir, lambda { |file| Pathname.new(file) } # If not provided the headers files are flattened
top_attr_accessor :prefix_header_file, lambda { |file| Pathname.new(file) }
top_attr_accessor :prefix_header_contents
pltf_chained_attr_accessor :source_files, lambda {|value, current| pattern_list(value) } pltf_chained_attr_accessor :source_files, lambda {|value, current| pattern_list(value) }
pltf_chained_attr_accessor :resources, lambda {|value, current| pattern_list(value) } pltf_chained_attr_accessor :resources, lambda {|value, current| pattern_list(value) }
pltf_chained_attr_accessor :preserve_paths, lambda {|value, current| pattern_list(value) } # Paths that should not be cleaned pltf_chained_attr_accessor :preserve_paths, lambda {|value, current| pattern_list(value) } # Paths that should not be cleaned
...@@ -224,17 +228,28 @@ module Pod ...@@ -224,17 +228,28 @@ module Pod
alias_method :framework=, :frameworks= alias_method :framework=, :frameworks=
alias_method :library=, :libraries= alias_method :library=, :libraries=
# @return The directory to namespace the headers. # @!method header_dir=
# #
# It defaults to the name of the top level specification. # @abstract The directory where to name space the headers files of
# the specification.
# #
platform_attr_writer :header_dir, lambda { |dir,_| Pathname.new(dir) } # @param [String] The headers directory.
#
platform_attr_writer :header_dir, lambda { |dir, _| Pathname.new(dir) }
# @abstract (see #header_dir=)
#
# @return [Pathname] The headers directory.
#
# @note If no value is provided it returns an empty {Pathname}.
#
def header_dir def header_dir
@header_dir[active_platform] || pod_destroot_name @header_dir[active_platform] || (@parent.header_dir if @parent) || Pathname.new('')
end end
platform_attr_writer :xcconfig, lambda {|value, current| current.tap { |c| c.merge!(value) } } # @!method xcconfig=
#
platform_attr_writer :xcconfig, lambda {|value, current| current.tap { |c| c.merge!(value) } }
def xcconfig def xcconfig
raw_xconfig.dup. raw_xconfig.dup.
...@@ -357,12 +372,6 @@ module Pod ...@@ -357,12 +372,6 @@ module Pod
end end
end end
def pod_destroot_name
if root = pod_destroot
root.basename
end
end
def self.pattern_list(patterns) def self.pattern_list(patterns)
if patterns.is_a?(Array) && (!defined?(Rake) || !patterns.is_a?(Rake::FileList)) if patterns.is_a?(Array) && (!defined?(Rake) || !patterns.is_a?(Rake::FileList))
patterns patterns
......
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