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

            res.guid = PBXGUID.Generate();
            res.m_Properties["isa"]        = "PBXReferenceProxy";
            res.m_Properties["path"]       = path;
            res.m_Properties["fileType"]   = fileType;
            res.m_Properties["remoteRef"]  = remoteRef;
            res.m_Properties["sourceTree"] = sourceTree;
            return(res);
        }
 public static PBXReferenceProxy Create(string path, string fileType,
                                        string remoteRef, string sourceTree)
 {
     var res = new PBXReferenceProxy();
     res.guid = PBXGUID.Generate();
     res.m_Properties["isa"] = "PBXReferenceProxy";
     res.m_Properties["path"] = path;
     res.m_Properties["fileType"] = fileType;
     res.m_Properties["remoteRef"] = remoteRef;
     res.m_Properties["sourceTree"] = sourceTree;
     return res;
 }
Esempio n. 3
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: wtf. 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)
        {
            PBXNativeTarget target = nativeTargets[targetGuid];

            filename    = FixSlashesInPath(filename);
            projectPath = 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");
            }

            PBXGroup productGroup = groups[productsGroupGuid];

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

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

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

            containerItems.AddEntry(container);

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

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

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

            buildFiles.AddEntry(libBuildFile);
            BuildSection(target, ext).AddGUID(libBuildFile.guid);

            // add to products folder
            productGroup.AddGUID(libRef.guid);
        }