public static PBXTargetDependency Create(string target, string targetProxy)
        {
            var res = new PBXTargetDependency();

            res.guid = PBXGUID.Generate();
            res.m_Properties["isa"]         = "PBXTargetDependency";
            res.m_Properties["target"]      = target;
            res.m_Properties["targetProxy"] = targetProxy;
            return(res);
        }
Esempio n. 2
0
        // Returns the guid of the new target
        internal string AddAppExtension(string mainTarget, string name, string infoPlistPath)
        {
            string ext            = ".appex";
            string fullName       = name + ext;
            var    productFileRef = PBXFileReference.CreateFromFile("Products/" + fullName, "Products/" + fullName,
                                                                    PBXSourceTree.Group);
            var releaseBuildConfig = XCBuildConfiguration.Create("Release");

            buildConfigs.AddEntry(releaseBuildConfig);
            SetDefaultAppExtensionReleaseBuildFlags(releaseBuildConfig, infoPlistPath);

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

            buildConfigs.AddEntry(debugBuildConfig);
            SetDefaultAppExtensionDebugBuildFlags(debugBuildConfig, infoPlistPath);

            var buildConfigList = XCConfigurationList.Create();

            configs.AddEntry(buildConfigList);
            buildConfigList.buildConfig.Add(releaseBuildConfig.guid);
            buildConfigList.buildConfig.Add(debugBuildConfig.guid);


            var newTarget = PBXNativeTarget.Create(name, productFileRef.guid, "com.apple.product-type.app-extension", buildConfigList.guid);

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

            var sourcesBuildPhase = PBXSourcesBuildPhase.Create();

            sources.AddEntry(sourcesBuildPhase);
            newTarget.phase.Add(sourcesBuildPhase.guid);

            var resourcesBuildPhase = PBXResourcesBuildPhase.Create();

            resources.AddEntry(resourcesBuildPhase);
            newTarget.phase.Add(resourcesBuildPhase.guid);

            var frameworksBuildPhase = PBXFrameworksBuildPhase.Create();

            frameworks.AddEntry(frameworksBuildPhase);
            newTarget.phase.Add(frameworksBuildPhase.guid);

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

            copyFiles.AddEntry(copyFilesBuildPhase);
            nativeTargets[mainTarget].phase.Add(copyFilesBuildPhase.guid);

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

            containerItems.AddEntry(containerProxy);

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

            targetDependencies.AddEntry(targetDependency);

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

            AddFile(fullName, "Products/" + fullName, PBXSourceTree.Build);
            var buildAppCopy = PBXBuildFile.CreateFromFile(FindFileGuidByProjectPath("Products/" + fullName), false, "");

            BuildFilesAdd(mainTarget, buildAppCopy);
            copyFilesBuildPhase.file.Add(buildAppCopy.guid);

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

            return(newTarget.guid);
        }