Commit 694a7047 authored by Eloy Duran's avatar Eloy Duran

Start specifying the objects a (static library) target requires.

parent 6b9e1931
...@@ -131,34 +131,53 @@ module Pod ...@@ -131,34 +131,53 @@ module Pod
end end
class PBXBuildPhase < PBXObject class PBXBuildPhase < PBXObject
attributes_accessor :files attributes_accessor :files, :buildActionMask, :runOnlyForDeploymentPostprocessing
alias_method :file_uuids, :files alias_method :file_uuids, :files
alias_method :file_uuids=, :files= alias_method :file_uuids=, :files=
def initialize(project, uuid, attributes) def initialize(*)
super super
self.file_uuids ||= [] self.file_uuids ||= []
# These are always the same, no idea what they are.
self.buildActionMask ||= "2147483647"
self.runOnlyForDeploymentPostprocessing ||= "0"
end end
def files def files
list_by_class(file_uuids, PBXBuildFile) list_by_class(file_uuids, PBXBuildFile)
end end
end end
class PBXCopyFilesBuildPhase < PBXBuildPhase
attributes_accessor :dstPath, :dstSubfolderSpec
def initialize(*)
super
self.dstSubfolderSpec ||= "16"
end
end
class PBXSourcesBuildPhase < PBXBuildPhase; end class PBXSourcesBuildPhase < PBXBuildPhase; end
class PBXCopyFilesBuildPhase < PBXBuildPhase; end
class PBXFrameworksBuildPhase < PBXBuildPhase; end class PBXFrameworksBuildPhase < PBXBuildPhase; end
class PBXShellScriptBuildPhase < PBXBuildPhase class PBXShellScriptBuildPhase < PBXBuildPhase
attributes_accessor :shellScript attributes_accessor :shellScript
end end
class PBXNativeTarget < PBXObject class PBXNativeTarget < PBXObject
attributes_accessor :buildPhases, :buildConfigurationList attributes_accessor :productName, :productReference, :productType, :buildPhases, :buildRules, :dependencies, :buildConfigurationList
alias_method :build_phase_uuids, :buildPhases alias_method :build_phase_uuids, :buildPhases
alias_method :build_phase_uuids=, :buildPhases= alias_method :build_phase_uuids=, :buildPhases=
alias_method :build_configuration_list_uuid, :buildConfigurationList alias_method :build_configuration_list_uuid, :buildConfigurationList
alias_method :build_configuration_list_uuid=, :buildConfigurationList= alias_method :build_configuration_list_uuid=, :buildConfigurationList=
def initialize(project, uuid, attributes)
super
self.buildPhases ||= []
# TODO self.buildConfigurationList ||= new list?
#self.buildRules ||= []
#self.dependencies ||= []
end
def buildPhases def buildPhases
list_by_class(build_phase_uuids, PBXBuildPhase) list_by_class(build_phase_uuids, PBXBuildPhase)
end end
......
...@@ -145,31 +145,29 @@ else ...@@ -145,31 +145,29 @@ else
project.source_files.should == installer.xcodeproj.source_files project.source_files.should == installer.xcodeproj.source_files
end end
it "creates a project with multiple targets" do #it "creates a project with multiple targets" do
Pod::Source.reset! #Pod::Source.reset!
Pod::Spec::Set.reset! #Pod::Spec::Set.reset!
podfile = Pod::Podfile.new do #podfile = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load ## first ensure that the correct info is available to the specs when they load
config.rootspec = self #config.rootspec = self
self.platform platform #self.platform platform
target(:debug) { dependency 'SSZipArchive' } #target(:debug) { dependency 'SSZipArchive' }
target(:test, :exclusive => true) { dependency 'JSONKit' } #target(:test, :exclusive => true) { dependency 'JSONKit' }
dependency 'ASIHTTPRequest' #dependency 'ASIHTTPRequest'
end #end
installer = Pod::Installer.new(podfile) #installer = Pod::Installer.new(podfile)
installer.install! #installer.install!
puts "\n[!] Compiling static library..." #puts "\n[!] Compiling static library..."
Dir.chdir(config.project_pods_root) do #Dir.chdir(config.project_pods_root) do
puts `ls -l` ##system("xcodebuild -target Pods").should == true
#system("xcodebuild > /dev/null 2>&1").should == true #system("xcodebuild -target Pods-debug").should == true
system("xcodebuild -target Pods").should == true #system("xcodebuild -target Pods-test").should == true
system("xcodebuild -target Pods-debug").should == true #end
system("xcodebuild -target Pods-test").should == true #end
end
end
it "sets up an existing project with pods" do it "sets up an existing project with pods" do
basename = platform == :ios ? 'iPhone' : 'Mac' basename = platform == :ios ? 'iPhone' : 'Mac'
......
...@@ -50,6 +50,88 @@ describe "Pod::Xcode::Project" do ...@@ -50,6 +50,88 @@ describe "Pod::Xcode::Project" do
end end
end end
describe "a new PBXBuildPhase" do
before do
@phase = @project.objects.add(Pod::Xcode::Project::PBXBuildPhase)
end
it "has an empty list of files" do
@phase.files.to_a.should == []
end
it "always returns the same buildActionMask (no idea what it is)" do
@phase.buildActionMask.should == "2147483647"
end
it "always returns zero for runOnlyForDeploymentPostprocessing (no idea what it is)" do
@phase.runOnlyForDeploymentPostprocessing.should == "0"
end
end
describe "a new PBXCopyFilesBuildPhase" do
before do
@phase = @project.objects.add(Pod::Xcode::Project::PBXCopyFilesBuildPhase, 'dstPath' => 'some/path')
end
it "is a PBXBuildPhase" do
@phase.should.be.kind_of Pod::Xcode::Project::PBXBuildPhase
end
it "returns the dstPath" do
@phase.dstPath.should == 'some/path'
end
it "returns the dstSubfolderSpec (no idea what it is yet, but it's not always the same)" do
@phase.dstSubfolderSpec.should == "16"
end
end
describe "a new PBXSourcesBuildPhase" do
before do
@phase = @project.objects.add(Pod::Xcode::Project::PBXSourcesBuildPhase)
end
it "is a PBXBuildPhase" do
@phase.should.be.kind_of Pod::Xcode::Project::PBXBuildPhase
end
end
describe "a new PBXFrameworksBuildPhase" do
before do
@phase = @project.objects.add(Pod::Xcode::Project::PBXFrameworksBuildPhase)
end
it "is a PBXBuildPhase" do
@phase.should.be.kind_of Pod::Xcode::Project::PBXBuildPhase
end
end
describe "a new PBXNativeTarget" do
before do
@target = @project.targets.first
end
describe "concerning its build phases" do
extend SpecHelper::TemporaryDirectory
it "returns an empty sources build phase" do
phase = @target.buildPhases.select_by_class(Pod::Xcode::Project::PBXSourcesBuildPhase).first
phase.files.to_a.should == []
end
it "returns a libraries/frameworks build phase, which by default only contains `Foundation.framework'" do
phase = @target.buildPhases.select_by_class(Pod::Xcode::Project::PBXFrameworksBuildPhase).first
phase.files.map { |buildFile| buildFile.file.name }.should == ['Foundation.framework']
end
it "returns an empty 'copy headers' phase" do
phase = @target.buildPhases.select_by_class(Pod::Xcode::Project::PBXCopyFilesBuildPhase).first
phase.dstPath.should == "$(PUBLIC_HEADERS_FOLDER_PATH)"
phase.files.to_a.should == []
end
end
end
it "returns the objects as PBXObject instances" do it "returns the objects as PBXObject instances" do
@project.objects.each do |object| @project.objects.each do |object|
@project.objects_hash[object.uuid].should == object.attributes @project.objects_hash[object.uuid].should == object.attributes
......
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