Exemplo n.º 1
0
        public void AddShellScript(string targetGuid, string script)
        {
            PBXNativeTargetData target = nativeTargets[targetGuid];

            // Do nothing if script already added
            var scripts = shellScripts.GetEntries();

            foreach (var existingScript in scripts)
            {
                // check if script already there
                if (existingScript.Value.Script == script && target.phases.Contains(existingScript.Value.guid))
                {
                    Debug.Log("Script was already added: " + script);
                    return;
                }
            }

            var shellScriptData = PBXShellScriptBuildPhaseData.Create(script);

            shellScripts.AddEntry(shellScriptData);

            // add "Run Script" section to "Build phases"

            target.phases.AddGUID(shellScriptData.guid);
        }
Exemplo n.º 2
0
        internal PBXNativeTargetData CreateNewTarget(string name, string ext, string type)
        {
            // create build configurations
            var releaseBuildConfig = XCBuildConfigurationData.Create("Release");
            releaseBuildConfig.SetProperty("FRAMEWORK_SEARCH_PATHS","$(inherited) $(PROJECT_DIR)/Frameworks/GetSocial/Plugins/iOS");
            buildConfigs.AddEntry(releaseBuildConfig);

            var releaseForRunningBuildConfig = XCBuildConfigurationData.Create("ReleaseForRunning");
            releaseForRunningBuildConfig.SetProperty("FRAMEWORK_SEARCH_PATHS","$(inherited) $(PROJECT_DIR)/Frameworks/GetSocial/Plugins/iOS");
            buildConfigs.AddEntry(releaseForRunningBuildConfig);

            var releaseForProfilingBuildConfig = XCBuildConfigurationData.Create("ReleaseForProfiling");
            releaseForProfilingBuildConfig.SetProperty("FRAMEWORK_SEARCH_PATHS","$(inherited) $(PROJECT_DIR)/Frameworks/GetSocial/Plugins/iOS");
            buildConfigs.AddEntry(releaseForProfilingBuildConfig);

            var debugBuildConfig = XCBuildConfigurationData.Create("Debug");
            debugBuildConfig.SetProperty("FRAMEWORK_SEARCH_PATHS","$(inherited) $(PROJECT_DIR)/Frameworks/GetSocial/Plugins/iOS");
            buildConfigs.AddEntry(debugBuildConfig);

            var buildConfigList = XCConfigurationListData.Create();
            configs.AddEntry(buildConfigList);
            buildConfigList.buildConfigs.AddGUID(releaseBuildConfig.guid);
            buildConfigList.buildConfigs.AddGUID(releaseForRunningBuildConfig.guid);
            buildConfigList.buildConfigs.AddGUID(releaseForProfilingBuildConfig.guid);
            buildConfigList.buildConfigs.AddGUID(debugBuildConfig.guid);

            // create build file reference
            string fullName = name + ext;
            var productFileRef = AddFile(fullName, "Products/" + fullName, PBXSourceTree.Build);
            var newTarget = PBXNativeTargetData.Create(name, productFileRef, type, buildConfigList.guid);
            nativeTargets.AddEntry(newTarget);
            project.project.targets.Add(newTarget.guid);

            return newTarget;
        }
Exemplo n.º 3
0
        internal PBXNativeTargetData CreateNewTarget(string name, string ext, string type)
        {
            // create build configurations
            var releaseBuildConfig = XCBuildConfigurationData.Create("Release");

            buildConfigs.AddEntry(releaseBuildConfig);

            var debugBuildConfig = XCBuildConfigurationData.Create("Debug");

            buildConfigs.AddEntry(debugBuildConfig);

            var buildConfigList = XCConfigurationListData.Create();

            configs.AddEntry(buildConfigList);
            buildConfigList.buildConfigs.AddGUID(releaseBuildConfig.guid);
            buildConfigList.buildConfigs.AddGUID(debugBuildConfig.guid);

            // create build file reference
            string fullName       = name + ext;
            var    productFileRef = AddFile(fullName, "Products/" + fullName, PBXSourceTree.Build);
            var    newTarget      = PBXNativeTargetData.Create(name, productFileRef, type, buildConfigList.guid);

            nativeTargets.AddEntry(newTarget);
            project.project.targets.Add(newTarget.guid);

            return(newTarget);
        }
Exemplo n.º 4
0
 public string BuildConfigByName(string targetGuid, string name)
 {
     PBXNativeTargetData target = nativeTargets[targetGuid];
     foreach (string guid in configs[target.buildConfigList].buildConfigs)
     {
         var buildConfig = buildConfigs[guid];
         if (buildConfig != null && buildConfig.name == name)
             return buildConfig.guid;
     }
     return null;
 }
Exemplo n.º 5
0
        public FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef)
        {
            string ext   = Path.GetExtension(path);
            var    phase = FileTypeUtils.GetFileType(ext, isFolderRef);

            switch (phase)
            {
            case PBXFileType.Framework:
                foreach (var guid in target.phases)
                {
                    if (frameworks.HasEntry(guid))
                    {
                        return(frameworks[guid]);
                    }
                }
                break;

            case PBXFileType.Resource:
                foreach (var guid in target.phases)
                {
                    if (resources.HasEntry(guid))
                    {
                        return(resources[guid]);
                    }
                }
                break;

            case PBXFileType.Source:
                foreach (var guid in target.phases)
                {
                    if (sources.HasEntry(guid))
                    {
                        return(sources[guid]);
                    }
                }
                break;

            case PBXFileType.CopyFile:
                foreach (var guid in target.phases)
                {
                    if (copyFiles.HasEntry(guid))
                    {
                        return(copyFiles[guid]);
                    }
                }
                break;
            }
            return(null);
        }
Exemplo n.º 6
0
        private void AddBuildFileImpl(string targetGuid, string fileGuid, bool weak, string compileFlags)
        {
            PBXNativeTargetData  target  = nativeTargets[targetGuid];
            PBXFileReferenceData fileRef = FileRefsGet(fileGuid);

            string ext = Path.GetExtension(fileRef.path);

            if (FileTypeUtils.IsBuildable(ext, fileRef.isFolderReference) &&
                BuildFilesGetForSourceFile(targetGuid, fileGuid) == null)
            {
                PBXBuildFileData buildFile = PBXBuildFileData.CreateFromFile(fileGuid, weak, compileFlags);
                BuildFilesAdd(targetGuid, buildFile);
                BuildSectionAny(target, ext, fileRef.isFolderReference).files.AddGUID(buildFile.guid);
            }
        }
Exemplo n.º 7
0
 public void RemoveShellScript(string targetGuid, string scriptContent)
 {
     PBXNativeTargetData target = nativeTargets[targetGuid];
     var scripts = shellScripts.GetEntries();
     foreach (var existingScript in scripts)
     {
         // check if script already there
         if (existingScript.Value.Script.Contains(scriptContent))
         {
             Debug.Log("Remove script: " + existingScript.Value.Script);
             shellScripts.RemoveEntry(existingScript.Value.guid);
             target.phases.RemoveGUID(existingScript.Value.guid);
         }
     }
 }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        public static PBXNativeTargetData Create(string name, string productRef,
                                                 string productType, string buildConfigList)
        {
            var res = new PBXNativeTargetData();

            res.guid = PBXGUID.Generate();
            res.SetPropertyString("isa", "PBXNativeTarget");
            res.buildConfigList = buildConfigList;
            res.phases          = new GUIDList();
            res.SetPropertyList("buildRules", new List <string>());
            res.dependencies = new GUIDList();
            res.name         = name;
            res.SetPropertyString("productName", name);
            res.SetPropertyString("productReference", productRef);
            res.SetPropertyString("productType", productType);
            return(res);
        }
Exemplo n.º 10
0
 FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef)
 {
     return(m_Data.BuildSectionAny(target, path, isFolderRef));
 }