Exemplo n.º 1
0
        public static PBXReferenceProxyData Create(string path, string fileType,
                                                   string remoteRef, string sourceTree)
        {
            var res = new PBXReferenceProxyData();

            res.guid = PBXGUID.Generate();
            res.SetPropertyString("isa", "PBXReferenceProxy");
            res.SetPropertyString("path", path);
            res.SetPropertyString("fileType", fileType);
            res.SetPropertyString("remoteRef", remoteRef);
            res.SetPropertyString("sourceTree", sourceTree);
            return(res);
        }
Exemplo n.º 2
0
        public void AddExternalLibraryDependency(string targetGuid, string filename, string remoteFileGuid, string projectPath, string remoteInfo)
        {
            PBXNativeTargetData target = this.nativeTargets[targetGuid];

            filename    = PBXPath.FixSlashes(filename);
            projectPath = PBXPath.FixSlashes(projectPath);
            string containerRef = this.FindFileGuidByRealPath(projectPath);

            if (containerRef == null)
            {
                throw new Exception("No such project");
            }
            string guid = null;

            foreach (ProjectReference reference in this.project.project.projectReferences)
            {
                if (reference.projectRef == containerRef)
                {
                    guid = reference.group;
                    break;
                }
            }
            if (guid == null)
            {
                throw new Exception("Malformed project: no project in project references");
            }
            PBXGroupData data2     = this.GroupsGet(guid);
            string       extension = Path.GetExtension(filename);

            if (!FileTypeUtils.IsBuildableFile(extension))
            {
                throw new Exception("Wrong file extension");
            }
            PBXContainerItemProxyData data3 = PBXContainerItemProxyData.Create(containerRef, "2", remoteFileGuid, remoteInfo);

            this.containerItems.AddEntry(data3);
            string typeName             = FileTypeUtils.GetTypeName(extension);
            PBXReferenceProxyData data4 = PBXReferenceProxyData.Create(filename, typeName, data3.guid, "BUILT_PRODUCTS_DIR");

            this.references.AddEntry(data4);
            PBXBuildFileData buildFile = PBXBuildFileData.CreateFromFile(data4.guid, false, null);

            this.BuildFilesAdd(targetGuid, buildFile);
            this.BuildSectionAny(target, extension, false).files.AddGUID(buildFile.guid);
            data2.children.AddGUID(data4.guid);
        }
Exemplo n.º 3
0
        internal static void AddExternalLibraryDependency(this PBXProject proj, string targetGuid, string filename, string remoteFileGuid, string projectPath, string remoteInfo)
        {
            PBXNativeTargetData target = proj.nativeTargets[targetGuid];

            filename    = PBXPath.FixSlashes(filename);
            projectPath = PBXPath.FixSlashes(projectPath);
            string fileGuidByRealPath = proj.FindFileGuidByRealPath(projectPath);

            if (fileGuidByRealPath == null)
            {
                throw new Exception("No such project");
            }
            string guid = (string)null;

            foreach (ProjectReference projectReference in proj.project.project.projectReferences)
            {
                if (projectReference.projectRef == fileGuidByRealPath)
                {
                    guid = projectReference.group;
                    break;
                }
            }
            if (guid == null)
            {
                throw new Exception("Malformed project: no project in project references");
            }
            PBXGroupData pbxGroupData = proj.GroupsGet(guid);
            string       extension    = Path.GetExtension(filename);

            if (!FileTypeUtils.IsBuildableFile(extension))
            {
                throw new Exception("Wrong file extension");
            }
            PBXContainerItemProxyData containerItemProxyData = PBXContainerItemProxyData.Create(fileGuidByRealPath, "2", remoteFileGuid, remoteInfo);

            proj.containerItems.AddEntry(containerItemProxyData);
            string typeName = FileTypeUtils.GetTypeName(extension);
            PBXReferenceProxyData referenceProxyData = PBXReferenceProxyData.Create(filename, typeName, containerItemProxyData.guid, "BUILT_PRODUCTS_DIR");

            proj.references.AddEntry(referenceProxyData);
            PBXBuildFileData fromFile = PBXBuildFileData.CreateFromFile(referenceProxyData.guid, false, (string)null);

            proj.BuildFilesAdd(targetGuid, fromFile);
            proj.BuildSectionAny(target, extension, false).files.AddGUID(fromFile.guid);
            pbxGroupData.children.AddGUID(referenceProxyData.guid);
        }
Exemplo n.º 4
0
 private void BuildCommentMapForBuildFiles(GUIDToCommentMap comments, List <string> guids, string sectName)
 {
     foreach (string guid in guids)
     {
         PBXBuildFileData pbxBuildFileData = this.BuildFilesGet(guid);
         if (pbxBuildFileData != null)
         {
             PBXFileReferenceData fileReferenceData = this.FileRefsGet(pbxBuildFileData.fileRef);
             if (fileReferenceData != null)
             {
                 comments.Add(guid, string.Format("{0} in {1}", (object)fileReferenceData.name, (object)sectName));
             }
             else
             {
                 PBXReferenceProxyData referenceProxyData = this.references[pbxBuildFileData.fileRef];
                 if (referenceProxyData != null)
                 {
                     comments.Add(guid, string.Format("{0} in {1}", (object)referenceProxyData.path, (object)sectName));
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 private void BuildCommentMapForBuildFiles(GUIDToCommentMap comments, List <string> guids, string sectName)
 {
     foreach (string str in guids)
     {
         PBXBuildFileData data = this.BuildFilesGet(str);
         if (data != null)
         {
             PBXFileReferenceData data2 = this.FileRefsGet(data.fileRef);
             if (data2 != null)
             {
                 comments.Add(str, $"{data2.name} in {sectName}");
             }
             else
             {
                 PBXReferenceProxyData data3 = this.references[data.fileRef];
                 if (data3 != null)
                 {
                     comments.Add(str, $"{data3.path} in {sectName}");
                 }
             }
         }
     }
 }
Exemplo n.º 6
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);
        }