Permalink
Browse files

[LocalPod] Sandbox header files.

  • Loading branch information...
1 parent 1f5c7f4 commit 337ef587623d5e99e425d033fdacae6e15e216a5 @fabiopelosin fabiopelosin committed Jun 21, 2012
Showing with 39 additions and 15 deletions.
  1. +6 −1 lib/cocoapods/local_pod.rb
  2. +10 −0 lib/cocoapods/sandbox.rb
  3. +23 −14 lib/cocoapods/specification.rb
@@ -312,6 +312,7 @@ def all_specs_public_header_files
# @return [void] Copies the pods headers to the sandbox.
#
def link_headers
+ @sandbox.add_header_search_path(headers_sandbox)
header_mappings.each do |namespaced_path, files|
@sandbox.add_header_files(namespaced_path, files)
end
@@ -367,13 +368,17 @@ def header_mappings
paths = paths - headers_excluded_from_search_paths
paths.each do |from|
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
end
end
mappings
end
+ def headers_sandbox
+ @headers_sandbox ||= Pathname.new(top_specification.name)
+ end
+
# @return [<Pathname>] The relative path of the headers that should not be
# included in the linker search paths.
#
View
@@ -42,6 +42,16 @@ def header_search_paths
@header_search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" }
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
headers_root.rmtree if headers_root.exist?
end
@@ -192,9 +192,6 @@ def available_platforms
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 :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_writer :description
@@ -212,6 +209,13 @@ def self.parse_authors(*names_and_email_addresses)
### 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 :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
@@ -224,17 +228,28 @@ def self.parse_authors(*names_and_email_addresses)
alias_method :framework=, :frameworks=
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
- @header_dir[active_platform] || pod_destroot_name
+ @header_dir[active_platform] || (@parent.header_dir if @parent) || Pathname.new('')
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
raw_xconfig.dup.
@@ -357,12 +372,6 @@ def pod_destroot
end
end
- def pod_destroot_name
- if root = pod_destroot
- root.basename
- end
- end
-
def self.pattern_list(patterns)
if patterns.is_a?(Array) && (!defined?(Rake) || !patterns.is_a?(Rake::FileList))
patterns

0 comments on commit 337ef58

Please sign in to comment.