Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apple): Build script phase update #691

Merged
merged 6 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- fix(Apple): Sentry-cli not found by build phase when installed with homebrew (#691)

## 3.34.2

- fix(nextjs): Don't ask for package manager twice (#690)
Expand Down
6 changes: 5 additions & 1 deletion src/apple/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ export function getRunScriptTemplate(
orgSlug: string,
projectSlug: string,
uploadSource = true,
includeHomebrewPath = false,
): string {
// eslint-disable-next-line no-useless-escape
return `# This script is responsable to upload debug symbols and source context for Sentry.\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=${orgSlug}\\nexport SENTRY_PROJECT=${projectSlug}\\nERROR=$(sentry-cli debug-files upload ${
const includeHomebrew = includeHomebrewPath
? '\\nif [[ "$(uname -m)" == arm64 ]]; then\\nexport PATH="/opt/homebrew/bin:$PATH"\\nfi'
: '';
return `# This script is responsable to upload debug symbols and source context for Sentry.${includeHomebrew}\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=${orgSlug}\\nexport SENTRY_PROJECT=${projectSlug}\\nERROR=$(sentry-cli debug-files upload ${
uploadSource ? '--include-sources ' : ''
}"$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)\\nif [ ! $? -eq 0 ]; then\\necho "warning: sentry-cli - $ERROR"\\nfi\\nelse\\necho "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"\\nfi\\n`;
}
Expand Down
2 changes: 2 additions & 0 deletions src/apple/xcode-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function addUploadSymbolsScript(
}
}

const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');
xcodeProject.addBuildPhase(
[],
'PBXShellScriptBuildPhase',
Expand All @@ -178,6 +179,7 @@ function addUploadSymbolsScript(
sentryProject.organization.slug,
sentryProject.slug,
uploadSource,
isHomebrewInstalled,
),
},
);
Expand Down
Loading