MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / resolveAppPathFromBuildSettings

Function resolveAppPathFromBuildSettings

src/utils/app-path-resolver.ts:43–92  ·  view source on GitHub ↗
(
  params: ResolveAppPathFromBuildSettingsParams,
  executor: CommandExecutor,
)

Source from the content-addressed store, hash-verified

41 * destination is derived from `platform` and optional `deviceId`.
42 */
43export async function resolveAppPathFromBuildSettings(
44 params: ResolveAppPathFromBuildSettingsParams,
45 executor: CommandExecutor,
46): Promise<string> {
47 const command = ['xcodebuild', '-showBuildSettings'];
48
49 const workspacePath = resolvePathFromCwd(params.workspacePath);
50 const projectPath = resolvePathFromCwd(params.projectPath);
51 const derivedDataPath = resolveEffectiveDerivedDataPath({
52 derivedDataPath: params.derivedDataPath,
53 workspacePath,
54 projectPath,
55 });
56
57 let projectDir: string | undefined;
58
59 if (projectPath) {
60 command.push('-project', projectPath);
61 projectDir = path.dirname(projectPath);
62 } else if (workspacePath) {
63 command.push('-workspace', workspacePath);
64 projectDir = path.dirname(workspacePath);
65 }
66
67 command.push('-scheme', params.scheme);
68 command.push('-configuration', params.configuration ?? 'Debug');
69
70 const destination =
71 params.destination ?? getBuildSettingsDestination(params.platform, params.deviceId);
72 command.push('-destination', destination);
73
74 command.push('-derivedDataPath', derivedDataPath);
75
76 if (params.extraArgs && params.extraArgs.length > 0) {
77 command.push(...params.extraArgs);
78 }
79
80 const result = await executor(
81 command,
82 'Get App Path',
83 false,
84 projectDir ? { cwd: projectDir } : undefined,
85 );
86
87 if (!result.success) {
88 throw new Error(result.error ?? 'Unknown error');
89 }
90
91 return extractAppPathFromBuildSettingsOutput(result.output);
92}

Calls 6

resolvePathFromCwdFunction · 0.90
pushMethod · 0.80
executorFunction · 0.50

Tested by

no test coverage detected