Ejemplo n.º 1
0
        public void AddExternalProjectDependency(string path, string projectPath, PBXSourceTree sourceTree)
        {
            path        = FixSlashesInPath(path);
            projectPath = FixSlashesInPath(projectPath);

            PBXGroup productGroup = CreateSourceGroup("Products");

            PBXFileReference fileRef = PBXFileReference.CreateFromFile(path, Path.GetFileName(projectPath),
                                                                       sourceTree);

            fileRefs.AddEntry(fileRef);
            CreateSourceGroup(GetDirectoryFromPath(projectPath)).AddGUID(fileRef.guid);

            project.project.AddReference(productGroup.guid, fileRef.guid);
        }
Ejemplo n.º 2
0
        // The same file can be referred to by more than one project path.
        string AddFileImpl(string path, string projectPath, PBXSourceTree tree)
        {
            path        = FixSlashesInPath(path);
            projectPath = FixSlashesInPath(projectPath);

            string ext = Path.GetExtension(path);

            if (ext != Path.GetExtension(projectPath))
            {
                throw new Exception("Project and real path extensions do not match");
            }

            string guid = FindFileGuidByProjectPath(projectPath) ?? FindFileGuidByRealPath(path);

            if (guid == null)
            {
                PBXFileReference fileRef = PBXFileReference.CreateFromFile(path, GetFilenameFromPath(projectPath), tree);
                fileRefs.AddEntry(fileRef);
                CreateSourceGroup(GetDirectoryFromPath(projectPath)).AddGUID(fileRef.guid);
                guid = fileRef.guid;
            }
            return(guid);
        }
Ejemplo n.º 3
0
        // Returns the guid of the new target
        internal string AddAppExtension(string mainTarget, string name, string infoPlistPath)
        {
            const 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, "");

            buildFiles.AddEntry(buildAppCopy);
            copyFilesBuildPhase.file.Add(buildAppCopy.guid);

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

            return(newTarget.guid);
        }