Example #1
0
 public void GroupsAddDuplicate(PBXGroupData gr)
 {
     groups.AddEntry(gr);
 }
Example #2
0
        void RefreshMapsForGroupChildren(string projectPath, string realPath, PBXSourceTree realPathTree, PBXGroupData parent)
        {
            var children = new List <string>(parent.children);

            foreach (string guid in children)
            {
                PBXFileReferenceData fileRef = fileRefs[guid];
                string        pPath;
                string        rPath;
                PBXSourceTree rTree;

                if (fileRef != null)
                {
                    pPath = PBXPath.Combine(projectPath, fileRef.name);
                    PBXPath.Combine(realPath, realPathTree, fileRef.path, fileRef.tree, out rPath, out rTree);

                    if (!m_ProjectPathToFileRefMap.ContainsKey(pPath))
                    {
                        m_ProjectPathToFileRefMap.Add(pPath, fileRef);
                    }
                    if (!m_FileRefGuidToProjectPathMap.ContainsKey(fileRef.guid))
                    {
                        m_FileRefGuidToProjectPathMap.Add(fileRef.guid, pPath);
                    }
                    if (!m_RealPathToFileRefMap[rTree].ContainsKey(rPath))
                    {
                        m_RealPathToFileRefMap[rTree].Add(rPath, fileRef);
                    }
                    if (!m_GuidToParentGroupMap.ContainsKey(guid))
                    {
                        m_GuidToParentGroupMap.Add(guid, parent);
                    }

                    continue;
                }

                PBXGroupData gr = groups[guid];
                if (gr != null)
                {
                    pPath = PBXPath.Combine(projectPath, gr.name);
                    PBXPath.Combine(realPath, realPathTree, gr.path, gr.tree, out rPath, out rTree);

                    if (!m_ProjectPathToGroupMap.ContainsKey(pPath))
                    {
                        m_ProjectPathToGroupMap.Add(pPath, gr);
                    }
                    if (!m_GroupGuidToProjectPathMap.ContainsKey(gr.guid))
                    {
                        m_GroupGuidToProjectPathMap.Add(gr.guid, pPath);
                    }
                    if (!m_GuidToParentGroupMap.ContainsKey(guid))
                    {
                        m_GuidToParentGroupMap.Add(guid, parent);
                    }

                    RefreshMapsForGroupChildren(pPath, rPath, rTree, gr);
                }
            }
        }
Example #3
0
 void GroupsAddDuplicate(PBXGroupData gr)
 {
     m_Data.GroupsAddDuplicate(gr);
 }
Example #4
0
        /** This function must be called only after the project the library is in has
         *  been added as a dependency via AddExternalProjectDependency. projectPath must be
         *  the same as the 'path' parameter passed to the AddExternalProjectDependency.
         *  remoteFileGuid must be the guid of the referenced file as specified in
         *  PBXFileReference section of the external project
         *
         *  TODO: what. is remoteInfo entry in PBXContainerItemProxy? Is in referenced project name or
         *  referenced library name without extension?
         */
        public void AddExternalLibraryDependency(string targetGuid, string filename, string remoteFileGuid, string projectPath,
                                                 string remoteInfo)
        {
            PBXNativeTargetData target = nativeTargets[targetGuid];

            filename    = Utils.FixSlashesInPath(filename);
            projectPath = Utils.FixSlashesInPath(projectPath);

            // find the products group to put the new library in
            string projectGuid = FindFileGuidByRealPath(projectPath);

            if (projectGuid == null)
            {
                throw new Exception("No such project");
            }

            string productsGroupGuid = null;

            foreach (var proj in project.project.projectReferences)
            {
                if (proj.projectRef == projectGuid)
                {
                    productsGroupGuid = proj.group;
                    break;
                }
            }

            if (productsGroupGuid == null)
            {
                throw new Exception("Malformed project: no project in project references");
            }

            PBXGroupData productGroup = GroupsGet(productsGroupGuid);

            // verify file extension
            string ext = Path.GetExtension(filename);

            if (!FileTypeUtils.IsBuildableFile(ext))
            {
                throw new Exception("Wrong file extension");
            }

            // create ContainerItemProxy object
            var container = PBXContainerItemProxyData.Create(projectGuid, "2", remoteFileGuid, remoteInfo);

            containerItems.AddEntry(container);

            // create a reference and build file for the library
            string typeName = FileTypeUtils.GetTypeName(ext);

            var libRef = PBXReferenceProxyData.Create(filename, typeName, container.guid, "BUILT_PRODUCTS_DIR");

            references.AddEntry(libRef);
            PBXBuildFileData libBuildFile = PBXBuildFileData.CreateFromFile(libRef.guid, false, null);

            BuildFilesAdd(targetGuid, libBuildFile);
            BuildSectionAny(target, ext, false).files.AddGUID(libBuildFile.guid);

            // add to products folder
            productGroup.children.AddGUID(libRef.guid);
        }
Example #5
0
 void FileRefsAdd(string realPath, string projectPath, PBXGroupData parent, PBXFileReferenceData fileRef)
 {
     m_Data.FileRefsAdd(realPath, projectPath, parent, fileRef);
 }
Example #6
0
 void GroupsAdd(string projectPath, PBXGroupData parent, PBXGroupData gr)
 {
     m_Data.GroupsAdd(projectPath, parent, gr);
 }
Example #7
0
        void RemoveGroupIfEmpty(PBXGroupData gr)
        {
            if (gr.children.Count == 0 && gr != GroupsGetMainGroup())
            {
                // remove from parent
                PBXGroupData parent = GroupsGetByChild(gr.guid);
                parent.children.RemoveGUID(gr.guid);
                RemoveGroupIfEmpty(parent);

                // remove actual group
                GroupsRemove(gr.guid);
            }
        }
Example #8
0
 private void RefreshMapsForGroupChildren(string projectPath, string realPath, PBXSourceTree realPathTree, PBXGroupData parent)
 {
     foreach (string key1 in new List <string>((IEnumerable <string>)parent.children))
     {
         PBXFileReferenceData fileReferenceData = this.fileRefs[key1];
         string        resPath;
         PBXSourceTree resTree;
         if (fileReferenceData != null)
         {
             string key2 = PBXPath.Combine(projectPath, fileReferenceData.name);
             PBXPath.Combine(realPath, realPathTree, fileReferenceData.path, fileReferenceData.tree, out resPath, out resTree);
             if (!this.m_ProjectPathToFileRefMap.ContainsKey(key2))
             {
                 this.m_ProjectPathToFileRefMap.Add(key2, fileReferenceData);
             }
             if (!this.m_FileRefGuidToProjectPathMap.ContainsKey(fileReferenceData.guid))
             {
                 this.m_FileRefGuidToProjectPathMap.Add(fileReferenceData.guid, key2);
             }
             if (!this.m_RealPathToFileRefMap[resTree].ContainsKey(resPath))
             {
                 this.m_RealPathToFileRefMap[resTree].Add(resPath, fileReferenceData);
             }
             if (!this.m_GuidToParentGroupMap.ContainsKey(key1))
             {
                 this.m_GuidToParentGroupMap.Add(key1, parent);
             }
         }
         else
         {
             PBXGroupData parent1 = this.groups[key1];
             if (parent1 != null)
             {
                 string str = PBXPath.Combine(projectPath, parent1.name);
                 PBXPath.Combine(realPath, realPathTree, parent1.path, parent1.tree, out resPath, out resTree);
                 if (!this.m_ProjectPathToGroupMap.ContainsKey(str))
                 {
                     this.m_ProjectPathToGroupMap.Add(str, parent1);
                 }
                 if (!this.m_GroupGuidToProjectPathMap.ContainsKey(parent1.guid))
                 {
                     this.m_GroupGuidToProjectPathMap.Add(parent1.guid, str);
                 }
                 if (!this.m_GuidToParentGroupMap.ContainsKey(key1))
                 {
                     this.m_GuidToParentGroupMap.Add(key1, parent);
                 }
                 this.RefreshMapsForGroupChildren(str, resPath, resTree, parent1);
             }
         }
     }
 }
Example #9
0
        private void RemoveGroupChildrenRecursive(PBXGroupData parent)
        {
            List<string> children = new List<string>(parent.children);
            parent.children.Clear();
            foreach (string guid in children)
            {
                PBXFileReferenceData file = FileRefsGet(guid);
                if (file != null)
                {
                    foreach (var target in nativeTargets.GetEntries())
                        RemoveFileFromBuild(target.Value.guid, guid);
                    FileRefsRemove(guid);
                    continue;
                }

                PBXGroupData gr = GroupsGet(guid);
                if (gr != null)
                {
                    RemoveGroupChildrenRecursive(gr);
                    GroupsRemove(gr.guid);
                    continue;
                }
            }
        }
Example #10
0
 void GroupsAddDuplicate(PBXGroupData gr)
 {
     m_Data.GroupsAddDuplicate(gr);
 }
Example #11
0
 void GroupsAdd(string projectPath, PBXGroupData parent, PBXGroupData gr)
 {
     m_Data.GroupsAdd(projectPath, parent, gr);
 }
Example #12
0
 private PBXGroupData GetPBXGroupChildByName(PBXGroupData group, string name)
 {
     foreach (string guid in group.children)
     {
         var gr = GroupsGet(guid);
         if (gr != null && gr.name == name)
             return gr;
     }
     return null;
 }
Example #13
0
 void FileRefsAdd(string realPath, string projectPath, PBXGroupData parent, PBXFileReferenceData fileRef)
 {
     m_Data.FileRefsAdd(realPath, projectPath, parent, fileRef);
 }