Commit 0d580d52 authored by Eloy Duran's avatar Eloy Duran

Merge remote branch 'origin/dependency-groups'

parents e2130261 70eb43dd
...@@ -17,16 +17,18 @@ module Pod ...@@ -17,16 +17,18 @@ module Pod
end end
def source_files def source_files
source_files = [] source_files = Hash.new
build_specification_sets.each do |set| build_specification_sets.each do |set|
spec = set.specification spec = set.specification
spec_files = []
spec.source_files.each do |pattern| spec.source_files.each do |pattern|
pattern = spec.pod_destroot + pattern pattern = spec.pod_destroot + pattern
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory? pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
pattern.glob.each do |file| pattern.glob.each do |file|
source_files << file.relative_path_from(config.project_pods_root) spec_files << file.relative_path_from(config.project_pods_root)
end end
end end
source_files[spec.name] = spec_files
end end
source_files source_files
end end
...@@ -46,7 +48,12 @@ module Pod ...@@ -46,7 +48,12 @@ module Pod
end end
def generate_project def generate_project
source_files.each { |file| xcodeproj.add_source_file(file) } source_files.each do |group, files|
xcodeproj.add_group(group)
files.each do |file|
xcodeproj.add_source_file(file, group)
end
end
build_specification_sets.each do |set| build_specification_sets.each do |set|
xcconfig << set.specification.xcconfig xcconfig << set.specification.xcconfig
end end
...@@ -56,7 +63,9 @@ module Pod ...@@ -56,7 +63,9 @@ module Pod
# before #generate_project is called! # before #generate_project is called!
def install! def install!
puts "Installing dependencies of: #{@specification.defined_in_file}" unless config.silent? puts "Installing dependencies of: #{@specification.defined_in_file}" unless config.silent?
build_specification_sets.each { |set| set.specification.install! } build_specification_sets.each do |set|
set.specification.install!
end
generate_project generate_project
xcodeproj.create_in(config.project_pods_root) xcodeproj.create_in(config.project_pods_root)
xcconfig.create_in(config.project_pods_root) xcconfig.create_in(config.project_pods_root)
......
...@@ -50,9 +50,9 @@ module Pod ...@@ -50,9 +50,9 @@ module Pod
end.compact end.compact
end end
def add_source_file(file, compiler_flags = nil) def add_source_file(file, group = 'Pods', compiler_flags = nil)
file_ref_uuid = add_file_reference(file, 'SOURCE_ROOT') file_ref_uuid = add_file_reference(file, 'SOURCE_ROOT')
add_file_to_group(file_ref_uuid, 'Pods') add_object_to_group(file_ref_uuid, group)
if file.extname == '.h' if file.extname == '.h'
build_file_uuid = add_build_file(file_ref_uuid, "settings" => { "ATTRIBUTES" => ["Public"] }) build_file_uuid = add_build_file(file_ref_uuid, "settings" => { "ATTRIBUTES" => ["Public"] })
# Working around a bug in Xcode 4.2 betas, remove this once the Xcode bug is fixed: # Working around a bug in Xcode 4.2 betas, remove this once the Xcode bug is fixed:
...@@ -66,6 +66,16 @@ module Pod ...@@ -66,6 +66,16 @@ module Pod
end end
file_ref_uuid file_ref_uuid
end end
def add_group(name)
group_uuid = add_object({
"name" => name,
"isa" => "PBXGroup",
"sourceTree" => "<group>",
"children" => []
})
add_object_to_group(group_uuid, 'Pods')
end
def create_in(pods_root) def create_in(pods_root)
puts " * Copying contents of template directory `#{@template_dir}' to `#{pods_root}'" if config.verbose? puts " * Copying contents of template directory `#{@template_dir}' to `#{pods_root}'" if config.verbose?
...@@ -91,7 +101,7 @@ module Pod ...@@ -91,7 +101,7 @@ module Pod
"path" => path.to_s, "path" => path.to_s,
}) })
end end
def add_build_file(file_ref_uuid, extra = {}) def add_build_file(file_ref_uuid, extra = {})
add_object(extra.merge({ add_object(extra.merge({
"isa" => "PBXBuildFile", "isa" => "PBXBuildFile",
...@@ -104,11 +114,11 @@ module Pod ...@@ -104,11 +114,11 @@ module Pod
object['files'] << build_file_uuid object['files'] << build_file_uuid
end end
def add_file_to_group(file_ref_uuid, name) def add_object_to_group(object_ref_uuid, name)
object_uuid, object = objects.find do |_, object| object_uuid, object = objects.find do |_, object|
object['isa'] == 'PBXGroup' && object['name'] == name object['isa'] == 'PBXGroup' && object['name'] == name
end end
object['children'] << file_ref_uuid object['children'] << object_ref_uuid
end end
def objects def objects
......
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