Commit 70eb43dd authored by Joshua Weinberg's avatar Joshua Weinberg

Place dependencies into their own project groups

parent 1329f3c5
......@@ -17,16 +17,18 @@ module Pod
end
def source_files
source_files = []
source_files = Hash.new
build_specification_sets.each do |set|
spec = set.specification
spec_files = []
spec.source_files.each do |pattern|
pattern = spec.pod_destroot + pattern
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
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
source_files[spec.name] = spec_files
end
source_files
end
......@@ -46,7 +48,12 @@ module Pod
end
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|
xcconfig << set.specification.xcconfig
end
......@@ -56,7 +63,9 @@ module Pod
# before #generate_project is called!
def install!
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
xcodeproj.create_in(config.project_pods_root)
xcconfig.create_in(config.project_pods_root)
......
......@@ -50,9 +50,9 @@ module Pod
end.compact
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')
add_file_to_group(file_ref_uuid, 'Pods')
add_object_to_group(file_ref_uuid, group)
if file.extname == '.h'
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:
......@@ -67,6 +67,16 @@ module Pod
file_ref_uuid
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)
puts " * Copying contents of template directory `#{@template_dir}' to `#{pods_root}'" if config.verbose?
FileUtils.cp_r("#{@template_dir}/.", pods_root)
......@@ -104,11 +114,11 @@ module Pod
object['files'] << build_file_uuid
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['isa'] == 'PBXGroup' && object['name'] == name
end
object['children'] << file_ref_uuid
object['children'] << object_ref_uuid
end
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