Skip to content
Browse files

ability to add target dependencies

  • Loading branch information...
1 parent ca3fe8f commit 10a56ae36a0445370a457882ab314fd61cd6b6da @drewcrawford committed Feb 1, 2012
Showing with 31 additions and 3 deletions.
  1. +31 −3 lib/xcodeproj/project.rb
View
34 lib/xcodeproj/project.rb
@@ -295,7 +295,7 @@ class PBXGroup < PBXObject
def initialize(*)
super
- self.sourceTree ||= '<group>'
+ self.sourceTree ||= '<grdoup>'
@alloy
alloy added a note Mar 15, 2012

Is this an error or actually required?

@drewcrawford
Owner
drewcrawford added a note Mar 15, 2012

Probably just me being an idiot :-) Good catch

@alloy
alloy added a note Mar 15, 2012

Cool, thanks :)

So, is this all functioning correctly? Because if so, I’d like to pull it in. And would you be up for updating it for the current HEAD of Xcodeproj and add a few tests?

@drewcrawford
Owner
@alloy
alloy added a note Mar 15, 2012

Now that I know you're waiting on it, let me see if I can escalate the priority a little bit. I still haven't gotten a chance to try out that solution you sent. You know the contracting market, when it rains it pours.

Yup, I know it… I’m not waiting specifically for this, so take your time. Just seeing if you were up to it or that I have to schedule time for it :)

Thanks!

@drewcrawford
Owner
@alloy
alloy added a note Mar 15, 2012

I think the problem is that you are passing it the same build settings hash that’s used by the release config. You probably have to call #dup on it to create a copy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
self.childReferences ||= []
end
@@ -356,16 +356,24 @@ class PBXShellScriptBuildPhase < PBXBuildPhase
attribute :shellScript
end
+ class PBXTargetDependency < PBXObject
+ has_one :targetProxy
+ attribute :name
+ end
+ class PBXContainerItemProxy < PBXObject
+ attribute :remoteInfo
+ attribute :proxyType
+ end
class PBXNativeTarget < PBXObject
STATIC_LIBRARY = 'com.apple.product-type.library.static'
attributes :productName, :productType
has_many :buildPhases
- has_many :dependencies # TODO :class => ?
has_many :buildRules # TODO :class => ?
has_one :buildConfigurationList
has_one :product, :uuid => :productReference
+ has_many :dependencies, :class => PBXTargetDependency
def self.new_static_library(project, productName)
# TODO should probably switch the uuid and attributes argument
@@ -445,6 +453,9 @@ def add_source_file(path, copy_header_phase = nil, compiler_flags = nil)
end
end
+
+
+
class XCBuildConfiguration < PBXObject
attribute :buildSettings
has_one :baseConfiguration, :uuid => :baseConfigurationReference
@@ -474,7 +485,7 @@ def initialize(*)
class PBXProject < PBXObject
has_many :targets, :class => PBXNativeTarget
has_one :products, :singular_name => :products, :uuid => :productRefGroup, :class => PBXGroup
- end
+ end
class PBXObjectList
include Enumerable
@@ -580,6 +591,8 @@ def initialize(xcodeproj = nil)
end
end
+
+
def to_hash
@plist
end
@@ -645,6 +658,21 @@ def products
root_object.products
end
+ def add_dependency(name,foreignPBXProjName)
+
+ find_file = files.find_all{|file| file.name==foreignPBXProjName}.first
+ containerproxy = objects.add(Xcodeproj::Project::PBXContainerItemProxy, {
+ 'remoteInfo' => "DCAKit",
+ 'proxyType' => '1',
+ 'containerPortal' => find_file.uuid
+ })
+ dep = objects.add(Xcodeproj::Project::PBXTargetDependency, {
+ 'name' => name,
+ 'targetProxy' => containerproxy.uuid
+ })
+ return dep
+ end
+
IGNORE_GROUPS = ['Frameworks', 'Products', 'Supporting Files']
def source_files
source_files = {}

0 comments on commit 10a56ae

Please sign in to comment.
Something went wrong with that request. Please try again.