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

Function constructDestinationString

src/utils/xcode.ts:6–51  ·  view source on GitHub ↗
(
  platform: XcodePlatform,
  simulatorName?: string,
  simulatorId?: string,
  useLatest: boolean = true,
  arch?: string,
)

Source from the content-addressed store, hash-verified

4export { XcodePlatform };
5
6export function constructDestinationString(
7 platform: XcodePlatform,
8 simulatorName?: string,
9 simulatorId?: string,
10 useLatest: boolean = true,
11 arch?: string,
12): string {
13 const isSimulatorPlatform = [
14 XcodePlatform.iOSSimulator,
15 XcodePlatform.watchOSSimulator,
16 XcodePlatform.tvOSSimulator,
17 XcodePlatform.visionOSSimulator,
18 ].includes(platform);
19
20 if (isSimulatorPlatform && simulatorId) {
21 return `platform=${platform},id=${simulatorId}`;
22 }
23
24 if (isSimulatorPlatform && simulatorName) {
25 return `platform=${platform},name=${simulatorName}${useLatest ? ',OS=latest' : ''}`;
26 }
27
28 if (isSimulatorPlatform) {
29 log(
30 'warn',
31 `Constructing generic destination for ${platform} without name or ID. This might not be specific enough.`,
32 );
33 throw new Error(`Simulator name or ID is required for specific ${platform} operations`);
34 }
35
36 switch (platform) {
37 case XcodePlatform.macOS:
38 return arch ? `platform=macOS,arch=${arch}` : 'platform=macOS';
39 case XcodePlatform.iOS:
40 return 'generic/platform=iOS';
41 case XcodePlatform.watchOS:
42 return 'generic/platform=watchOS';
43 case XcodePlatform.tvOS:
44 return 'generic/platform=tvOS';
45 case XcodePlatform.visionOS:
46 return 'generic/platform=visionOS';
47 }
48
49 log('error', `Reached unexpected point in constructDestinationString for platform: ${platform}`);
50 return `platform=${platform}`;
51}

Callers 3

executeXcodeBuildCommandFunction · 0.90

Calls 1

logFunction · 0.90

Tested by

no test coverage detected