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AC;AACJ,CAAC;AA3BD,iCA2BC","sourcesContent":["import * as path from 'path';\nimport xcode, { PBXNativeTarget, UUID, XcodeProject } from 'xcode';\n\nimport {\n getAllPBXProjectPaths,\n getAllXcodeProjectPaths,\n getApplicationNativeTarget,\n} from './Paths';\n\nexport interface IosProject {\n projectName: string;\n /**\n * Root path to directory containing project source files.\n */\n projectPath: string;\n /**\n * pbxProject reference that allows to modify `.pbxproj` file.\n */\n pbxProject: XcodeProject;\n /**\n * main application PBXNativeTarget from `.pbxproj` file.\n */\n applicationNativeTarget: { uuid: UUID; target: PBXNativeTarget };\n}\n\nfunction getProjectConfig(projectRoot: string): { projectPath: string; pbxprojPath: string } {\n return {\n projectPath: getAllXcodeProjectPaths(projectRoot)[0]!,\n pbxprojPath: getAllPBXProjectPaths(projectRoot)[0]!,\n };\n}\n\n/**\n * Reads iOS project and locates `.pbxproj` file for further parsing and modifications.\n */\nexport default async function readPbxProject(projectRootPath: string): Promise<IosProject> {\n const config = getProjectConfig(projectRootPath);\n\n const { projectPath: xcodeProjPath, pbxprojPath } = config;\n\n const projectPath = xcodeProjPath.substring(0, xcodeProjPath.length - '.xcodeproj'.length);\n const projectName = path.basename(projectPath);\n\n const pbxProject = xcode.project(pbxprojPath);\n\n await new Promise<void>(resolve =>\n pbxProject.parse(err => {\n if (err) {\n throw new Error(`.pbxproj file parsing issue: ${err.message}.`);\n }\n resolve();\n })\n );\n\n const applicationNativeTarget = getApplicationNativeTarget({ project: pbxProject, projectName });\n\n return {\n projectName,\n projectPath,\n pbxProject,\n applicationNativeTarget,\n };\n}\n"]}
|