Commit d7d3d785 authored by Fabio Pelosin's avatar Fabio Pelosin

[LocalPod] Support for header dir specification in subspecs.

The change is small refactoring to make clear which methods
return relative paths.
parent d4bc7371
......@@ -51,4 +51,5 @@ end
if ENV['COCOA_PODS_ENV'] == 'development'
require 'pry'
require 'awesome_print'
require 'ruby-prof'
end
......@@ -406,7 +406,7 @@ module Pod
def file_patterns_errors
messages = []
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 exclude_header_search_paths did not match any file" if !@spec.exclude_header_search_paths.empty? && @pod.headers_excluded_from_search_paths.empty?
messages
......
......@@ -29,7 +29,7 @@ module Pod
pods.each do |pod|
# Add all source files to the project grouped by pod
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)
end
end
......
......@@ -20,12 +20,12 @@ module Pod
end
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
def bridge_support_generator_for(pods, sandbox)
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
......
This diff is collapsed.
......@@ -38,10 +38,18 @@ module Pod
end
# 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 => [] } )
end
@xcconfig = { :ios => Xcodeproj::Config.new, :osx => Xcodeproj::Config.new }
@header_dir = { :ios => nil, :osx => nil }
yield self if block_given?
end
......@@ -122,6 +130,7 @@ module Pod
libraries=
compiler_flags=
deployment_target=
header_dir=
dependency }.each do |method|
define_method(method) do |args|
@specification._on_platform(@platform) do
......@@ -190,9 +199,6 @@ module Pod
top_attr_reader :description, lambda {|instance, ivar| ivar || instance.summary }
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=
def self.parse_authors(*names_and_email_addresses)
......@@ -218,6 +224,16 @@ module Pod
alias_method :framework=, :frameworks=
alias_method :library=, :libraries=
# @return The directory to namespace the headers.
#
# It defaults to the name of the top level specification.
#
platform_attr_writer :header_dir, lambda { |dir,_| Pathname.new(dir) }
def header_dir
@header_dir[active_platform] || pod_destroot_name
end
platform_attr_writer :xcconfig, lambda {|value, current| current.tap { |c| c.merge!(value) } }
def xcconfig
......
......@@ -31,12 +31,29 @@ describe Pod::LocalPod do
end
it 'returns an expanded list of source files, relative to the sandbox root' do
@pod.source_files.sort.should == [
@pod.relative_source_files.sort.should == [
Pathname.new("BananaLib/Classes/Banana.m"),
Pathname.new("BananaLib/Classes/Banana.h")
].sort
end
it 'returns the source files groupped by specification' do
files = @pod.source_files_by_spec[@pod.specifications.first].sort
files.should == [
@pod.root + "Classes/Banana.m",
@pod.root + "Classes/Banana.h"
].sort
end
it 'returns a list of header files' do
@pod.relative_header_files.should == [Pathname.new("BananaLib/Classes/Banana.h")]
end
it 'returns a list of header files by specification' do
files = @pod.header_files_by_spec[@pod.specifications.first].sort
files.should == [ @pod.root + "Classes/Banana.h" ]
end
it 'returns an expanded list the files to clean' do
clean_paths = @pod.clean_paths.map { |p| p.to_s.gsub(/.*Pods\/BananaLib/,'') }
clean_paths.should.include "/.git/config"
......@@ -46,11 +63,7 @@ describe Pod::LocalPod do
end
it 'returns an expanded list of resources, relative to the sandbox root' do
@pod.resources.should == [Pathname.new("BananaLib/Resources/logo-sidebar.png")]
end
it 'returns a list of header files' do
@pod.header_files.should == [Pathname.new("BananaLib/Classes/Banana.h")]
@pod.relative_resource_files.should == [Pathname.new("BananaLib/Resources/logo-sidebar.png")]
end
it "can link it's headers into the sandbox" do
......
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