Commit e9261526 authored by Fabio Pelosin's avatar Fabio Pelosin

[Specification] support for `header_mappings_dir` in subspecs.

parent 9986aa4c
...@@ -429,9 +429,10 @@ module Pod ...@@ -429,9 +429,10 @@ module Pod
mappings = {} mappings = {}
files_by_spec.each do |spec, paths| files_by_spec.each do |spec, paths|
paths = paths - headers_excluded_from_search_paths paths = paths - headers_excluded_from_search_paths
dir = spec.header_dir ? (headers_sandbox + spec.header_dir) : headers_sandbox
paths.each do |from| paths.each do |from|
from_relative = from.relative_path_from(root) from_relative = from.relative_path_from(root)
to = headers_sandbox + (spec.header_dir) + spec.copy_header_mapping(from_relative) to = dir + spec.copy_header_mapping(from_relative)
(mappings[to.dirname] ||= []) << from (mappings[to.dirname] ||= []) << from
end end
end end
......
...@@ -54,6 +54,7 @@ module Pod ...@@ -54,6 +54,7 @@ module Pod
@xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new } @xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new }
@header_dir = { :ios => nil, :osx => nil } @header_dir = { :ios => nil, :osx => nil }
@requires_arc = { :ios => nil, :osx => nil } @requires_arc = { :ios => nil, :osx => nil }
@header_mappings_dir = { :ios => nil, :osx => nil }
yield self if block_given? yield self if block_given?
end end
...@@ -88,6 +89,7 @@ module Pod ...@@ -88,6 +89,7 @@ module Pod
# Returns the value of the attribute for the active platform # Returns the value of the attribute for the active platform
# chained with the upstream specifications. The ivar must store # chained with the upstream specifications. The ivar must store
# the platform specific values as an array. # the platform specific values as an array.
#
def self.pltf_chained_attr_reader(attr) def self.pltf_chained_attr_reader(attr)
define_method(attr) do define_method(attr) do
active_plaform_check active_plaform_check
...@@ -96,6 +98,17 @@ module Pod ...@@ -96,6 +98,17 @@ module Pod
end end
end end
# Returns the first value defined of the attribute traversing the chain
# upwards.
#
def self.pltf_first_defined_attr_reader(attr)
define_method(attr) do
active_plaform_check
ivar_value = instance_variable_get("@#{attr}")[active_platform]
ivar_value || (@parent.send(attr) if @parent)
end
end
def active_plaform_check def active_plaform_check
raise Informative, "#{self.inspect} not activated for a platform before consumption." unless active_platform raise Informative, "#{self.inspect} not activated for a platform before consumption." unless active_platform
end end
...@@ -240,13 +253,11 @@ module Pod ...@@ -240,13 +253,11 @@ module Pod
### Attributes **with** multiple platform support ### Attributes **with** multiple platform support
# @todo allow for subspecs # @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_file, lambda { |file| Pathname.new(file) }
top_attr_accessor :prefix_header_contents 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 :public_header_files, lambda {|value, current| pattern_list(value) } pltf_chained_attr_accessor :public_header_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) }
...@@ -262,7 +273,6 @@ module Pod ...@@ -262,7 +273,6 @@ module Pod
alias_method :weak_framework=, :weak_frameworks= alias_method :weak_framework=, :weak_frameworks=
alias_method :library=, :libraries= alias_method :library=, :libraries=
# @!method requires_arc= # @!method requires_arc=
# #
# @abstract Wether the `-fobjc-arc' flag should be added to the compiler # @abstract Wether the `-fobjc-arc' flag should be added to the compiler
...@@ -271,14 +281,7 @@ module Pod ...@@ -271,14 +281,7 @@ module Pod
# @param [Bool] Wether the source files require ARC. # @param [Bool] Wether the source files require ARC.
# #
platform_attr_writer :requires_arc platform_attr_writer :requires_arc
pltf_first_defined_attr_reader :requires_arc
def requires_arc
requires_arc = @requires_arc[active_platform]
if requires_arc.nil?
requires_arc = @parent ? @parent.requires_arc : false
end
requires_arc
end
# @!method header_dir= # @!method header_dir=
# #
...@@ -288,16 +291,12 @@ module Pod ...@@ -288,16 +291,12 @@ module Pod
# @param [String] The headers directory. # @param [String] The headers directory.
# #
platform_attr_writer :header_dir, lambda { |dir, _| Pathname.new(dir) } platform_attr_writer :header_dir, lambda { |dir, _| Pathname.new(dir) }
pltf_first_defined_attr_reader :header_dir
# @abstract (see #header_dir=) # If not provided the headers files are flattened
#
# @return [Pathname] The headers directory.
# #
# @note If no value is provided it returns an empty {Pathname}. platform_attr_writer :header_mappings_dir, lambda { |file, _| Pathname.new(file) }
# pltf_first_defined_attr_reader :header_mappings_dir
def header_dir
@header_dir[active_platform] || (@parent.header_dir if @parent) || Pathname.new('')
end
# @!method xcconfig= # @!method xcconfig=
# #
......
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