Commit 16a324a7 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #347 from CocoaPods/t-296

Support for `header_dir` attr in subspecs.
parents d4bc7371 f4326c73
...@@ -13,6 +13,7 @@ examples/Pods ...@@ -13,6 +13,7 @@ examples/Pods
examples/**/Pods examples/**/Pods
examples/RelativePathProject/RelativePathProject/RelativePathProject.xcodeproj examples/RelativePathProject/RelativePathProject/RelativePathProject.xcodeproj
spec/fixtures/banana-lib spec/fixtures/banana-lib
spec/fixtures/chameleon
spec/fixtures/integration/Headers/ spec/fixtures/integration/Headers/
/concatenated.* /concatenated.*
spec/fixtures/mercurial-repo/.hg/*cache spec/fixtures/mercurial-repo/.hg/*cache
......
...@@ -145,7 +145,7 @@ namespace :gem do ...@@ -145,7 +145,7 @@ namespace :gem do
# Update the last version in CocoaPods-version.yml # Update the last version in CocoaPods-version.yml
specs_branch = '0.6' specs_branch = '0.6'
Dir.chdir ('../Specs') do Dir.chdir('../Specs') do
puts Dir.pwd puts Dir.pwd
sh "git checkout #{specs_branch}" sh "git checkout #{specs_branch}"
sh "git pull" sh "git pull"
......
...@@ -406,7 +406,7 @@ module Pod ...@@ -406,7 +406,7 @@ module Pod
def file_patterns_errors def file_patterns_errors
messages = [] messages = []
messages << "The sources did not match any file" if !@spec.source_files.empty? && @pod.source_files.empty? messages << "The sources did not match any file" if !@spec.source_files.empty? && @pod.source_files.empty?
messages << "The resources did not match any file" if !@spec.resources.empty? && @pod.resources.empty? messages << "The resources did not match any file" if !@spec.resources.empty? && @pod.resource_files.empty?
messages << "The preserve_paths did not match any file" if !@spec.preserve_paths.empty? && @pod.preserve_paths.empty? messages << "The preserve_paths did not match any file" if !@spec.preserve_paths.empty? && @pod.preserve_paths.empty?
messages << "The exclude_header_search_paths did not match any file" if !@spec.exclude_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty? messages << "The exclude_header_search_paths did not match any file" if !@spec.exclude_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?
messages messages
......
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
pods.each do |pod| pods.each do |pod|
# Add all source files to the project grouped by pod # Add all source files to the project grouped by pod
group = @project.add_pod_group(pod.name) group = @project.add_pod_group(pod.name)
pod.source_files.each do |path| pod.relative_source_files.each do |path|
group.files.new('path' => path.to_s) group.files.new('path' => path.to_s)
end end
end end
......
...@@ -20,12 +20,12 @@ module Pod ...@@ -20,12 +20,12 @@ module Pod
end end
def copy_resources_script_for(pods) def copy_resources_script_for(pods)
@copy_resources_script ||= Generator::CopyResourcesScript.new(pods.map { |p| p.resources }.flatten) @copy_resources_script ||= Generator::CopyResourcesScript.new(pods.map { |p| p.relative_resource_files }.flatten)
end end
def bridge_support_generator_for(pods, sandbox) def bridge_support_generator_for(pods, sandbox)
Generator::BridgeSupport.new(pods.map do |pod| Generator::BridgeSupport.new(pods.map do |pod|
pod.header_files.map { |header| sandbox.root + header } pod.relative_header_files.map { |header| sandbox.root + header }
end.flatten) end.flatten)
end end
......
This diff is collapsed.
...@@ -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
......
...@@ -38,10 +38,18 @@ module Pod ...@@ -38,10 +38,18 @@ module Pod
end end
# multi-platform attributes # multi-platform attributes
%w[ source_files resources preserve_paths exclude_header_search_paths frameworks libraries dependencies compiler_flags].each do |attr| %w[ source_files
resources
preserve_paths
exclude_header_search_paths
frameworks
libraries
dependencies
compiler_flags ].each do |attr|
instance_variable_set( "@#{attr}", { :ios => [], :osx => [] } ) instance_variable_set( "@#{attr}", { :ios => [], :osx => [] } )
end end
@xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new } @xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new }
@header_dir = { :ios => nil, :osx => nil }
yield self if block_given? yield self if block_given?
end end
...@@ -122,6 +130,7 @@ module Pod ...@@ -122,6 +130,7 @@ module Pod
libraries= libraries=
compiler_flags= compiler_flags=
deployment_target= deployment_target=
header_dir=
dependency }.each do |method| dependency }.each do |method|
define_method(method) do |args| define_method(method) do |args|
@specification._on_platform(@platform) do @specification._on_platform(@platform) do
...@@ -183,16 +192,10 @@ module Pod ...@@ -183,16 +192,10 @@ 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
top_attr_reader :header_dir, lambda {|instance, ivar| ivar || instance.pod_destroot_name }
top_attr_writer :header_dir, lambda {|dir| Pathname.new(dir) }
alias_method :author=, :authors= alias_method :author=, :authors=
def self.parse_authors(*names_and_email_addresses) def self.parse_authors(*names_and_email_addresses)
...@@ -206,6 +209,13 @@ module Pod ...@@ -206,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
...@@ -218,7 +228,28 @@ module Pod ...@@ -218,7 +228,28 @@ module Pod
alias_method :framework=, :frameworks= alias_method :framework=, :frameworks=
alias_method :library=, :libraries= alias_method :library=, :libraries=
platform_attr_writer :xcconfig, lambda {|value, current| current.tap { |c| c.merge!(value) } } # @!method header_dir=
#
# @abstract The directory where to name space the headers files of
# the specification.
#
# @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] || (@parent.header_dir if @parent) || Pathname.new('')
end
# @!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.
...@@ -341,12 +372,6 @@ module Pod ...@@ -341,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
......
This diff is collapsed.
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