(self, other_pbxproject)
return [product_group, project_ref]
Add a reference to another project file (via PBXProject object) to this
    one.

    Returns [ProductGroup, ProjectRef].  ProductGroup is a PBXGroup object in
    this project file that contains a PBXReferenceProxy object for each
    product of each PBXNativeTarget in the other project file.  ProjectRef is
    a PBXFileReference to the other project file.

    If this project file already references the other project file, the
    existing ProductGroup and ProjectRef are returned.  The ProductGroup will
    still be updated if necessary.
Add a reference to another project file (via PBXProject object) to this
    one.
Add a reference to another project file ( via PBXProject object ) to this one .
def AddOrGetProjectReference(self, other_pbxproject):
    """Add a reference to another project file (via PBXProject object) to this
    one.

    Returns [ProductGroup, ProjectRef].  ProductGroup is a PBXGroup object in
    this project file that contains a PBXReferenceProxy object for each
    product of each PBXNativeTarget in the other project file.  ProjectRef is
    a PBXFileReference to the other project file.

    If this project file already references the other project file, the
    existing ProductGroup and ProjectRef are returned.  The ProductGroup will
    still be updated if necessary.
    """

    if not 'projectReferences' in self._properties:
      self._properties['projectReferences'] = []

    product_group = None
    project_ref = None

    if not other_pbxproject in self._other_pbxprojects:
      # This project file isn't yet linked to the other one.  Establish the
      # link.
      product_group = PBXGroup({'name': 'Products'})

      # ProductGroup is strong.
      product_group.parent = self

      # There's nothing unique about this PBXGroup, and if left alone, it will
      # wind up with the same set of hashables as all other PBXGroup objects
      # owned by the projectReferences list.  Add the hashables of the
      # remote PBXProject that it's related to.
      product_group._hashables.extend(other_pbxproject.Hashables())

      # The other project reports its path as relative to the same directory
      # that this project's path is relative to.  The other project's path
      # is not necessarily already relative to this project.  Figure out the
      # pathname that this project needs to use to refer to the other one.
      this_path = posixpath.dirname(self.Path())
      projectDirPath = self.GetProperty('projectDirPath')
      if projectDirPath:
        if posixpath.isabs(projectDirPath[0]):
          this_path = projectDirPath
        else:
          this_path = posixpath.join(this_path, projectDirPath)
      other_path = gyp.common.RelativePath(other_pbxproject.Path(), this_path)

      # ProjectRef is weak (it's owned by the mainGroup hierarchy).
      project_ref = PBXFileReference({
            'lastKnownFileType': 'wrapper.pb-project',
            'path':              other_path,
            'sourceTree':        'SOURCE_ROOT',
          })
      self.ProjectsGroup().AppendChild(project_ref)

      ref_dict = {'ProductGroup': product_group, 'ProjectRef': project_ref}
      self._other_pbxprojects[other_pbxproject] = ref_dict
      self.AppendProperty('projectReferences', ref_dict)

      # Xcode seems to sort this list case-insensitively
      self._properties['projectReferences'] = \
          sorted(self._properties['projectReferences'], cmp=lambda x,y:
                 cmp(x['ProjectRef'].Name().lower(),
                     y['ProjectRef'].Name().lower()))
    else:
      # The link already exists.  Pull out the relevnt data.
      project_ref_dict = self._other_pbxprojects[other_pbxproject]
      product_group = project_ref_dict['ProductGroup']
      project_ref = project_ref_dict['ProjectRef']

    self._SetUpProductReferences(other_pbxproject, product_group, project_ref)

    inherit_unique_symroot = self._AllSymrootsUnique(other_pbxproject, False)
    targets = other_pbxproject.GetProperty('targets')
    if all(self._AllSymrootsUnique(t, inherit_unique_symroot) for t in targets):
      dir_path = project_ref._properties['path']
      product_group._hashables.extend(dir_path)

    return [product_group, project_ref]
def AddOrGetProjectReference ( self , other_pbxproject ) : if not 'projectReferences' in self . _properties : self . _properties [ 'projectReferences' ] = [ ] product_group = None project_ref = None if not other_pbxproject in self . _other_pbxprojects : # This project file isn't yet linked to the other one.  Establish the # link. product_group = PBXGroup ( { 'name' : 'Products' } ) # ProductGroup is strong. product_group . parent = self # There's nothing unique about this PBXGroup, and if left alone, it will # wind up with the same set of hashables as all other PBXGroup objects # owned by the projectReferences list.  Add the hashables of the # remote PBXProject that it's related to. product_group . _hashables . extend ( other_pbxproject . Hashables ( ) ) # The other project reports its path as relative to the same directory # that this project's path is relative to.  The other project's path # is not necessarily already relative to this project.  Figure out the # pathname that this project needs to use to refer to the other one. this_path = posixpath . dirname ( self . Path ( ) ) projectDirPath = self . GetProperty ( 'projectDirPath' ) if projectDirPath : if posixpath . isabs ( projectDirPath [ 0 ] ) : this_path = projectDirPath else : this_path = posixpath . join ( this_path , projectDirPath ) other_path = gyp . common . RelativePath ( other_pbxproject . Path ( ) , this_path ) # ProjectRef is weak (it's owned by the mainGroup hierarchy). project_ref = PBXFileReference ( { 'lastKnownFileType' : 'wrapper.pb-project' , 'path' : other_path , 'sourceTree' : 'SOURCE_ROOT' , } ) self . ProjectsGroup ( ) . AppendChild ( project_ref ) ref_dict = { 'ProductGroup' : product_group , 'ProjectRef' : project_ref } self . _other_pbxprojects [ other_pbxproject ] = ref_dict self . AppendProperty ( 'projectReferences' , ref_dict ) # Xcode seems to sort this list case-insensitively self . _properties [ 'projectReferences' ] = sorted ( self . _properties [ 'projectReferences' ] , cmp = lambda x , y : cmp ( x [ 'ProjectRef' ] . Name ( ) . lower ( ) , y [ 'ProjectRef' ] . Name ( ) . lower ( ) ) ) else : # The link already exists.  Pull out the relevnt data. project_ref_dict = self . _other_pbxprojects [ other_pbxproject ] product_group = project_ref_dict [ 'ProductGroup' ] project_ref = project_ref_dict [ 'ProjectRef' ] self . _SetUpProductReferences ( other_pbxproject , product_group , project_ref ) inherit_unique_symroot = self . _AllSymrootsUnique ( other_pbxproject , False ) targets = other_pbxproject . GetProperty ( 'targets' ) if all ( self . _AllSymrootsUnique ( t , inherit_unique_symroot ) for t in targets ) : dir_path = project_ref . _properties [ 'path' ] product_group . _hashables . extend ( dir_path ) return [ product_group , project_ref ]