Commit 82d359ce authored by Nolan Waite's avatar Nolan Waite

Auto-add libPods.a

parent 594fd0c0
...@@ -102,13 +102,31 @@ module Pod ...@@ -102,13 +102,31 @@ module Pod
root = File.dirname(projpath) root = File.dirname(projpath)
xcworkspace = File.join(root, File.basename(projpath, '.xcodeproj') + '.xcworkspace') xcworkspace = File.join(root, File.basename(projpath, '.xcodeproj') + '.xcworkspace')
workspace = Xcode::Workspace.new_from_xcworkspace(xcworkspace) workspace = Xcode::Workspace.new_from_xcworkspace(xcworkspace)
paths = [projpath] pods_projpath = File.join(config.project_pods_root, 'Pods.xcodeproj')
paths << File.join(config.project_pods_root, 'Pods.xcodeproj')
root = Pathname.new(root).expand_path root = Pathname.new(root).expand_path
paths.each do |path| [projpath, pods_projpath].each do |path|
workspace << Pathname.new(path).expand_path.relative_path_from(root) workspace << Pathname.new(path).expand_path.relative_path_from(root)
end end
workspace.save_as(xcworkspace) workspace.save_as(xcworkspace)
app_project = Xcode::Project.new(projpath)
return if app_project.files.find { |file| file.path =~ /libPods\.a$/ }
libfile = app_project.files.new({
'explicitFileType' => 'archive.ar',
'includeInIndex' => '0',
'path' => 'libPods.a',
'sourceTree' => 'BUILT_PRODUCTS_DIR'
})
lib_buildfile = app_project.build_files.find do |build_file|
build_file.file.uuid == libfile.uuid
end
app_project.objects.select_by_class(Xcode::Project::PBXFrameworksBuildPhase).each do |build_phase|
build_phase.files << lib_buildfile
end
app_project.main_group.children << libfile.uuid
app_project.save_as(projpath)
end end
end end
end end
...@@ -142,6 +142,7 @@ module Pod ...@@ -142,6 +142,7 @@ module Pod
end end
class PBXSourcesBuildPhase < PBXBuildPhase; end class PBXSourcesBuildPhase < PBXBuildPhase; end
class PBXCopyFilesBuildPhase < PBXBuildPhase; end class PBXCopyFilesBuildPhase < PBXBuildPhase; end
class PBXFrameworksBuildPhase < PBXBuildPhase; end
class PBXNativeTarget < PBXObject class PBXNativeTarget < PBXObject
attributes_accessor :buildPhases attributes_accessor :buildPhases
...@@ -236,6 +237,11 @@ module Pod ...@@ -236,6 +237,11 @@ module Pod
objects.select_by_class(PBXGroup) objects.select_by_class(PBXGroup)
end end
def main_group
project = objects[@plist['rootObject']]
objects[project.attributes['mainGroup']]
end
# Shortcut access to the `Pods' PBXGroup. # Shortcut access to the `Pods' PBXGroup.
def pods def pods
groups.find { |g| g.name == 'Pods' } groups.find { |g| g.name == 'Pods' }
......
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