Commit 9ea008e3 authored by Eloy Duran's avatar Eloy Duran

Clean template related code a bit by using the API.

parent 9ee4b9b5
......@@ -212,26 +212,17 @@ module Pod
config.baseConfiguration = configfile
end
end
app_project.main_group << configfile
libfile = app_project.files.new({
'path' => 'libPods.a',
'lastKnownFileType' => 'archive.ar',
'includeInIndex' => '0',
'sourceTree' => 'BUILT_PRODUCTS_DIR'
})
libfile = app_project.files.new_static_library('Pods')
app_project.objects.select_by_class(Xcode::Project::PBXFrameworksBuildPhase).each do |build_phase|
build_phase.files << libfile.buildFiles.new
end
app_project.main_group << libfile
copy_resources = app_project.objects.add(Xcode::Project::PBXShellScriptBuildPhase, {
'name' => 'Copy Pods Resources',
'buildActionMask' => '2147483647',
'files' => [],
'inputPaths' => [],
'outputPaths' => [],
'runOnlyForDeploymentPostprocessing' => '0',
'shellPath' => '/bin/sh',
'shellScript' => "${SRCROOT}/Pods/Pods-resources.sh\n"
})
......
......@@ -10,31 +10,22 @@ module Pod
'developmentRegion' => 'English',
'hasScannedForEncodings' => '0',
'knownRegions' => ['en'],
'mainGroup' => project.groups.new({ 'sourceTree' => '<group>' }).uuid,
'mainGroup' => project.groups.new.uuid,
'projectDirPath' => '',
'projectRoot' => '',
'targets' => []
})
project.root_object = root
project.main_group << project.groups.new({
'name' => 'Pods',
'sourceTree' => '<group>'
})
project.main_group << project.groups.new('name' => 'Pods')
framework = project.files.new({
'lastKnownFileType' => 'wrapper.framework',
'name' => platform == :ios ? 'Foundation.framework' : 'Cocoa.framework',
'path' => "System/Library/Frameworks/#{platform == :ios ? 'Framework' : 'Cocoa'}.framework",
'sourceTree' => 'SDKROOT'
})
framework.group = project.groups.new({
'name' => 'Frameworks',
'sourceTree' => '<group>'
})
framework.group = project.groups.new('name' => 'Frameworks')
project.main_group << framework.group
products = project.groups.new({
'name' => 'Products',
'sourceTree' => '<group>'
})
products = project.groups.new('name' => 'Products')
project.main_group << products
project.root_object.products = products
......
......@@ -238,6 +238,15 @@ module Pod
has_many :buildFiles, :inverse_of => :file
has_one :group, :inverse_of => :children
def self.new_static_library(project, productName)
new(project, nil, {
"path" => "lib#{productName}.a",
"includeInIndex" => "0", # no idea what this is
"explicitFileType" => "archive.ar",
"sourceTree" => "BUILT_PRODUCTS_DIR",
})
end
def initialize(project, uuid, attributes)
is_new = uuid.nil?
super
......@@ -359,9 +368,7 @@ module Pod
def self.new_static_library(project, productName)
# TODO should probably switch the uuid and attributes argument
target = new(project, nil, 'productType' => STATIC_LIBRARY, 'productName' => productName)
target.product.path = "lib#{productName}.a"
target.product.includeInIndex = "0" # no idea what this is
target.product.explicitFileType = "archive.ar"
target.product = project.files.new_static_library(productName)
target.buildPhases.add(PBXSourcesBuildPhase)
buildPhase = target.buildPhases.add(PBXFrameworksBuildPhase)
......@@ -373,6 +380,8 @@ module Pod
target
end
# You need to specify a product. For a static library you can use
# PBXFileReference.new_static_library.
def initialize(project, *)
super
self.name ||= productName
......@@ -386,11 +395,12 @@ module Pod
buildConfigurationList.buildConfigurations.new('name' => 'Debug')
buildConfigurationList.buildConfigurations.new('name' => 'Release')
end
end
unless product
self.product = project.files.new('sourceTree' => 'BUILT_PRODUCTS_DIR')
product.group = project.products
end
alias_method :_product=, :product=
def product=(product)
self._product = product
product.group = @project.products
end
def buildConfigurations
......
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