Commit 170fa2e4 authored by Fabio Pelosin's avatar Fabio Pelosin

[LocalPod] Fix xcconfig generation.

parent 6ee55e15
......@@ -9,7 +9,7 @@ GIT
GIT
remote: git://github.com/CocoaPods/Xcodeproj.git
revision: e3dc945c7fdbbd9f977f6bc14b3e6023b99dc5e1
revision: 9acba540a10bb50e69f4fb95052885d53ce76e1f
specs:
xcodeproj (0.4.0)
activesupport (~> 3.2.6)
......
......@@ -43,11 +43,9 @@ module Pod
# @note The value `PODS_HEADERS_SEARCH_PATHS` is used to store the headers
# so xcconfig can reference the variable.
#
# @todo Add Xcodeproj::Config#[]
#
def generate
ld_flags = '-ObjC'
if set_arc_compatibility_flag && pods.any? { |pod| pod.requires_arc? }
if set_arc_compatibility_flag && pods.map(&:specifications).flatten.any? { |pod| pod.requires_arc }
ld_flags << ' -fobjc-arc'
end
......
......@@ -115,6 +115,10 @@ module Pod
top_specification.name
end
#--------------------------------------#
public
# @!group Installation
# Creates the root path of the pod.
......@@ -194,6 +198,10 @@ module Pod
files
end
#--------------------------------------#
public
# @!group Files
# @return [Pathname] Returns the relative path from the sandbox.
......@@ -237,7 +245,6 @@ module Pod
result
end
# Finds the source files that every activated {Specification} requires.
#
# @note If the same file is required by two specifications the one at the
......@@ -377,15 +384,19 @@ module Pod
end
end
# @todo check implementation
#--------------------------------------#
public
# @return [Xcodeproj::Config] the configuration for the Pod.
#
def xcconfig
config = Xcodeproj::Config.new
specifications.each do |s|
config.merge(s.xcconfig)
config.libraries.merge(s.libraries)
config.frameworks.merge(s.frameworks)
config.weak_frameworks.merge(s.weak_frameworks)
specifications.each do |spec|
config.merge!(spec.xcconfig)
config.libraries.merge(spec.libraries)
config.frameworks.merge(spec.frameworks)
config.weak_frameworks.merge(spec.weak_frameworks)
end
config
end
......@@ -422,6 +433,10 @@ module Pod
result
end
#--------------------------------------#
public
# @!group Xcodeproj integration
# Adds the file references, to the given `Pods.xcodeproj` project, for the
......@@ -458,8 +473,6 @@ module Pod
# @raise If the {#add_file_references_to_project} was not called before of
# calling this method.
#
# @todo Check compiler flags implementation and xcconfig implementation.
#
# @return [void]
#
def add_build_files_to_target(target)
......@@ -490,18 +503,14 @@ module Pod
end
end
# @return Whether the pod requires ARC.
#
# TODO: this should be not used anymore.
#
def requires_arc?
top_specification.requires_arc
end
#--------------------------------------#
private
# @!group Private helpers
# @return [Array<Pathname>] The implementation files
# (the files the need to compiled) of the pod.
# (the files the need to compiled) of the pod.
#
def implementation_files
relative_source_files.reject { |f| f.extname == '.h' || f.extname == '.hpp' || f.extname == '.hh' }
......@@ -517,17 +526,13 @@ module Pod
# folders as the keys and the absolute paths of the header files as
# the values.
#
# @todo This is being overridden in the RestKit 0.9.4 spec, need to do
# something with that, and this method also still exists in
# Specification.
#
# @todo This is not overridden anymore in specification refactor and the
# code Pod::Specification#copy_header_mapping can be moved here.
# @todo This is being overridden in the RestKit 0.9.4 spec and that
# override should be fixed.
#
def header_mappings(files_by_spec)
mappings = {}
files_by_spec.each do |spec, paths|
paths = paths - headers_excluded_from_search_paths
paths = paths
dir = spec.header_dir ? (headers_sandbox + spec.header_dir) : headers_sandbox
paths.each do |from|
from_relative = from.relative_path_from(root)
......@@ -539,22 +544,12 @@ module Pod
end
# @return [<Pathname>] The name of the folder where the headers of this pod
# will be namespaced.
# will be namespaced.
#
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.
#
def headers_excluded_from_search_paths
#TODO
# paths = paths_by_spec(:exclude_header_search_paths, '*.{h,hpp,hh}')
# paths.values.compact.uniq
[]
end
# @!group Paths Patterns
# The paths obtained by resolving the patterns of an attribute
......@@ -588,13 +583,13 @@ module Pod
# Converts patterns of paths to the {Pathname} of the files present in the
# pod.
#
# @param [String, FileList, Array<String, Pathname>] patterns
# @param [String, FileList, Array<String>] patterns
# The patterns to expand.
#
# @param [String] dir_pattern
# The pattern to add to directories.
#
# @param [String] exclude_patterns
# @param [Array<String>] exclude_patterns
# The exclude patterns to pass to the PathList.
#
# @raise [Informative] If the pod does not exists.
......@@ -615,6 +610,10 @@ module Pod
patterns = [ patterns ] if patterns.is_a?(String)
file_lists = patterns.select { |p| p.is_a?(FileList) }
unless file_lists.empty?
UI.warn "[#{name}] The usage of Rake FileList is deprecated. Use `exclude_files`."
end
glob_patterns = patterns - file_lists
result = []
......@@ -629,6 +628,8 @@ module Pod
result.flatten.compact.uniq
end
#-------------------------------------------------------------------------#
# A {LocalSourcedPod} is a {LocalPod} that interacts with the files of
# a folder controlled by the users. As such this class does not alter
# in any way the contents of the folder.
......
......@@ -36,7 +36,7 @@ module Pod
end
it "configures the project to load all members that implement Objective-c classes or categories from the static library" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should == '-ObjC'
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
end
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' 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