amis-rpc-design/node_modules/@react-native-community/cli-platform-ios/build/commands/buildIOS/buildProject.js.map

1 line
8.6 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"names":["buildProject","xcodeProject","udid","scheme","args","Promise","resolve","reject","xcodebuildArgs","isWorkspace","name","xcconfig","buildFolder","mode","destination","extraParams","push","loader","getLoader","logger","info","chalk","dim","join","xcodebuildOutputFormatter","verbose","xcbeautifyAvailable","child_process","spawn","stdio","process","stdout","stderr","xcprettyAvailable","buildProcess","getProcessOptions","buildOutput","errorOutput","on","data","stringData","toString","stdin","write","isVerbose","debug","start","repeat","length","code","end","stop","printRunDoctorTip","CLIError","undefined","success","execSync","error","packager","terminal","port","env","RCT_TERMINAL","RCT_METRO_PORT","RCT_NO_LAUNCH_PACKAGER"],"sources":["../../../src/commands/buildIOS/buildProject.ts"],"sourcesContent":["import child_process, {\n ChildProcess,\n SpawnOptionsWithoutStdio,\n} from 'child_process';\nimport chalk from 'chalk';\nimport {IOSProjectInfo} from '@react-native-community/cli-types';\nimport {\n logger,\n CLIError,\n printRunDoctorTip,\n getLoader,\n} from '@react-native-community/cli-tools';\n\nexport type BuildFlags = {\n mode: string;\n packager: boolean;\n verbose: boolean;\n xcconfig?: string;\n buildFolder?: string;\n port: number;\n terminal: string | undefined;\n interactive?: boolean;\n destination?: string;\n extraParams?: string[];\n};\n\nexport function buildProject(\n xcodeProject: IOSProjectInfo,\n udid: string | undefined,\n scheme: string,\n args: BuildFlags,\n): Promise<string> {\n return new Promise((resolve, reject) => {\n const xcodebuildArgs = [\n xcodeProject.isWorkspace ? '-workspace' : '-project',\n xcodeProject.name,\n ...(args.xcconfig ? ['-xcconfig', args.xcconfig] : []),\n ...(args.buildFolder ? ['-derivedDataPath', args.buildFolder] : []),\n '-configuration',\n args.mode,\n '-scheme',\n scheme,\n '-destination',\n (udid\n ? `id=${udid}`\n : args.mode === 'Debug'\n ? 'generic/platform=iOS Simulator'\n : 'generic/platform=iOS') +\n (args.destination ? ',' + args.destination : ''),\n ];\n\n if (args.extraParams) {\n xcodebuildArgs.push(...args.extraParams);\n }\n\n const loader = getLoader();\n logger.info(\n `Building ${chalk.dim(\n `(using \"xcodebuild ${xcodebuildArgs.join(' ')}\")`,\n )}`,\n );\n let xcodebuildOutputFormatter: ChildProcess | any;\n if (!args.verbose) {\n if (xcbeautifyAvailable()) {\n xcodebuildOutputFormatter = child_process.spawn('xcbeautify', [], {\n stdio: ['pipe', process.stdout, process.stderr],\n });\n } else if (xcprettyAvailable()) {\n xcodebuildOutputFormatter = child_process.spawn('xcpretty', [], {\n stdio: ['pipe', process.stdout, process.stderr],\n });\n }\n }\n const buildProcess = child_process.spawn(\n 'xcodebuild',\n xcodebuildArgs,\n getProcessOptions(args),\n );\n let buildOutput = '';\n let errorOutput = '';\n buildProcess.stdout.on('data', (data: Buffer) => {\n const stringData = data.toString();\n buildOutput += stringData;\n if (xcodebuildOutputFormatter) {\n xcodebuildOutputFormatter.stdin.write(data);\n } else {\n if (logger.isVerbose()) {\n logger.debug(stringData);\n } else {\n loader.start(\n `Building the app${'.'.repeat(buildOutput.length % 10)}`,\n );\n }\n }\n });\n\n buildProcess.stderr.on('data', (data: Buffer) => {\n errorOutput += data;\n });\n buildProcess.on('close', (code: number) => {\n if (xcodebuildOutputFormatter) {\n xcodebuildOutputFormatter.stdin.end();\n } else {\n loader.stop();\n }\n if (code !== 0) {\n printRunDoctorTip();\n reject(\n new CLIError(\n `\n Failed to build iOS project.\n\n We ran \"xcodebuild\" command but it exited with error code ${code}. To debug b