private PBXObjectRef addDependency ( final Map objects , final PBXObjectRef project , final List mainGroupChildren , final String baseDir , final DependencyDef dependency ) { if ( dependency . getFile ( ) != null ) { final File xcodeDir = new File ( dependency . getFile ( ) . getAbsolutePath ( ) + ".xcodeproj" ) ; if ( xcodeDir . exists ( ) ) { final PBXObjectRef xcodePrj = createPBXFileReference ( "SOURCE_ROOT" , baseDir , xcodeDir ) ; mainGroupChildren . add ( xcodePrj ) ; objects . put ( xcodePrj . getID ( ) , xcodePrj . getProperties ( ) ) ; final int proxyType = 2 ; final PBXObjectRef proxy = createPBXContainerItemProxy ( xcodePrj , proxyType , dependency . getName ( ) ) ; objects . put ( proxy . getID ( ) , proxy . getProperties ( ) ) ; final PBXObjectRef referenceProxy = createPBXReferenceProxy ( proxy , dependency ) ; objects . put ( referenceProxy . getID ( ) , referenceProxy . getProperties ( ) ) ; final PBXObjectRef buildFile = createPBXBuildFile ( referenceProxy , Collections . emptyMap ( ) ) ; objects . put ( buildFile . getID ( ) , buildFile . getProperties ( ) ) ; final List productsChildren = new ArrayList ( ) ; productsChildren . add ( referenceProxy ) ; final PBXObjectRef products = createPBXGroup ( "Products" , "<group>" , productsChildren ) ; objects . put ( products . getID ( ) , products . getProperties ( ) ) ; final Map projectReference = new HashMap ( ) ; projectReference . put ( "ProductGroup" , products ) ; projectReference . put ( "ProjectRef" , xcodePrj ) ; List projectReferences = ( List ) project . getProperties ( ) . get ( "ProjectReferences" ) ; if ( projectReferences == null ) { projectReferences = new ArrayList ( ) ; project . getProperties ( ) . put ( "ProjectReferences" , projectReferences ) ; } projectReferences . add ( projectReference ) ; return buildFile ; } } return null ; }
Adds a dependency to the object graph .