Exemplo n.º 1
0
        // Embeds Framework to the project.
        // Creates a copy phase called 'Embed Frameworks', adds 'filename' framework there and sets LD_RUNPATH_SEARCH_PATHS to "$(inherited) @executable_path/Frameworks
        public void EmbedFramework(string targetGuid, string fileGuid)
        {
            PBXNativeTargetData target = nativeTargets[targetGuid];

            PBXBuildFileData frameworkEmbedFileData = null;

            var embedFrameworkPhase = FindEmbedFrameworkPhase();

            if (embedFrameworkPhase == null)
            {
                embedFrameworkPhase = PBXCopyFilesBuildPhaseData.Create("Embed Frameworks", "10");
                copyFiles.AddEntry(embedFrameworkPhase);
                target.phases.AddGUID(embedFrameworkPhase.guid);
            }
            else
            {
                frameworkEmbedFileData = FindFrameworkByFileGuid(embedFrameworkPhase, fileGuid);
            }

            if (frameworkEmbedFileData == null)
            {
                frameworkEmbedFileData = PBXBuildFileData.CreateFromFile(fileGuid, false, null);
                frameworkEmbedFileData.codeSignOnCopy      = true;
                frameworkEmbedFileData.removeHeadersOnCopy = true;
                BuildFilesAdd(targetGuid, frameworkEmbedFileData);

                embedFrameworkPhase.files.AddGUID(frameworkEmbedFileData.guid);
            }

            frameworkEmbedFileData.AddCodeSignOnCopy();

            AddBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks");
        }
Exemplo n.º 2
0
        // Returns the guid of the new target
        internal string AddAppExtension(string mainTarget, string name, string infoPlistPath)
        {
            string ext       = ".appex";
            var    newTarget = CreateNewTarget(name, ext, "com.apple.product-type.app-extension");

            SetDefaultAppExtensionReleaseBuildFlags(buildConfigs[BuildConfigByName(newTarget.guid, "Release")], infoPlistPath);
            SetDefaultAppExtensionDebugBuildFlags(buildConfigs[BuildConfigByName(newTarget.guid, "Debug")], infoPlistPath);

            var sourcesBuildPhase = PBXSourcesBuildPhaseData.Create();

            sources.AddEntry(sourcesBuildPhase);
            newTarget.phases.AddGUID(sourcesBuildPhase.guid);

            var resourcesBuildPhase = PBXResourcesBuildPhaseData.Create();

            resources.AddEntry(resourcesBuildPhase);
            newTarget.phases.AddGUID(resourcesBuildPhase.guid);

            var frameworksBuildPhase = PBXFrameworksBuildPhaseData.Create();

            frameworks.AddEntry(frameworksBuildPhase);
            newTarget.phases.AddGUID(frameworksBuildPhase.guid);

            var copyFilesBuildPhase = PBXCopyFilesBuildPhaseData.Create("Embed App Extensions", "13");

            copyFiles.AddEntry(copyFilesBuildPhase);
            nativeTargets[mainTarget].phases.AddGUID(copyFilesBuildPhase.guid);

            var containerProxy = PBXContainerItemProxyData.Create(project.project.guid, "1", newTarget.guid, name);

            containerItems.AddEntry(containerProxy);

            var targetDependency = PBXTargetDependencyData.Create(newTarget.guid, containerProxy.guid);

            targetDependencies.AddEntry(targetDependency);

            nativeTargets[mainTarget].dependencies.AddGUID(targetDependency.guid);

            var buildAppCopy = PBXBuildFileData.CreateFromFile(FindFileGuidByProjectPath("Products/" + name + ext), false, "");

            BuildFilesAdd(mainTarget, buildAppCopy);
            copyFilesBuildPhase.files.AddGUID(buildAppCopy.guid);

            AddFile(infoPlistPath, name + "/Supporting Files/Info.plist", PBXSourceTree.Source);

            return(newTarget.guid);
        }
Exemplo n.º 3
0
        private PBXCopyFilesBuildPhaseData GetEmbedFrameworks(string target)
        {
            const string embedFrameworksName = "Embed Frameworks";

            if (!embedFrameworks.ContainsKey(target))
            {
                var embed = copyFiles.GetObjects().FirstOrDefault(e => e.name == embedFrameworksName);
                if (embed == null)
                {
                    embed = PBXCopyFilesBuildPhaseData.Create(embedFrameworksName, "10");
                    nativeTargets[target].phases.AddGUID(embed.guid);
                    copyFiles.AddEntry(embed);
                }
                embedFrameworks.Add(target, embed);
            }
            return(embedFrameworks[target]);
        }
Exemplo n.º 4
0
        internal string AddAppExtension(string mainTarget, string name, string infoPlistPath)
        {
            string ext = ".appex";
            PBXNativeTargetData data = this.CreateNewTarget(name, ext, "com.apple.product-type.app-extension");

            this.SetDefaultAppExtensionReleaseBuildFlags(this.buildConfigs[this.BuildConfigByName(data.guid, "Release")], infoPlistPath);
            this.SetDefaultAppExtensionDebugBuildFlags(this.buildConfigs[this.BuildConfigByName(data.guid, "Debug")], infoPlistPath);
            PBXSourcesBuildPhaseData data2 = PBXSourcesBuildPhaseData.Create();

            this.sources.AddEntry(data2);
            data.phases.AddGUID(data2.guid);
            PBXResourcesBuildPhaseData data3 = PBXResourcesBuildPhaseData.Create();

            this.resources.AddEntry(data3);
            data.phases.AddGUID(data3.guid);
            PBXFrameworksBuildPhaseData data4 = PBXFrameworksBuildPhaseData.Create();

            this.frameworks.AddEntry(data4);
            data.phases.AddGUID(data4.guid);
            PBXCopyFilesBuildPhaseData data5 = PBXCopyFilesBuildPhaseData.Create("Embed App Extensions", "13");

            this.copyFiles.AddEntry(data5);
            this.nativeTargets[mainTarget].phases.AddGUID(data5.guid);
            PBXContainerItemProxyData data6 = PBXContainerItemProxyData.Create(this.project.project.guid, "1", data.guid, name);

            this.containerItems.AddEntry(data6);
            PBXTargetDependencyData data7 = PBXTargetDependencyData.Create(data.guid, data6.guid);

            this.targetDependencies.AddEntry(data7);
            this.nativeTargets[mainTarget].dependencies.AddGUID(data7.guid);
            PBXBuildFileData buildFile = PBXBuildFileData.CreateFromFile(this.FindFileGuidByProjectPath("Products/" + name + ext), false, "");

            this.BuildFilesAdd(mainTarget, buildFile);
            data5.files.AddGUID(buildFile.guid);
            this.AddFile(infoPlistPath, name + "/Supporting Files/Info.plist", PBXSourceTree.Source);
            return(data.guid);
        }