@sentry/wizard 6.0.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +6 -0
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +7 -1
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/nextjs-14.test.js +5 -1
  7. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/nextjs-15.test.js +5 -1
  9. package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
  10. package/dist/e2e-tests/tests/nuxt-3.test.js +9 -1
  11. package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
  12. package/dist/e2e-tests/tests/nuxt-4.test.js +9 -1
  13. package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
  14. package/dist/e2e-tests/tests/remix.test.js +8 -2
  15. package/dist/e2e-tests/tests/remix.test.js.map +1 -1
  16. package/dist/e2e-tests/tests/sveltekit.test.js +15 -3
  17. package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
  18. package/dist/src/angular/angular-wizard.js +6 -1
  19. package/dist/src/angular/angular-wizard.js.map +1 -1
  20. package/dist/src/angular/codemods/main.d.ts +4 -1
  21. package/dist/src/angular/codemods/main.js +3 -0
  22. package/dist/src/angular/codemods/main.js.map +1 -1
  23. package/dist/src/angular/sdk-setup.d.ts +1 -0
  24. package/dist/src/angular/sdk-setup.js.map +1 -1
  25. package/dist/src/apple/templates.js +17 -2
  26. package/dist/src/apple/templates.js.map +1 -1
  27. package/dist/src/apple/xcode-manager.d.ts +23 -0
  28. package/dist/src/apple/xcode-manager.js +140 -40
  29. package/dist/src/apple/xcode-manager.js.map +1 -1
  30. package/dist/src/nextjs/nextjs-wizard.js +6 -1
  31. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  32. package/dist/src/nextjs/templates.d.ts +3 -0
  33. package/dist/src/nextjs/templates.js +15 -2
  34. package/dist/src/nextjs/templates.js.map +1 -1
  35. package/dist/src/nuxt/sdk-setup.js +5 -0
  36. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  37. package/dist/src/nuxt/templates.d.ts +1 -0
  38. package/dist/src/nuxt/templates.js +3 -2
  39. package/dist/src/nuxt/templates.js.map +1 -1
  40. package/dist/src/remix/remix-wizard.js +5 -0
  41. package/dist/src/remix/remix-wizard.js.map +1 -1
  42. package/dist/src/remix/sdk-setup.d.ts +5 -0
  43. package/dist/src/remix/sdk-setup.js +4 -0
  44. package/dist/src/remix/sdk-setup.js.map +1 -1
  45. package/dist/src/sveltekit/sdk-setup.js +11 -0
  46. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  47. package/dist/src/sveltekit/templates.d.ts +2 -0
  48. package/dist/src/sveltekit/templates.js +10 -0
  49. package/dist/src/sveltekit/templates.js.map +1 -1
  50. package/dist/src/version.d.ts +1 -1
  51. package/dist/src/version.js +1 -1
  52. package/dist/src/version.js.map +1 -1
  53. package/dist/test/apple/templates.test.js +36 -34
  54. package/dist/test/apple/templates.test.js.map +1 -1
  55. package/dist/test/apple/xcode-manager.test.js +418 -0
  56. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  57. package/dist/test/nextjs/templates.test.js +119 -0
  58. package/dist/test/nextjs/templates.test.js.map +1 -1
  59. package/dist/test/nuxt/templates.test.js +119 -0
  60. package/dist/test/nuxt/templates.test.js.map +1 -1
  61. package/dist/test/remix/client-entry.test.js +56 -0
  62. package/dist/test/remix/client-entry.test.js.map +1 -1
  63. package/dist/test/remix/server-instrumentation.test.js +37 -1
  64. package/dist/test/remix/server-instrumentation.test.js.map +1 -1
  65. package/dist/test/sveltekit/templates.test.js +67 -0
  66. package/dist/test/sveltekit/templates.test.js.map +1 -1
  67. package/package.json +1 -1
@@ -170,45 +170,6 @@ function addSentrySPM(proj, targetName) {
170
170
  'Sentry';
171
171
  clack.log.step('Added Sentry SPM dependency to your project');
172
172
  }
173
- function addUploadSymbolsScript(xcodeProject, sentryProject, targetName, uploadSource) {
174
- const xcObjects = xcodeProject.hash.project.objects;
175
- if (!xcObjects.PBXNativeTarget) {
176
- xcObjects.PBXNativeTarget = {};
177
- }
178
- const targetKey = Object.keys(xcObjects.PBXNativeTarget).filter((key) => {
179
- const value = xcObjects.PBXNativeTarget?.[key];
180
- return (!key.endsWith('_comment') &&
181
- typeof value !== 'string' &&
182
- value?.name === targetName);
183
- })[0];
184
- if (!xcObjects.PBXShellScriptBuildPhase) {
185
- xcObjects.PBXShellScriptBuildPhase = {};
186
- }
187
- for (const key in xcObjects.PBXShellScriptBuildPhase) {
188
- const value = xcObjects.PBXShellScriptBuildPhase[key] ?? {};
189
- if (typeof value === 'string') {
190
- // Ignore comments
191
- continue;
192
- }
193
- // Sentry script already exists, update it
194
- if (value.shellScript?.includes('sentry-cli')) {
195
- delete xcObjects.PBXShellScriptBuildPhase?.[key];
196
- delete xcObjects.PBXShellScriptBuildPhase?.[`${key}_comment`];
197
- break;
198
- }
199
- xcObjects.PBXShellScriptBuildPhase[key] = value;
200
- }
201
- // Add the build phase to the target
202
- const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');
203
- xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', targetKey, {
204
- inputFileListPaths: [],
205
- outputFileListPaths: [],
206
- inputPaths: [templates.scriptInputPath],
207
- shellPath: '/bin/sh',
208
- shellScript: templates.getRunScriptTemplate(sentryProject.organization.slug, sentryProject.slug, uploadSource, isHomebrewInstalled),
209
- });
210
- clack.log.step(`Added Sentry upload script to "${targetName}" build phase`);
211
- }
212
173
  class XcodeProject {
213
174
  /**
214
175
  * The directory where the Xcode project is located.
@@ -254,7 +215,11 @@ class XcodeProject {
254
215
  });
255
216
  }
256
217
  updateXcodeProject(sentryProject, target, addSPMReference, uploadSource = true) {
257
- addUploadSymbolsScript(this.project, sentryProject, target, uploadSource);
218
+ this.addUploadSymbolsScript({
219
+ sentryProject,
220
+ targetName: target,
221
+ uploadSource,
222
+ });
258
223
  if (uploadSource) {
259
224
  setDebugInformationFormatAndSandbox(this.project, target);
260
225
  }
@@ -264,6 +229,83 @@ class XcodeProject {
264
229
  const newContent = this.project.writeSync();
265
230
  fs.writeFileSync(this.pbxprojPath, newContent);
266
231
  }
232
+ addUploadSymbolsScript({ sentryProject, targetName, uploadSource, }) {
233
+ const xcObjects = this.project.hash.project.objects;
234
+ if (!xcObjects.PBXNativeTarget) {
235
+ xcObjects.PBXNativeTarget = {};
236
+ }
237
+ const targetKey = Object.keys(xcObjects.PBXNativeTarget).filter((key) => {
238
+ const value = xcObjects.PBXNativeTarget?.[key];
239
+ return (!key.endsWith('_comment') &&
240
+ typeof value !== 'string' &&
241
+ value?.name === targetName);
242
+ })[0];
243
+ const target = xcObjects.PBXNativeTarget[targetKey];
244
+ if (!target) {
245
+ (0, debug_1.debug)(`Target not found: ${targetName}`);
246
+ return;
247
+ }
248
+ // Generate the new script content
249
+ const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');
250
+ const shellScript = templates.getRunScriptTemplate(sentryProject.organization.slug, sentryProject.slug, uploadSource, isHomebrewInstalled);
251
+ if (!xcObjects.PBXShellScriptBuildPhase) {
252
+ xcObjects.PBXShellScriptBuildPhase = {};
253
+ }
254
+ // Look for existing Sentry build phase in the current target
255
+ let existingSentryBuildPhaseId;
256
+ let existingSentryBuildPhase;
257
+ // Check target's build phases for existing Sentry script by searching for a build phase that contains "sentry-cli" in the shell script
258
+ if (target.buildPhases) {
259
+ for (const phase of target.buildPhases) {
260
+ const buildPhase = xcObjects.PBXShellScriptBuildPhase[phase.value];
261
+ if (typeof buildPhase === 'object' &&
262
+ buildPhase.shellScript?.includes('sentry-cli')) {
263
+ existingSentryBuildPhaseId = phase.value;
264
+ existingSentryBuildPhase = buildPhase;
265
+ break;
266
+ }
267
+ }
268
+ }
269
+ // Clean up orphaned build phase references that may exist from previous runs
270
+ // Find all build phase IDs that are referenced in targets but don't exist in PBXShellScriptBuildPhase
271
+ const orphanedBuildPhaseIds = [];
272
+ for (const targetKey in xcObjects.PBXNativeTarget) {
273
+ const targetValue = xcObjects.PBXNativeTarget[targetKey];
274
+ if (typeof targetValue === 'object' && targetValue.buildPhases) {
275
+ for (const phase of targetValue.buildPhases) {
276
+ // Check if this is a shell script build phase that doesn't exist
277
+ if (!xcObjects.PBXShellScriptBuildPhase?.[phase.value] &&
278
+ phase.comment?.includes('Upload Debug Symbols to Sentry')) {
279
+ orphanedBuildPhaseIds.push(phase.value);
280
+ }
281
+ }
282
+ }
283
+ }
284
+ // Remove orphaned build phase references from all targets
285
+ if (orphanedBuildPhaseIds.length > 0) {
286
+ for (const targetKey in xcObjects.PBXNativeTarget) {
287
+ const targetValue = xcObjects.PBXNativeTarget[targetKey];
288
+ if (typeof targetValue === 'object' && targetValue.buildPhases) {
289
+ targetValue.buildPhases = targetValue.buildPhases.filter((phase) => {
290
+ return !orphanedBuildPhaseIds.includes(phase.value);
291
+ });
292
+ }
293
+ }
294
+ }
295
+ if (existingSentryBuildPhaseId && existingSentryBuildPhase) {
296
+ // Update existing build phase instead of adding a new one
297
+ // This call is idempotent, so it will not add a new build phase if it already exists
298
+ this.updateScriptBuildPhase(existingSentryBuildPhaseId, shellScript, [
299
+ templates.scriptInputPath,
300
+ ]);
301
+ clack.log.step(`Updated existing Sentry upload script for "${targetName}" build phase`);
302
+ }
303
+ else {
304
+ // Add new build phase to the target
305
+ this.addScriptBuildPhase(targetKey, 'Upload Debug Symbols to Sentry', shellScript, [templates.scriptInputPath]);
306
+ clack.log.step(`Added Sentry upload script to "${targetName}" build phase`);
307
+ }
308
+ }
267
309
  /**
268
310
  * Retrieves all source files associated with a specific target in the Xcode project.
269
311
  * This is used to find files where we can inject Sentry initialization code.
@@ -362,6 +404,64 @@ class XcodeProject {
362
404
  (0, debug_1.debug)(`No source build phase found for target: ${target.name}`);
363
405
  return undefined;
364
406
  }
407
+ /**
408
+ * Adds a new script build phase to the specified target.
409
+ *
410
+ * @param targetKey - The key of the target to add the build phase to
411
+ * @param name - The name of the build phase
412
+ * @param script - The shell script content
413
+ * @param inputPaths - Array of input paths for the script
414
+ * @returns The UUID of the created build phase
415
+ */
416
+ addScriptBuildPhase(targetKey, name, script, inputPaths = []) {
417
+ const buildPhaseUuid = this.project.generateUuid();
418
+ const escapedScript = script.replace(/"/g, '\\"');
419
+ // Create the shell script build phase object
420
+ const buildPhase = {
421
+ isa: 'PBXShellScriptBuildPhase',
422
+ buildActionMask: 2147483647,
423
+ files: [],
424
+ inputPaths,
425
+ outputPaths: [],
426
+ runOnlyForDeploymentPostprocessing: 0,
427
+ shellPath: '/bin/sh',
428
+ shellScript: `"${escapedScript}"`,
429
+ name: `"${name}"`,
430
+ };
431
+ // Add to PBXShellScriptBuildPhase section
432
+ if (!this.objects.PBXShellScriptBuildPhase) {
433
+ this.objects.PBXShellScriptBuildPhase = {};
434
+ }
435
+ this.objects.PBXShellScriptBuildPhase[buildPhaseUuid] = buildPhase;
436
+ this.objects.PBXShellScriptBuildPhase[`${buildPhaseUuid}_comment`] = name;
437
+ // Add to target's build phases
438
+ const target = this.objects.PBXNativeTarget?.[targetKey];
439
+ if (target?.buildPhases) {
440
+ target.buildPhases.push({
441
+ value: buildPhaseUuid,
442
+ comment: name,
443
+ });
444
+ }
445
+ return buildPhaseUuid;
446
+ }
447
+ /**
448
+ * Updates an existing script build phase.
449
+ *
450
+ * @param buildPhaseId - The UUID of the build phase to update
451
+ * @param script - The new shell script content
452
+ * @param inputPaths - Array of input paths for the script
453
+ */
454
+ updateScriptBuildPhase(buildPhaseId, script, inputPaths = []) {
455
+ const buildPhase = this.objects.PBXShellScriptBuildPhase?.[buildPhaseId];
456
+ if (!buildPhase || typeof buildPhase === 'string') {
457
+ (0, debug_1.debug)(`Build phase not found: ${buildPhaseId}`);
458
+ return;
459
+ }
460
+ const escapedScript = script.replace(/"/g, '\\"');
461
+ buildPhase.shellScript = `"${escapedScript}"`;
462
+ buildPhase.inputPaths = inputPaths;
463
+ buildPhase.shellPath = '/bin/sh';
464
+ }
365
465
  // ================================ FILE HELPERS ================================
366
466
  /**
367
467
  * Finds all files in the source build phase of a target.
@@ -1 +1 @@
1
- {"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xcode-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,+EAA+E;AAC/E,sDAAwC;AACxC,4CAA8B;AAC9B,gDAAkC;AAClC,0CAAuC;AAEvC,uDAAyC;AAEzC,iCAYe;AACf,+DAA2D;AAS3D,SAAS,mCAAmC,CAC1C,IAAa,EACb,UAAkB;IAElB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC5C,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE;QAC9B,SAAS,CAAC,eAAe,GAAG,EAAE,CAAC;KAChC;IACD,MAAM,SAAS,GAAW,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,MAAM,CACrE,CAAC,GAAG,EAAE,EAAE;QACN,MAAM,KAAK,GAAG,SAAS,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO,CACL,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;YACzB,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,EAAE,IAAI,KAAK,UAAU,CAC3B,CAAC;IACJ,CAAC,CACF,CAAC,CAAC,CAAC,CAAC;IACL,MAAM,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,SAAS,CAErC,CAAC;IAEd,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE;QACnC,SAAS,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,CAAC,KAAK;gBACnB,GAAG,EAAE,YAAY;gBACjB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC;SACJ;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAqB;IAE7C;;;;OAIG;IACK,6BAA6B;QACnC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,MAAM,aAAa,GAAG,wCAAkB,CAAC,sBAAsB,CAC7D,IAAI,CAAC,aAAa,CACnB,CAAC;QACF,IAAI,CAAC,aAAa,EAAE;YAClB,IAAA,aAAK,EAAC,qCAAqC,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,gBAAgB;YACnB,aAAa,CAAC,kBAAkB,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAjgCD,oCAigCC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { debug } from '../utils/debug';\nimport type { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\n\nimport {\n project as createXcodeProject,\n PBXFileReference,\n PBXFileSystemSynchronizedBuildFileExceptionSet,\n PBXSourcesBuildPhase,\n type PBXBuildFile,\n type PBXFileSystemSynchronizedRootGroup,\n type PBXGroup,\n type PBXNativeTarget,\n type PBXObjects,\n type Project,\n type XCConfigurationList,\n} from 'xcode';\nimport { MacOSSystemHelpers } from './macos-system-helper';\nimport { XcodeProjectObjectWithId } from './xcode-project-object-with-id';\n\ninterface ProjectFile {\n key?: string;\n name: string;\n path: string;\n}\n\nfunction setDebugInformationFormatAndSandbox(\n proj: Project,\n targetName: string,\n): void {\n const xcObjects = proj.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as\n | PBXNativeTarget\n | undefined;\n\n if (!xcObjects.XCBuildConfiguration) {\n xcObjects.XCBuildConfiguration = {};\n }\n if (!xcObjects.XCConfigurationList) {\n xcObjects.XCConfigurationList = {};\n }\n const buildConfigurationListId = target?.buildConfigurationList ?? '';\n const configurationList = xcObjects.XCConfigurationList?.[\n buildConfigurationListId\n ] as XCConfigurationList | undefined;\n const buildListConfigurationIds =\n configurationList?.buildConfigurations ?? [];\n for (const buildListConfigId of buildListConfigurationIds) {\n const config =\n xcObjects.XCBuildConfiguration[buildListConfigId.value] ?? {};\n if (typeof config === 'string') {\n // Ignore comments\n continue;\n }\n\n const buildSettings = config.buildSettings ?? {};\n buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n buildSettings.ENABLE_USER_SCRIPT_SANDBOXING = '\"NO\"';\n\n config.buildSettings = buildSettings;\n xcObjects.XCBuildConfiguration[buildListConfigId.value] = config;\n }\n}\n\nfunction addSentrySPM(proj: Project, targetName: string): void {\n const xcObjects = proj.hash.project.objects;\n\n const sentryFrameworkUUID = proj.generateUuid();\n const sentrySPMUUID = proj.generateUuid();\n\n // Check whether xcObjects already have sentry framework\n if (xcObjects.PBXFrameworksBuildPhase) {\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n const frameworkBuildPhase = xcObjects.PBXFrameworksBuildPhase[key];\n if (key.endsWith('_comment') || typeof frameworkBuildPhase === 'string') {\n // Ignore comments\n continue;\n }\n for (const framework of frameworkBuildPhase.files ?? []) {\n // We identify the Sentry framework by the comment \"Sentry in Frameworks\",\n // which is set by this manager in previous runs.\n if (framework.comment === 'Sentry in Frameworks') {\n return;\n }\n }\n }\n }\n\n if (!xcObjects.PBXBuildFile) {\n xcObjects.PBXBuildFile = {};\n }\n xcObjects.PBXBuildFile[sentryFrameworkUUID] = {\n isa: 'PBXBuildFile',\n productRef: sentrySPMUUID,\n productRef_comment: 'Sentry',\n };\n xcObjects.PBXBuildFile[`${sentryFrameworkUUID}_comment`] =\n 'Sentry in Frameworks';\n\n if (!xcObjects.PBXFrameworksBuildPhase) {\n xcObjects.PBXFrameworksBuildPhase = {};\n }\n for (const key in xcObjects.PBXFrameworksBuildPhase) {\n const value = xcObjects.PBXFrameworksBuildPhase[key];\n if (key.endsWith('_comment') || typeof value === 'string') {\n // Ignore comments\n continue;\n }\n\n const frameworks = value.files ?? [];\n frameworks.push({\n value: sentryFrameworkUUID,\n comment: 'Sentry in Frameworks',\n });\n value.files = frameworks;\n\n xcObjects.PBXFrameworksBuildPhase[key] = value;\n }\n\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as PBXNativeTarget;\n\n if (!target.packageProductDependencies) {\n target.packageProductDependencies = [];\n }\n target.packageProductDependencies.push({\n value: sentrySPMUUID,\n comment: 'Sentry',\n });\n\n const sentrySwiftPackageUUID = proj.generateUuid();\n const xcProject = proj.getFirstProject().firstProject;\n if (!xcProject.packageReferences) {\n xcProject.packageReferences = [];\n }\n xcProject.packageReferences.push({\n value: sentrySwiftPackageUUID,\n comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n });\n\n if (!xcObjects.XCRemoteSwiftPackageReference) {\n xcObjects.XCRemoteSwiftPackageReference = {};\n }\n\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: '\"https://github.com/getsentry/sentry-cocoa/\"',\n requirement: {\n kind: 'upToNextMajorVersion',\n minimumVersion: '8.0.0',\n },\n };\n xcObjects.XCRemoteSwiftPackageReference[`${sentrySwiftPackageUUID}_comment`] =\n 'XCRemoteSwiftPackageReference \"sentry-cocoa\"';\n\n if (!xcObjects.XCSwiftPackageProductDependency) {\n xcObjects.XCSwiftPackageProductDependency = {};\n }\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {\n isa: 'XCSwiftPackageProductDependency',\n package: sentrySwiftPackageUUID,\n package_comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n productName: 'Sentry',\n };\n xcObjects.XCSwiftPackageProductDependency[`${sentrySPMUUID}_comment`] =\n 'Sentry';\n\n clack.log.step('Added Sentry SPM dependency to your project');\n}\n\nfunction addUploadSymbolsScript(\n xcodeProject: Project,\n sentryProject: SentryProjectData,\n targetName: string,\n uploadSource: boolean,\n): void {\n const xcObjects = xcodeProject.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget).filter((key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n })[0];\n\n if (!xcObjects.PBXShellScriptBuildPhase) {\n xcObjects.PBXShellScriptBuildPhase = {};\n }\n for (const key in xcObjects.PBXShellScriptBuildPhase) {\n const value = xcObjects.PBXShellScriptBuildPhase[key] ?? {};\n if (typeof value === 'string') {\n // Ignore comments\n continue;\n }\n\n // Sentry script already exists, update it\n if (value.shellScript?.includes('sentry-cli')) {\n delete xcObjects.PBXShellScriptBuildPhase?.[key];\n delete xcObjects.PBXShellScriptBuildPhase?.[`${key}_comment`];\n break;\n }\n xcObjects.PBXShellScriptBuildPhase[key] = value;\n }\n\n // Add the build phase to the target\n const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n targetKey,\n {\n inputFileListPaths: [],\n outputFileListPaths: [],\n inputPaths: [templates.scriptInputPath],\n shellPath: '/bin/sh',\n shellScript: templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n uploadSource,\n isHomebrewInstalled,\n ),\n },\n );\n clack.log.step(`Added Sentry upload script to \"${targetName}\" build phase`);\n}\n\nexport class XcodeProject {\n /**\n * The directory where the Xcode project is located.\n */\n baseDir: string;\n\n /**\n * The path to the `<PROJECT>.xcodeproj` directory.\n */\n xcodeprojPath: string;\n\n /**\n * The path to the `project.pbxproj` file.\n */\n pbxprojPath: string;\n\n /**\n * The Xcode project object.\n */\n project: Project;\n\n objects: PBXObjects;\n\n /**\n * Creates a new XcodeProject instance, a wrapper around the Xcode project file `<PROJECT>.xcodeproj/project.pbxproj`.\n *\n * @param projectPath - The path to the Xcode project file\n */\n public constructor(projectPath: string) {\n this.pbxprojPath = projectPath;\n this.xcodeprojPath = path.dirname(projectPath);\n this.baseDir = path.dirname(this.xcodeprojPath);\n\n this.project = createXcodeProject(projectPath);\n this.project.parseSync();\n this.objects = this.project.hash.project.objects;\n }\n\n public getAllTargets(): string[] {\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value.productType.startsWith('\"com.apple.product-type.application')\n );\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public updateXcodeProject(\n sentryProject: SentryProjectData,\n target: string,\n addSPMReference: boolean,\n uploadSource = true,\n ): void {\n addUploadSymbolsScript(this.project, sentryProject, target, uploadSource);\n if (uploadSource) {\n setDebugInformationFormatAndSandbox(this.project, target);\n }\n if (addSPMReference) {\n addSentrySPM(this.project, target);\n }\n const newContent = this.project.writeSync();\n fs.writeFileSync(this.pbxprojPath, newContent);\n }\n\n /**\n * Retrieves all source files associated with a specific target in the Xcode project.\n * This is used to find files where we can inject Sentry initialization code.\n *\n * @param targetName - The name of the target to get files for\n * @returns An array of absolute file paths for the target's source files, or undefined if target not found\n */\n public getSourceFilesForTarget(targetName: string): string[] | undefined {\n // ## Summary how Xcode Projects are structured:\n // - Every Xcode Project has exactly one main group of type `PBXGroup`\n // - The main group contains a list of children identifiers\n // - Each child can be a `PBXGroup`, a `PBXFileReference` or a `PBXFileSystemSynchronizedRootGroup`\n // - Each `PBXGroup` has a list of children identifiers which again can be `PBXGroup`, `PBXFileReference` or `PBXFileSystemSynchronizedRootGroup`\n // - The target defines the list of `fileSystemSynchronizedGroups` which are `PBXFileSystemSynchronizedRootGroup` to be included in the build phase\n // - The `PBXFileSystemSynchronizedRootGroup` has a list of `exceptions` which are `PBXFileSystemSynchronizedBuildFileExceptionSet`\n // - Each `PBXFileSystemSynchronizedBuildFileExceptionSet` represents a folder to be excluded from the build.\n // - The `PBXFileSystemSynchronizedBuildFileExceptionSet` has a list of `membershipExceptions` which are files to be excluded from being excluded, therefore included in the build.\n // - The Xcode project has a build phase `PBXSourcesBuildPhase` which has a list of `files` which are `PBXBuildFile`\n // - A file which is not part of a `PBXFileSystemSynchronizedRootGroup` must be added to the `files` list of the `PBXSourcesBuildPhase` build phase\n // - Nested subfolders in `fileSystemSynchronizedGroups` are not declared but recursively included\n //\n // Based on the findings above the files included in the build phase are:\n // - All files in the `files` of the `PBXSourcesBuildPhase` build phase `Sources` of the target\n // - All files in directories of the `fileSystemSynchronizedGroups` of the target\n // - Excluding all files in the `exceptions` of the `PBXFileSystemSynchronizedRootGroup` of the target\n // - Including all files in the `membershipExceptions` of the `PBXFileSystemSynchronizedBuildFileExceptionSet` of the target\n const nativeTarget = this.findNativeTargetByName(targetName);\n if (!nativeTarget) {\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n const filesInBuildPhase = this.findFilesInSourceBuildPhase(nativeTarget);\n debug(\n `Found ${filesInBuildPhase.length} files in build phase for target: ${targetName}`,\n );\n\n const filesInSynchronizedRootGroups =\n this.findFilesInSynchronizedRootGroups(nativeTarget);\n debug(\n `Found ${filesInSynchronizedRootGroups.length} files in synchronized root groups for target: ${targetName}`,\n );\n return [...filesInBuildPhase, ...filesInSynchronizedRootGroups];\n }\n\n // ================================ TARGET HELPERS ================================\n\n /**\n * Finds a native target by name.\n *\n * @param targetName - The name of the target to find\n * @returns The native target, or undefined if the target is not found\n */\n private findNativeTargetByName(\n targetName: string,\n ): XcodeProjectObjectWithId<PBXNativeTarget> | undefined {\n debug('Finding native target by name: ' + targetName);\n\n if (!this.objects.PBXNativeTarget) {\n debug('No native targets found');\n return undefined;\n }\n\n const nativeTargets = Object.entries(this.objects.PBXNativeTarget);\n for (const [key, target] of nativeTargets) {\n // Ignore comments\n if (key.endsWith('_comment') || typeof target === 'string') {\n continue;\n }\n\n // Ignore targets that are not the target we are looking for\n if (target.name !== targetName) {\n continue;\n }\n debug('Found native target: ' + targetName);\n return {\n id: key,\n obj: target,\n };\n }\n\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n // ================================ BUILD PHASE HELPERS ================================\n\n /**\n * Finds the source build phase in a target.\n *\n * @param target - The target to find the source build phase in\n * @returns The source build phase, or undefined if the target is not found or has no source build phase\n */\n findSourceBuildPhaseInTarget(\n target: PBXNativeTarget,\n ): XcodeProjectObjectWithId<PBXSourcesBuildPhase> | undefined {\n debug(`Finding source build phase in target: ${target.name}`);\n if (!target.buildPhases) {\n debug('No build phases found for target: ' + target.name);\n return undefined;\n }\n for (const phase of target.buildPhases) {\n const buildPhaseId = phase.value;\n const buildPhase = this.objects.PBXSourcesBuildPhase?.[buildPhaseId];\n if (typeof buildPhase !== 'object') {\n // Ignore comments\n continue;\n }\n debug(\n `Found source build phase: ${buildPhaseId} for target: ${target.name}`,\n );\n return {\n id: buildPhaseId,\n obj: buildPhase,\n };\n }\n\n debug(`No source build phase found for target: ${target.name}`);\n return undefined;\n }\n\n // ================================ FILE HELPERS ================================\n\n /**\n * Finds all files in the source build phase of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the source build phase of the target, or an empty array if the target is not found or has no source build phase\n */\n findFilesInSourceBuildPhase(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n 'Finding files in source build phase for target: ' +\n nativeTarget.obj.name,\n );\n const buildPhase = this.findSourceBuildPhaseInTarget(nativeTarget.obj);\n if (!buildPhase) {\n debug(\n `Sources build phase not found for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n const buildPhaseFiles = buildPhase.obj.files;\n if (!buildPhaseFiles) {\n debug(\n `No files found in sources build phase for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n if (!this.objects.PBXBuildFile) {\n debug('PBXBuildFile is undefined');\n return [];\n }\n if (!this.objects.PBXFileReference) {\n debug('PBXFileReference is undefined');\n return [];\n }\n\n const result: string[] = [];\n for (const file of buildPhaseFiles) {\n debug(`Resolving build phase file: ${file.value}`);\n // Find the related build file object\n const buildFileObj = this.objects.PBXBuildFile[\n file.value\n ] as PBXBuildFile;\n if (!buildFileObj || typeof buildFileObj !== 'object') {\n debug(`Build file object not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file object found for file: ${file.value}`);\n\n const buildFileRefId = buildFileObj.fileRef;\n if (!buildFileRefId) {\n debug(`File reference not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file reference found for file: ${file.value}`);\n\n // Find the related file reference object\n const buildFile = this.objects.PBXFileReference[buildFileRefId];\n if (!buildFile || typeof buildFile !== 'object') {\n debug(`File not found in file dictionary for file: ${file.value}`);\n continue;\n }\n debug(`Build file found in file dictionary for file: ${file.value}`);\n\n // Resolve the path of the file based on the `sourceTree` property\n const resolvedFilePath = this.resolveAbsolutePathOfFileReference({\n id: buildFileRefId,\n obj: buildFile,\n });\n if (!resolvedFilePath) {\n debug(`Failed to resolve file path for file: ${file.value}`);\n continue;\n }\n debug(`Resolved file ${file.value} to path: ${resolvedFilePath}`);\n\n result.push(resolvedFilePath);\n }\n\n debug(\n `Resolved ${result.length} files for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n /**\n * Resolves the absolute path of a file reference.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsolutePathOfFileReference(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving path of file reference: ${fileRef.id} with path: ${fileRef.obj.path}`,\n );\n // File path is expected to be set, therefore typing is non-nullable.\n // As the file is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!fileRef.obj.path) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // File references are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<absolute>': The file path is absolute\n // - '<group>': The file path is relative to the parent group of the file reference\n // - 'BUILT_PRODUCTS_DIR': The file path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SOURCE_ROOT': The file path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'SDKROOT': The file path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The file path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const fileRefSourceTree = fileRef.obj.sourceTree?.replace(/\"/g, '') ?? '';\n switch (fileRefSourceTree) {\n case '<absolute>':\n return fileRef.obj.path.replace(/\"/g, '');\n case '<group>':\n return this.resolveAbsoluteFilePathRelativeToGroup(fileRef);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolveAbsoluteFilePathRelativeToBuiltProductsDir(fileRef);\n case 'SOURCE_ROOT':\n return this.resolveAbsoluteFilePathRelativeToSourceRoot(fileRef);\n case 'SDKROOT':\n return this.resolveAbsoluteFilePathRelativeToSdkRoot(fileRef);\n case 'DEVELOPER_DIR':\n return this.resolveAbsoluteFilePathRelativeToDeveloperDir(fileRef);\n default:\n debug(\n `Unknown source tree '${fileRef.obj.sourceTree}' for build file: ${fileRef.obj.path}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the parent group.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToGroup(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to group for file reference: ${\n fileRef.id\n } with path: ${fileRef.obj.path ?? ''}`,\n );\n const fileRefPath = fileRef.obj.path?.replace(/\"/g, '');\n if (!fileRefPath) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // Find the parent group of the file reference by searching for the reverse relationship\n const parentGroup = this.findParentGroupByChildId(fileRef.id);\n if (!parentGroup) {\n debug(\n `Parent group not found for file reference: ${fileRef.id} at path: ${fileRefPath}`,\n );\n return undefined;\n }\n\n // Resolve the path of the parent group\n const absoluteGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of group: ${parentGroup.id}`);\n return undefined;\n }\n\n return path.join(absoluteGroupPath, fileRefPath);\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the built products directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToBuiltProductsDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to built products directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSourceRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n return path.join(this.baseDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the SDK root.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSdkRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to SDK root for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the developer directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToDeveloperDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to developer directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} with path: ${group.obj.path ?? ''}`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfGroupRelativeToSourceRoot(group);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfGroupRelativeToBuiltProductsDir(group);\n case 'SDKROOT':\n return this.resolvePathOfGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfGroupRelativeToDeveloperDir(group);\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} with path: ${\n group.obj.path ?? ''\n }`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfSynchronizedRootGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group,\n );\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group,\n );\n case 'SDKROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group,\n );\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Finds all files in the synchronized root groups of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the synchronized root groups of the target, or an empty array if the target is not found or has no synchronized root groups\n */\n findFilesInSynchronizedRootGroups(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n `Finding files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n const synchronizedRootGroups =\n nativeTarget.obj.fileSystemSynchronizedGroups ?? [];\n\n const result: string[] = [];\n for (const group of synchronizedRootGroups) {\n const groupObj =\n this.objects.PBXFileSystemSynchronizedRootGroup?.[group.value];\n if (!groupObj || typeof groupObj !== 'object') {\n debug(`Synchronized root group not found: ${group.value}`);\n continue;\n }\n debug(`Found synchronized root group: ${group.value}`);\n\n const files = this.getFilesInSynchronizedRootGroup({\n id: group.value,\n obj: groupObj,\n });\n debug(\n `Found ${files.length} files in synchronized root group: ${group.value}`,\n );\n result.push(...files.map((file) => file.path));\n }\n debug(\n `Found ${result.length} files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n private getFilesInSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): ProjectFile[] {\n // Group path is expected to be set, therefore typing is non-nullable.\n // As the group is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!group.obj.path) {\n debug(`Group path not found for group: ${group.id}`);\n return [];\n }\n\n // Resolve the path of the synchronized root group\n const absoluteGroupPath =\n this.resolveAbsolutePathOfSynchronizedRootGroup(group);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of synchronized root group: ${group.id}`);\n return [];\n }\n\n // Build a list of all exception paths for the group\n const exceptionSets = this.getExceptionSetsForGroup(group);\n\n // Resolve a list of all files in the group\n const files = this.getAbsoluteFilePathsInDirectoryTree(absoluteGroupPath);\n\n // Filter out files that are excluded by the exception sets\n const filteredFiles = this.filterFilesByExceptionSets(files, exceptionSets);\n\n return filteredFiles;\n }\n\n /**\n * Returns all files in a directory tree.\n *\n * @param dirPath - The path of the directory to get the files in\n * @returns All files in the directory tree, or an empty array if the directory does not exist\n */\n private getAbsoluteFilePathsInDirectoryTree(dirPath: string): ProjectFile[] {\n // If the directory does not exist, return an empty array\n // This can happen if the group is not found in the project\n if (!fs.existsSync(dirPath)) {\n return [];\n }\n const result: ProjectFile[] = [];\n const files = fs.readdirSync(dirPath);\n for (const file of files) {\n // Ignore hidden files and directories\n if (file.startsWith('.')) {\n continue;\n }\n\n const filePath = path.join(dirPath, file);\n // If the file is a directory, recursively get the files in the directory\n if (fs.statSync(filePath).isDirectory()) {\n result.push(...this.getAbsoluteFilePathsInDirectoryTree(filePath));\n continue;\n }\n // If the file is a file, add it to the result\n if (fs.statSync(filePath).isFile()) {\n result.push({\n name: file,\n path: filePath,\n });\n continue;\n }\n }\n\n return result;\n }\n\n private filterFilesByExceptionSets(\n files: ProjectFile[],\n exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[],\n ): ProjectFile[] {\n // Iterate over all files and filter out files that are excluded by any exception sets\n return files.filter((file) => {\n return !exceptionSets.some((exceptionSet) => {\n const membershipExceptions =\n exceptionSet.obj.membershipExceptions ?? [];\n return membershipExceptions.some((path) => {\n const unescapedPath = path.replace(/\"/g, '');\n return file.path.includes(unescapedPath);\n });\n });\n });\n }\n\n // ================================ GROUP HELPERS ================================\n\n /**\n * Returns all groups that are PBXGroup.\n *\n * This is a helper method to avoid having to map and filter the groups manually.\n *\n * @returns All groups that are PBXGroup, excluding comments and non-object values.\n */\n private get groups(): XcodeProjectObjectWithId<PBXGroup>[] {\n // Map and filter the groups to only include the groups that are PBXGroup\n return Object.entries(this.objects.PBXGroup ?? {}).reduce(\n (acc, [key, group]) => {\n if (typeof group !== 'object') {\n return acc;\n }\n return acc.concat([\n {\n id: key,\n obj: group,\n },\n ]);\n },\n new Array<XcodeProjectObjectWithId<PBXGroup>>(),\n );\n }\n\n /**\n * Finds the parent group of a child group or file reference.\n *\n * @param childId - The ID of the child group or file reference\n * @returns The parent group of the child group or file reference, or undefined if the child group or file reference is not found or has no parent group\n */\n private findParentGroupByChildId(\n childId: string,\n ): XcodeProjectObjectWithId<PBXGroup> | undefined {\n return this.groups.find((group) => {\n return (group.obj.children ?? []).some((child) => {\n return child.value === childId;\n });\n });\n }\n\n /**\n * Checks if a group is the main group of any project.\n *\n * @param groupId - The ID of the group to check\n * @returns True if the group is the main group, false otherwise\n */\n private isMainGroup(groupId: string): boolean {\n return Object.values(this.objects.PBXProject ?? {}).some((project) => {\n if (typeof project !== 'object') {\n return false;\n }\n return project.mainGroup === groupId;\n });\n }\n\n private getExceptionSetsForGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] {\n const exceptions = group.obj.exceptions ?? [];\n const exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] =\n [];\n for (const exception of exceptions) {\n const exceptionSet =\n this.objects.PBXFileSystemSynchronizedBuildFileExceptionSet?.[\n exception.value\n ];\n if (typeof exceptionSet !== 'object') {\n continue;\n }\n exceptionSets.push({\n id: exception.value,\n obj: exceptionSet,\n comment: exception.comment,\n });\n }\n return exceptionSets;\n }\n\n /**\n * The path to the build products directory for the project.\n *\n * This is cached to avoid having to read the build settings from Xcode for each call to `getBuildProductsDirectoryPath`.\n */\n private buildProductsDir: string | undefined;\n\n /**\n * Returns the path to the build products directory for the project.\n *\n * @returns The path to the build products directory for the project, or undefined if the path is not found\n */\n private getBuildProductsDirectoryPath(): string | undefined {\n if (this.buildProductsDir) {\n return this.buildProductsDir;\n }\n const buildSettings = MacOSSystemHelpers.readXcodeBuildSettings(\n this.xcodeprojPath,\n );\n if (!buildSettings) {\n debug(`Failed to read Xcode build settings`);\n return undefined;\n }\n this.buildProductsDir =\n buildSettings['TARGET_BUILD_DIR'] ?? buildSettings['BUILD_DIR'];\n\n return this.buildProductsDir;\n }\n}\n"]}
1
+ {"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xc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,CAAC,OAAO,CAAC,8CAA8C,EAAE,CAC3D,SAAS,CAAC,KAAK,CAChB,CAAC;YACJ,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;gBACpC,SAAS;aACV;YACD,aAAa,CAAC,IAAI,CAAC;gBACjB,EAAE,EAAE,SAAS,CAAC,KAAK;gBACnB,GAAG,EAAE,YAAY;gBACjB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC;SACJ;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAqB;IAE7C;;;;OAIG;IACK,6BAA6B;QACnC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC;SAC9B;QACD,MAAM,aAAa,GAAG,wCAAkB,CAAC,sBAAsB,CAC7D,IAAI,CAAC,aAAa,CACnB,CAAC;QACF,IAAI,CAAC,aAAa,EAAE;YAClB,IAAA,aAAK,EAAC,qCAAqC,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,gBAAgB;YACnB,aAAa,CAAC,kBAAkB,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AA/rCD,oCA+rCC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { debug } from '../utils/debug';\nimport type { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\n\nimport {\n project as createXcodeProject,\n PBXFileReference,\n PBXFileSystemSynchronizedBuildFileExceptionSet,\n PBXSourcesBuildPhase,\n type PBXBuildFile,\n type PBXFileSystemSynchronizedRootGroup,\n type PBXGroup,\n type PBXNativeTarget,\n type PBXObjects,\n type PBXShellScriptBuildPhase,\n type Project,\n type XCConfigurationList,\n} from 'xcode';\nimport { MacOSSystemHelpers } from './macos-system-helper';\nimport { XcodeProjectObjectWithId } from './xcode-project-object-with-id';\n\ninterface ProjectFile {\n key?: string;\n name: string;\n path: string;\n}\n\nfunction setDebugInformationFormatAndSandbox(\n proj: Project,\n targetName: string,\n): void {\n const xcObjects = proj.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as\n | PBXNativeTarget\n | undefined;\n\n if (!xcObjects.XCBuildConfiguration) {\n xcObjects.XCBuildConfiguration = {};\n }\n if (!xcObjects.XCConfigurationList) {\n xcObjects.XCConfigurationList = {};\n }\n const buildConfigurationListId = target?.buildConfigurationList ?? '';\n const configurationList = xcObjects.XCConfigurationList?.[\n buildConfigurationListId\n ] as XCConfigurationList | undefined;\n const buildListConfigurationIds =\n configurationList?.buildConfigurations ?? [];\n for (const buildListConfigId of buildListConfigurationIds) {\n const config =\n xcObjects.XCBuildConfiguration[buildListConfigId.value] ?? {};\n if (typeof config === 'string') {\n // Ignore comments\n continue;\n }\n\n const buildSettings = config.buildSettings ?? {};\n buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n buildSettings.ENABLE_USER_SCRIPT_SANDBOXING = '\"NO\"';\n\n config.buildSettings = buildSettings;\n xcObjects.XCBuildConfiguration[buildListConfigId.value] = config;\n }\n}\n\nfunction addSentrySPM(proj: Project, targetName: string): void {\n const xcObjects = proj.hash.project.objects;\n\n const sentryFrameworkUUID = proj.generateUuid();\n const sentrySPMUUID = proj.generateUuid();\n\n // Check whether xcObjects already have sentry framework\n if (xcObjects.PBXFrameworksBuildPhase) {\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n const frameworkBuildPhase = xcObjects.PBXFrameworksBuildPhase[key];\n if (key.endsWith('_comment') || typeof frameworkBuildPhase === 'string') {\n // Ignore comments\n continue;\n }\n for (const framework of frameworkBuildPhase.files ?? []) {\n // We identify the Sentry framework by the comment \"Sentry in Frameworks\",\n // which is set by this manager in previous runs.\n if (framework.comment === 'Sentry in Frameworks') {\n return;\n }\n }\n }\n }\n\n if (!xcObjects.PBXBuildFile) {\n xcObjects.PBXBuildFile = {};\n }\n xcObjects.PBXBuildFile[sentryFrameworkUUID] = {\n isa: 'PBXBuildFile',\n productRef: sentrySPMUUID,\n productRef_comment: 'Sentry',\n };\n xcObjects.PBXBuildFile[`${sentryFrameworkUUID}_comment`] =\n 'Sentry in Frameworks';\n\n if (!xcObjects.PBXFrameworksBuildPhase) {\n xcObjects.PBXFrameworksBuildPhase = {};\n }\n for (const key in xcObjects.PBXFrameworksBuildPhase) {\n const value = xcObjects.PBXFrameworksBuildPhase[key];\n if (key.endsWith('_comment') || typeof value === 'string') {\n // Ignore comments\n continue;\n }\n\n const frameworks = value.files ?? [];\n frameworks.push({\n value: sentryFrameworkUUID,\n comment: 'Sentry in Frameworks',\n });\n value.files = frameworks;\n\n xcObjects.PBXFrameworksBuildPhase[key] = value;\n }\n\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as PBXNativeTarget;\n\n if (!target.packageProductDependencies) {\n target.packageProductDependencies = [];\n }\n target.packageProductDependencies.push({\n value: sentrySPMUUID,\n comment: 'Sentry',\n });\n\n const sentrySwiftPackageUUID = proj.generateUuid();\n const xcProject = proj.getFirstProject().firstProject;\n if (!xcProject.packageReferences) {\n xcProject.packageReferences = [];\n }\n xcProject.packageReferences.push({\n value: sentrySwiftPackageUUID,\n comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n });\n\n if (!xcObjects.XCRemoteSwiftPackageReference) {\n xcObjects.XCRemoteSwiftPackageReference = {};\n }\n\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: '\"https://github.com/getsentry/sentry-cocoa/\"',\n requirement: {\n kind: 'upToNextMajorVersion',\n minimumVersion: '8.0.0',\n },\n };\n xcObjects.XCRemoteSwiftPackageReference[`${sentrySwiftPackageUUID}_comment`] =\n 'XCRemoteSwiftPackageReference \"sentry-cocoa\"';\n\n if (!xcObjects.XCSwiftPackageProductDependency) {\n xcObjects.XCSwiftPackageProductDependency = {};\n }\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {\n isa: 'XCSwiftPackageProductDependency',\n package: sentrySwiftPackageUUID,\n package_comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n productName: 'Sentry',\n };\n xcObjects.XCSwiftPackageProductDependency[`${sentrySPMUUID}_comment`] =\n 'Sentry';\n\n clack.log.step('Added Sentry SPM dependency to your project');\n}\n\nexport class XcodeProject {\n /**\n * The directory where the Xcode project is located.\n */\n baseDir: string;\n\n /**\n * The path to the `<PROJECT>.xcodeproj` directory.\n */\n xcodeprojPath: string;\n\n /**\n * The path to the `project.pbxproj` file.\n */\n pbxprojPath: string;\n\n /**\n * The Xcode project object.\n */\n project: Project;\n\n objects: PBXObjects;\n\n /**\n * Creates a new XcodeProject instance, a wrapper around the Xcode project file `<PROJECT>.xcodeproj/project.pbxproj`.\n *\n * @param projectPath - The path to the Xcode project file\n */\n public constructor(projectPath: string) {\n this.pbxprojPath = projectPath;\n this.xcodeprojPath = path.dirname(projectPath);\n this.baseDir = path.dirname(this.xcodeprojPath);\n\n this.project = createXcodeProject(projectPath);\n this.project.parseSync();\n this.objects = this.project.hash.project.objects;\n }\n\n public getAllTargets(): string[] {\n const targets = this.objects.PBXNativeTarget ?? {};\n return Object.keys(targets)\n .filter((key) => {\n const value = targets[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value.productType.startsWith('\"com.apple.product-type.application')\n );\n })\n .map((key) => {\n return (targets[key] as PBXNativeTarget).name;\n });\n }\n\n public updateXcodeProject(\n sentryProject: SentryProjectData,\n target: string,\n addSPMReference: boolean,\n uploadSource = true,\n ): void {\n this.addUploadSymbolsScript({\n sentryProject,\n targetName: target,\n uploadSource,\n });\n if (uploadSource) {\n setDebugInformationFormatAndSandbox(this.project, target);\n }\n if (addSPMReference) {\n addSentrySPM(this.project, target);\n }\n const newContent = this.project.writeSync();\n fs.writeFileSync(this.pbxprojPath, newContent);\n }\n\n addUploadSymbolsScript({\n sentryProject,\n targetName,\n uploadSource,\n }: {\n sentryProject: SentryProjectData;\n targetName: string;\n uploadSource: boolean;\n }): void {\n const xcObjects = this.project.hash.project.objects;\n if (!xcObjects.PBXNativeTarget) {\n xcObjects.PBXNativeTarget = {};\n }\n const targetKey = Object.keys(xcObjects.PBXNativeTarget).filter((key) => {\n const value = xcObjects.PBXNativeTarget?.[key];\n return (\n !key.endsWith('_comment') &&\n typeof value !== 'string' &&\n value?.name === targetName\n );\n })[0];\n const target = xcObjects.PBXNativeTarget[targetKey] as PBXNativeTarget;\n if (!target) {\n debug(`Target not found: ${targetName}`);\n return;\n }\n\n // Generate the new script content\n const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');\n const shellScript = templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n uploadSource,\n isHomebrewInstalled,\n );\n\n if (!xcObjects.PBXShellScriptBuildPhase) {\n xcObjects.PBXShellScriptBuildPhase = {};\n }\n\n // Look for existing Sentry build phase in the current target\n let existingSentryBuildPhaseId: string | undefined;\n let existingSentryBuildPhase: PBXShellScriptBuildPhase | undefined;\n\n // Check target's build phases for existing Sentry script by searching for a build phase that contains \"sentry-cli\" in the shell script\n if (target.buildPhases) {\n for (const phase of target.buildPhases) {\n const buildPhase = xcObjects.PBXShellScriptBuildPhase[phase.value];\n if (\n typeof buildPhase === 'object' &&\n buildPhase.shellScript?.includes('sentry-cli')\n ) {\n existingSentryBuildPhaseId = phase.value;\n existingSentryBuildPhase = buildPhase;\n break;\n }\n }\n }\n\n // Clean up orphaned build phase references that may exist from previous runs\n // Find all build phase IDs that are referenced in targets but don't exist in PBXShellScriptBuildPhase\n const orphanedBuildPhaseIds: string[] = [];\n for (const targetKey in xcObjects.PBXNativeTarget) {\n const targetValue = xcObjects.PBXNativeTarget[targetKey];\n if (typeof targetValue === 'object' && targetValue.buildPhases) {\n for (const phase of targetValue.buildPhases) {\n // Check if this is a shell script build phase that doesn't exist\n if (\n !xcObjects.PBXShellScriptBuildPhase?.[phase.value] &&\n phase.comment?.includes('Upload Debug Symbols to Sentry')\n ) {\n orphanedBuildPhaseIds.push(phase.value);\n }\n }\n }\n }\n\n // Remove orphaned build phase references from all targets\n if (orphanedBuildPhaseIds.length > 0) {\n for (const targetKey in xcObjects.PBXNativeTarget) {\n const targetValue = xcObjects.PBXNativeTarget[targetKey];\n if (typeof targetValue === 'object' && targetValue.buildPhases) {\n targetValue.buildPhases = targetValue.buildPhases.filter((phase) => {\n return !orphanedBuildPhaseIds.includes(phase.value);\n });\n }\n }\n }\n\n if (existingSentryBuildPhaseId && existingSentryBuildPhase) {\n // Update existing build phase instead of adding a new one\n // This call is idempotent, so it will not add a new build phase if it already exists\n this.updateScriptBuildPhase(existingSentryBuildPhaseId, shellScript, [\n templates.scriptInputPath,\n ]);\n clack.log.step(\n `Updated existing Sentry upload script for \"${targetName}\" build phase`,\n );\n } else {\n // Add new build phase to the target\n this.addScriptBuildPhase(\n targetKey,\n 'Upload Debug Symbols to Sentry',\n shellScript,\n [templates.scriptInputPath],\n );\n clack.log.step(\n `Added Sentry upload script to \"${targetName}\" build phase`,\n );\n }\n }\n\n /**\n * Retrieves all source files associated with a specific target in the Xcode project.\n * This is used to find files where we can inject Sentry initialization code.\n *\n * @param targetName - The name of the target to get files for\n * @returns An array of absolute file paths for the target's source files, or undefined if target not found\n */\n public getSourceFilesForTarget(targetName: string): string[] | undefined {\n // ## Summary how Xcode Projects are structured:\n // - Every Xcode Project has exactly one main group of type `PBXGroup`\n // - The main group contains a list of children identifiers\n // - Each child can be a `PBXGroup`, a `PBXFileReference` or a `PBXFileSystemSynchronizedRootGroup`\n // - Each `PBXGroup` has a list of children identifiers which again can be `PBXGroup`, `PBXFileReference` or `PBXFileSystemSynchronizedRootGroup`\n // - The target defines the list of `fileSystemSynchronizedGroups` which are `PBXFileSystemSynchronizedRootGroup` to be included in the build phase\n // - The `PBXFileSystemSynchronizedRootGroup` has a list of `exceptions` which are `PBXFileSystemSynchronizedBuildFileExceptionSet`\n // - Each `PBXFileSystemSynchronizedBuildFileExceptionSet` represents a folder to be excluded from the build.\n // - The `PBXFileSystemSynchronizedBuildFileExceptionSet` has a list of `membershipExceptions` which are files to be excluded from being excluded, therefore included in the build.\n // - The Xcode project has a build phase `PBXSourcesBuildPhase` which has a list of `files` which are `PBXBuildFile`\n // - A file which is not part of a `PBXFileSystemSynchronizedRootGroup` must be added to the `files` list of the `PBXSourcesBuildPhase` build phase\n // - Nested subfolders in `fileSystemSynchronizedGroups` are not declared but recursively included\n //\n // Based on the findings above the files included in the build phase are:\n // - All files in the `files` of the `PBXSourcesBuildPhase` build phase `Sources` of the target\n // - All files in directories of the `fileSystemSynchronizedGroups` of the target\n // - Excluding all files in the `exceptions` of the `PBXFileSystemSynchronizedRootGroup` of the target\n // - Including all files in the `membershipExceptions` of the `PBXFileSystemSynchronizedBuildFileExceptionSet` of the target\n const nativeTarget = this.findNativeTargetByName(targetName);\n if (!nativeTarget) {\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n const filesInBuildPhase = this.findFilesInSourceBuildPhase(nativeTarget);\n debug(\n `Found ${filesInBuildPhase.length} files in build phase for target: ${targetName}`,\n );\n\n const filesInSynchronizedRootGroups =\n this.findFilesInSynchronizedRootGroups(nativeTarget);\n debug(\n `Found ${filesInSynchronizedRootGroups.length} files in synchronized root groups for target: ${targetName}`,\n );\n return [...filesInBuildPhase, ...filesInSynchronizedRootGroups];\n }\n\n // ================================ TARGET HELPERS ================================\n\n /**\n * Finds a native target by name.\n *\n * @param targetName - The name of the target to find\n * @returns The native target, or undefined if the target is not found\n */\n private findNativeTargetByName(\n targetName: string,\n ): XcodeProjectObjectWithId<PBXNativeTarget> | undefined {\n debug('Finding native target by name: ' + targetName);\n\n if (!this.objects.PBXNativeTarget) {\n debug('No native targets found');\n return undefined;\n }\n\n const nativeTargets = Object.entries(this.objects.PBXNativeTarget);\n for (const [key, target] of nativeTargets) {\n // Ignore comments\n if (key.endsWith('_comment') || typeof target === 'string') {\n continue;\n }\n\n // Ignore targets that are not the target we are looking for\n if (target.name !== targetName) {\n continue;\n }\n debug('Found native target: ' + targetName);\n return {\n id: key,\n obj: target,\n };\n }\n\n debug('Target not found: ' + targetName);\n return undefined;\n }\n\n // ================================ BUILD PHASE HELPERS ================================\n\n /**\n * Finds the source build phase in a target.\n *\n * @param target - The target to find the source build phase in\n * @returns The source build phase, or undefined if the target is not found or has no source build phase\n */\n findSourceBuildPhaseInTarget(\n target: PBXNativeTarget,\n ): XcodeProjectObjectWithId<PBXSourcesBuildPhase> | undefined {\n debug(`Finding source build phase in target: ${target.name}`);\n if (!target.buildPhases) {\n debug('No build phases found for target: ' + target.name);\n return undefined;\n }\n for (const phase of target.buildPhases) {\n const buildPhaseId = phase.value;\n const buildPhase = this.objects.PBXSourcesBuildPhase?.[buildPhaseId];\n if (typeof buildPhase !== 'object') {\n // Ignore comments\n continue;\n }\n debug(\n `Found source build phase: ${buildPhaseId} for target: ${target.name}`,\n );\n return {\n id: buildPhaseId,\n obj: buildPhase,\n };\n }\n\n debug(`No source build phase found for target: ${target.name}`);\n return undefined;\n }\n\n /**\n * Adds a new script build phase to the specified target.\n *\n * @param targetKey - The key of the target to add the build phase to\n * @param name - The name of the build phase\n * @param script - The shell script content\n * @param inputPaths - Array of input paths for the script\n * @returns The UUID of the created build phase\n */\n addScriptBuildPhase(\n targetKey: string,\n name: string,\n script: string,\n inputPaths: string[] = [],\n ): string {\n const buildPhaseUuid = this.project.generateUuid();\n const escapedScript = script.replace(/\"/g, '\\\\\"');\n\n // Create the shell script build phase object\n const buildPhase = {\n isa: 'PBXShellScriptBuildPhase' as const,\n buildActionMask: 2147483647,\n files: [],\n inputPaths,\n outputPaths: [],\n runOnlyForDeploymentPostprocessing: 0,\n shellPath: '/bin/sh',\n shellScript: `\"${escapedScript}\"`,\n name: `\"${name}\"`,\n };\n\n // Add to PBXShellScriptBuildPhase section\n if (!this.objects.PBXShellScriptBuildPhase) {\n this.objects.PBXShellScriptBuildPhase = {};\n }\n this.objects.PBXShellScriptBuildPhase[buildPhaseUuid] = buildPhase;\n this.objects.PBXShellScriptBuildPhase[`${buildPhaseUuid}_comment`] = name;\n\n // Add to target's build phases\n const target = this.objects.PBXNativeTarget?.[targetKey] as PBXNativeTarget;\n if (target?.buildPhases) {\n target.buildPhases.push({\n value: buildPhaseUuid,\n comment: name,\n });\n }\n\n return buildPhaseUuid;\n }\n\n /**\n * Updates an existing script build phase.\n *\n * @param buildPhaseId - The UUID of the build phase to update\n * @param script - The new shell script content\n * @param inputPaths - Array of input paths for the script\n */\n updateScriptBuildPhase(\n buildPhaseId: string,\n script: string,\n inputPaths: string[] = [],\n ): void {\n const buildPhase = this.objects.PBXShellScriptBuildPhase?.[buildPhaseId];\n if (!buildPhase || typeof buildPhase === 'string') {\n debug(`Build phase not found: ${buildPhaseId}`);\n return;\n }\n\n const escapedScript = script.replace(/\"/g, '\\\\\"');\n buildPhase.shellScript = `\"${escapedScript}\"`;\n buildPhase.inputPaths = inputPaths;\n buildPhase.shellPath = '/bin/sh';\n }\n\n // ================================ FILE HELPERS ================================\n\n /**\n * Finds all files in the source build phase of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the source build phase of the target, or an empty array if the target is not found or has no source build phase\n */\n findFilesInSourceBuildPhase(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n 'Finding files in source build phase for target: ' +\n nativeTarget.obj.name,\n );\n const buildPhase = this.findSourceBuildPhaseInTarget(nativeTarget.obj);\n if (!buildPhase) {\n debug(\n `Sources build phase not found for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n const buildPhaseFiles = buildPhase.obj.files;\n if (!buildPhaseFiles) {\n debug(\n `No files found in sources build phase for target: ${nativeTarget.obj.name}`,\n );\n return [];\n }\n if (!this.objects.PBXBuildFile) {\n debug('PBXBuildFile is undefined');\n return [];\n }\n if (!this.objects.PBXFileReference) {\n debug('PBXFileReference is undefined');\n return [];\n }\n\n const result: string[] = [];\n for (const file of buildPhaseFiles) {\n debug(`Resolving build phase file: ${file.value}`);\n // Find the related build file object\n const buildFileObj = this.objects.PBXBuildFile[\n file.value\n ] as PBXBuildFile;\n if (!buildFileObj || typeof buildFileObj !== 'object') {\n debug(`Build file object not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file object found for file: ${file.value}`);\n\n const buildFileRefId = buildFileObj.fileRef;\n if (!buildFileRefId) {\n debug(`File reference not found for file: ${file.value}`);\n continue;\n }\n debug(`Build file reference found for file: ${file.value}`);\n\n // Find the related file reference object\n const buildFile = this.objects.PBXFileReference[buildFileRefId];\n if (!buildFile || typeof buildFile !== 'object') {\n debug(`File not found in file dictionary for file: ${file.value}`);\n continue;\n }\n debug(`Build file found in file dictionary for file: ${file.value}`);\n\n // Resolve the path of the file based on the `sourceTree` property\n const resolvedFilePath = this.resolveAbsolutePathOfFileReference({\n id: buildFileRefId,\n obj: buildFile,\n });\n if (!resolvedFilePath) {\n debug(`Failed to resolve file path for file: ${file.value}`);\n continue;\n }\n debug(`Resolved file ${file.value} to path: ${resolvedFilePath}`);\n\n result.push(resolvedFilePath);\n }\n\n debug(\n `Resolved ${result.length} files for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n /**\n * Resolves the absolute path of a file reference.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsolutePathOfFileReference(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving path of file reference: ${fileRef.id} with path: ${fileRef.obj.path}`,\n );\n // File path is expected to be set, therefore typing is non-nullable.\n // As the file is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!fileRef.obj.path) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // File references are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<absolute>': The file path is absolute\n // - '<group>': The file path is relative to the parent group of the file reference\n // - 'BUILT_PRODUCTS_DIR': The file path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SOURCE_ROOT': The file path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'SDKROOT': The file path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The file path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const fileRefSourceTree = fileRef.obj.sourceTree?.replace(/\"/g, '') ?? '';\n switch (fileRefSourceTree) {\n case '<absolute>':\n return fileRef.obj.path.replace(/\"/g, '');\n case '<group>':\n return this.resolveAbsoluteFilePathRelativeToGroup(fileRef);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolveAbsoluteFilePathRelativeToBuiltProductsDir(fileRef);\n case 'SOURCE_ROOT':\n return this.resolveAbsoluteFilePathRelativeToSourceRoot(fileRef);\n case 'SDKROOT':\n return this.resolveAbsoluteFilePathRelativeToSdkRoot(fileRef);\n case 'DEVELOPER_DIR':\n return this.resolveAbsoluteFilePathRelativeToDeveloperDir(fileRef);\n default:\n debug(\n `Unknown source tree '${fileRef.obj.sourceTree}' for build file: ${fileRef.obj.path}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the parent group.\n *\n * @param fileRef - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToGroup(\n fileRef: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to group for file reference: ${\n fileRef.id\n } with path: ${fileRef.obj.path ?? ''}`,\n );\n const fileRefPath = fileRef.obj.path?.replace(/\"/g, '');\n if (!fileRefPath) {\n debug(`File reference path not found for file reference: ${fileRef.id}`);\n return undefined;\n }\n\n // Find the parent group of the file reference by searching for the reverse relationship\n const parentGroup = this.findParentGroupByChildId(fileRef.id);\n if (!parentGroup) {\n debug(\n `Parent group not found for file reference: ${fileRef.id} at path: ${fileRefPath}`,\n );\n return undefined;\n }\n\n // Resolve the path of the parent group\n const absoluteGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of group: ${parentGroup.id}`);\n return undefined;\n }\n\n return path.join(absoluteGroupPath, fileRefPath);\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the built products directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToBuiltProductsDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to built products directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSourceRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n return path.join(this.baseDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the SDK root.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToSdkRoot(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to SDK root for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a file reference relative to the developer directory.\n *\n * @param buildFile - The file reference to resolve the path of\n * @returns The absolute path of the file reference, or undefined if the file reference is not found or has no path\n */\n private resolveAbsoluteFilePathRelativeToDeveloperDir(\n buildFile: XcodeProjectObjectWithId<PBXFileReference>,\n ): string | undefined {\n debug(\n `Resolving absolute file path relative to developer directory for file reference: ${\n buildFile.id\n } with path: ${buildFile.obj.path ?? ''}`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, buildFile.obj.path.replace(/\"/g, ''));\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} with path: ${group.obj.path ?? ''}`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfGroupRelativeToSourceRoot(group);\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfGroupRelativeToBuiltProductsDir(group);\n case 'SDKROOT':\n return this.resolvePathOfGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfGroupRelativeToDeveloperDir(group);\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXGroup>,\n ): string | undefined {\n debug(\n `Resolving path of group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the absolute path of a group.\n *\n * @param group - The group to resolve the path of\n * @returns The absolute path of the group, or undefined if the group is not found or has no path\n */\n private resolveAbsolutePathOfSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} with path: ${\n group.obj.path ?? ''\n }`,\n );\n\n // Group paths are resolved based on the `sourceTree` property\n // which can have one of the following values:\n // - '<group>': The group path is relative to the parent group of the group\n // - 'SOURCE_ROOT': The group path is relative to the source root, i.e. the directory where the Xcode project is located\n // - 'BUILT_PRODUCTS_DIR': The group path is relative to the built products directory, i.e. the build output directory in derived data\n // - 'SDKROOT': The group path is relative to the SDK root, i.e. the directory where the SDK is installed\n // - 'DEVELOPER_DIR': The group path is relative to the developer directory, i.e. the directory where the Xcode command line tools are installed\n\n // The default is '<group>'\n const groupSourceTree =\n group.obj.sourceTree?.replace(/\"/g, '') ?? '<group>';\n\n switch (groupSourceTree) {\n case '<group>':\n return this.resolvePathOfSynchronizedRootGroupRelativeToGroup(group);\n case 'SOURCE_ROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group,\n );\n case 'BUILT_PRODUCTS_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group,\n );\n case 'SDKROOT':\n return this.resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(group);\n case 'DEVELOPER_DIR':\n return this.resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group,\n );\n default:\n debug(\n `Unknown source tree '${groupSourceTree}' for group: ${group.id}`,\n );\n return undefined;\n }\n }\n\n /**\n * Resolves the path of a group relative to the parent group.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the parent group, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const parentGroup = this.findParentGroupByChildId(group.id);\n\n if (!parentGroup) {\n debug(`Parent group not found for group: ${group.id}`);\n // If the parent group is not found, check if the group is the main group\n // We assume the main group is at the root of the project\n if (this.isMainGroup(group.id)) {\n return this.baseDir;\n }\n return undefined;\n }\n\n const parentGroupPath = this.resolveAbsolutePathOfGroup(parentGroup);\n if (!parentGroupPath) {\n debug(`Failed to resolve path of parent group: ${parentGroup.id}`);\n return undefined;\n }\n\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return undefined;\n }\n\n return path.join(parentGroupPath, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the source root.\n *\n * The source root is the directory where the `.xcodeproj` file is located.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the source root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSourceRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n const groupPath = group.obj.path?.replace(/\"/g, '') ?? '';\n if (!groupPath) {\n debug(`Group path not found for group: ${group.id}`);\n return this.baseDir;\n }\n return path.join(this.baseDir, groupPath);\n }\n\n /**\n * Resolves the path of a group relative to the built products directory.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the built products directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToBuiltProductsDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to built products directory`,\n );\n const builtProductsDir = this.getBuildProductsDirectoryPath();\n if (!builtProductsDir) {\n debug(`Failed to resolve built products directory path`);\n return undefined;\n }\n\n return path.join(builtProductsDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the SDK root.\n *\n * The SDK root is the directory where the SDK is installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the SDK root, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToSdkRoot(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(`Resolving path of group: ${group.id} relative to SDK root`);\n const sdkRoot = MacOSSystemHelpers.findSDKRootDirectoryPath();\n if (!sdkRoot) {\n debug(`Failed to resolve SDK root directory path`);\n return undefined;\n }\n\n return path.join(sdkRoot, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Resolves the path of a group relative to the developer directory.\n *\n * The developer directory is the directory where the Xcode command line tools are installed.\n *\n * @param group - The group to resolve the path of\n * @returns The path of the group relative to the developer directory, or undefined if the group is not found or has no path\n */\n private resolvePathOfSynchronizedRootGroupRelativeToDeveloperDir(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): string | undefined {\n debug(\n `Resolving path of synchronized root group: ${group.id} relative to developer directory`,\n );\n const developerDir = MacOSSystemHelpers.findDeveloperDirectoryPath();\n if (!developerDir) {\n debug(`Failed to resolve developer directory path`);\n return undefined;\n }\n\n return path.join(developerDir, group.obj.path?.replace(/\"/g, '') ?? '');\n }\n\n /**\n * Finds all files in the synchronized root groups of a target.\n *\n * @param nativeTarget - The target to find the files in\n * @returns The files in the synchronized root groups of the target, or an empty array if the target is not found or has no synchronized root groups\n */\n findFilesInSynchronizedRootGroups(\n nativeTarget: XcodeProjectObjectWithId<PBXNativeTarget>,\n ): string[] {\n debug(\n `Finding files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n const synchronizedRootGroups =\n nativeTarget.obj.fileSystemSynchronizedGroups ?? [];\n\n const result: string[] = [];\n for (const group of synchronizedRootGroups) {\n const groupObj =\n this.objects.PBXFileSystemSynchronizedRootGroup?.[group.value];\n if (!groupObj || typeof groupObj !== 'object') {\n debug(`Synchronized root group not found: ${group.value}`);\n continue;\n }\n debug(`Found synchronized root group: ${group.value}`);\n\n const files = this.getFilesInSynchronizedRootGroup({\n id: group.value,\n obj: groupObj,\n });\n debug(\n `Found ${files.length} files in synchronized root group: ${group.value}`,\n );\n result.push(...files.map((file) => file.path));\n }\n debug(\n `Found ${result.length} files in synchronized root groups for target: ${nativeTarget.obj.name}`,\n );\n return result;\n }\n\n private getFilesInSynchronizedRootGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): ProjectFile[] {\n // Group path is expected to be set, therefore typing is non-nullable.\n // As the group is loaded from a project file, it is not guaranteed to be set,\n // therefore we treat it as optional.\n if (!group.obj.path) {\n debug(`Group path not found for group: ${group.id}`);\n return [];\n }\n\n // Resolve the path of the synchronized root group\n const absoluteGroupPath =\n this.resolveAbsolutePathOfSynchronizedRootGroup(group);\n if (!absoluteGroupPath) {\n debug(`Failed to resolve path of synchronized root group: ${group.id}`);\n return [];\n }\n\n // Build a list of all exception paths for the group\n const exceptionSets = this.getExceptionSetsForGroup(group);\n\n // Resolve a list of all files in the group\n const files = this.getAbsoluteFilePathsInDirectoryTree(absoluteGroupPath);\n\n // Filter out files that are excluded by the exception sets\n const filteredFiles = this.filterFilesByExceptionSets(files, exceptionSets);\n\n return filteredFiles;\n }\n\n /**\n * Returns all files in a directory tree.\n *\n * @param dirPath - The path of the directory to get the files in\n * @returns All files in the directory tree, or an empty array if the directory does not exist\n */\n private getAbsoluteFilePathsInDirectoryTree(dirPath: string): ProjectFile[] {\n // If the directory does not exist, return an empty array\n // This can happen if the group is not found in the project\n if (!fs.existsSync(dirPath)) {\n return [];\n }\n const result: ProjectFile[] = [];\n const files = fs.readdirSync(dirPath);\n for (const file of files) {\n // Ignore hidden files and directories\n if (file.startsWith('.')) {\n continue;\n }\n\n const filePath = path.join(dirPath, file);\n // If the file is a directory, recursively get the files in the directory\n if (fs.statSync(filePath).isDirectory()) {\n result.push(...this.getAbsoluteFilePathsInDirectoryTree(filePath));\n continue;\n }\n // If the file is a file, add it to the result\n if (fs.statSync(filePath).isFile()) {\n result.push({\n name: file,\n path: filePath,\n });\n continue;\n }\n }\n\n return result;\n }\n\n private filterFilesByExceptionSets(\n files: ProjectFile[],\n exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[],\n ): ProjectFile[] {\n // Iterate over all files and filter out files that are excluded by any exception sets\n return files.filter((file) => {\n return !exceptionSets.some((exceptionSet) => {\n const membershipExceptions =\n exceptionSet.obj.membershipExceptions ?? [];\n return membershipExceptions.some((path) => {\n const unescapedPath = path.replace(/\"/g, '');\n return file.path.includes(unescapedPath);\n });\n });\n });\n }\n\n // ================================ GROUP HELPERS ================================\n\n /**\n * Returns all groups that are PBXGroup.\n *\n * This is a helper method to avoid having to map and filter the groups manually.\n *\n * @returns All groups that are PBXGroup, excluding comments and non-object values.\n */\n private get groups(): XcodeProjectObjectWithId<PBXGroup>[] {\n // Map and filter the groups to only include the groups that are PBXGroup\n return Object.entries(this.objects.PBXGroup ?? {}).reduce(\n (acc, [key, group]) => {\n if (typeof group !== 'object') {\n return acc;\n }\n return acc.concat([\n {\n id: key,\n obj: group,\n },\n ]);\n },\n new Array<XcodeProjectObjectWithId<PBXGroup>>(),\n );\n }\n\n /**\n * Finds the parent group of a child group or file reference.\n *\n * @param childId - The ID of the child group or file reference\n * @returns The parent group of the child group or file reference, or undefined if the child group or file reference is not found or has no parent group\n */\n private findParentGroupByChildId(\n childId: string,\n ): XcodeProjectObjectWithId<PBXGroup> | undefined {\n return this.groups.find((group) => {\n return (group.obj.children ?? []).some((child) => {\n return child.value === childId;\n });\n });\n }\n\n /**\n * Checks if a group is the main group of any project.\n *\n * @param groupId - The ID of the group to check\n * @returns True if the group is the main group, false otherwise\n */\n private isMainGroup(groupId: string): boolean {\n return Object.values(this.objects.PBXProject ?? {}).some((project) => {\n if (typeof project !== 'object') {\n return false;\n }\n return project.mainGroup === groupId;\n });\n }\n\n private getExceptionSetsForGroup(\n group: XcodeProjectObjectWithId<PBXFileSystemSynchronizedRootGroup>,\n ): XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] {\n const exceptions = group.obj.exceptions ?? [];\n const exceptionSets: XcodeProjectObjectWithId<PBXFileSystemSynchronizedBuildFileExceptionSet>[] =\n [];\n for (const exception of exceptions) {\n const exceptionSet =\n this.objects.PBXFileSystemSynchronizedBuildFileExceptionSet?.[\n exception.value\n ];\n if (typeof exceptionSet !== 'object') {\n continue;\n }\n exceptionSets.push({\n id: exception.value,\n obj: exceptionSet,\n comment: exception.comment,\n });\n }\n return exceptionSets;\n }\n\n /**\n * The path to the build products directory for the project.\n *\n * This is cached to avoid having to read the build settings from Xcode for each call to `getBuildProductsDirectoryPath`.\n */\n private buildProductsDir: string | undefined;\n\n /**\n * Returns the path to the build products directory for the project.\n *\n * @returns The path to the build products directory for the project, or undefined if the path is not found\n */\n private getBuildProductsDirectoryPath(): string | undefined {\n if (this.buildProductsDir) {\n return this.buildProductsDir;\n }\n const buildSettings = MacOSSystemHelpers.readXcodeBuildSettings(\n this.xcodeprojPath,\n );\n if (!buildSettings) {\n debug(`Failed to read Xcode build settings`);\n return undefined;\n }\n this.buildProductsDir =\n buildSettings['TARGET_BUILD_DIR'] ?? buildSettings['BUILD_DIR'];\n\n return this.buildProductsDir;\n }\n}\n"]}
@@ -70,7 +70,7 @@ async function runNextjsWizardWithTelemetry(options) {
70
70
  const sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('@sentry/nextjs', packageJson);
71
71
  Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
72
72
  const { packageManager: packageManagerFromInstallStep } = await (0, clack_1.installPackage)({
73
- packageName: '@sentry/nextjs@latest',
73
+ packageName: '@sentry/nextjs@^9',
74
74
  packageNameDisplayLabel: '@sentry/nextjs',
75
75
  alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],
76
76
  forceInstall,
@@ -246,6 +246,11 @@ async function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl,
246
246
  prompt: `Do you want to enable ${chalk_1.default.bold('Session Replay')} to get a video-like reproduction of errors during a user session?`,
247
247
  enabledHint: 'recommended, but increases bundle size',
248
248
  },
249
+ {
250
+ id: 'logs',
251
+ prompt: `Do you want to enable ${chalk_1.default.bold('Logs')} to send your application logs to Sentry?`,
252
+ enabledHint: 'recommended',
253
+ },
249
254
  ]);
250
255
  const typeScriptDetected = (0, clack_1.isUsingTypeScript)();
251
256
  const configVariants = ['server', 'edge'];