Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ jobs:
--package-file Package@swift-6.1.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
./scripts/prepare-package.sh \
--package-file Package@swift-6.2.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
- run: ./scripts/ci-select-xcode.sh 16.4
- run: swift build
working-directory: Samples/macOS-SPM-CommandLine
Expand Down Expand Up @@ -198,6 +202,10 @@ jobs:
--package-file Package@swift-6.1.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
./scripts/prepare-package.sh \
--package-file Package@swift-6.2.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
- run: ./scripts/ci-select-xcode.sh 16.4
- run: swift build
working-directory: Samples/SPM-Dynamic
Expand Down Expand Up @@ -228,6 +236,10 @@ jobs:
--package-file Package@swift-6.1.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
./scripts/prepare-package.sh \
--package-file Package@swift-6.2.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
- run: ./scripts/ci-select-xcode.sh 16.4
- run: swift build --target SentrySwiftUI
- name: Run CI Diagnostics
Expand Down Expand Up @@ -257,6 +269,10 @@ jobs:
--package-file Package@swift-6.1.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
./scripts/prepare-package.sh \
--package-file Package@swift-6.2.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
- run: ./scripts/ci-select-xcode.sh 16.4
- run: set -o pipefail &&xcodebuild build -scheme visionOS-SPM -sdk xros -destination 'generic/platform=xros' | tee raw-build-output-spm-visionOS.log | xcbeautify
working-directory: Samples/visionOS-SPM
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,15 @@ jobs:
- name: Prepare Package.swift
shell: bash
run: |
# Swift 6.1+ uses Package@swift-6.1.swift; hide it so prepare-package's
# Swift 6.1+ and 6.2+ uses Package@swift-6.1.swift and Package@swift-6.2.swift; hide it so prepare-package's
# modified Package.swift is used (avoids "Multiple commands produce" from
# unmodified binary targets in the 6.1 manifest).
# unmodified binary targets in the 6.1 and 6.2 manifests).
if [[ -f Package@swift-6.1.swift ]]; then
mv Package@swift-6.1.swift Package@swift-6.1.swift.bak
fi
if [[ -f Package@swift-6.2.swift ]]; then
mv Package@swift-6.2.swift Package@swift-6.2.swift.bak
fi
./scripts/prepare-package.sh \
--package-file Package.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Added `Package@swift-6.2.swift` to avoid issues with unsafe build flags on SPM > 6.2 (#7778)

## 9.10.0

### Features
Expand Down
123 changes: 123 additions & 0 deletions Package@swift-6.2.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// swift-tools-version:6.2

#if canImport(Darwin)
import Darwin.C
#elseif canImport(Glibc)
import Glibc
#elseif canImport(MSVCRT)
import MSVCRT
#endif

import PackageDescription

var products: [Product] = [
.library(name: "Sentry", targets: ["Sentry", "SentryCppHelper"]),
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
.library(name: "Sentry-Dynamic-WithARM64e", targets: ["Sentry-Dynamic-WithARM64e"]),
.library(name: "Sentry-WithoutUIKitOrAppKit", targets: ["Sentry-WithoutUIKitOrAppKit", "SentryCppHelper"]),
.library(name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", targets: ["Sentry-WithoutUIKitOrAppKit-WithARM64e", "SentryCppHelper"]),
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"]),
.library(name: "SentryDistribution", targets: ["SentryDistribution"])
]

var targets: [Target] = [
.binaryTarget(
name: "Sentry",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.9.0/Sentry.xcframework.zip",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The new Package@swift-6.2.swift file is missing from the hardcoded list in the VersionBump script, which will prevent its binary target URLs from being updated during releases.
Severity: HIGH

Suggested Fix

Add Package@swift-6.2.swift to the files array in Utils/VersionBump/main.swift. Consider using a glob pattern to automatically discover Package@swift-*.swift files to prevent this issue in the future.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: Package@swift-6.2.swift#L26

Potential issue: The `VersionBump` utility, used during releases, relies on a hardcoded
list of files to update version numbers. The newly added `Package@swift-6.2.swift` is
not in this list. Consequently, when a new version is released, the binary target URLs
within this file will not be updated and will continue to point to the old `9.9.0`
binaries. While the checksum update script correctly discovers the file, it cannot fix
the stale URLs. This will cause Swift 6.2+ users to silently receive an outdated SDK
version, regardless of the version they specify in their package dependencies.

Did we get this right? 👍 / 👎 to inform future reviews.

checksum: "7b110592cbec1820007261a620730646a16288a888c67c96d7a1f773d36f7356" //Sentry-Static
),
.binaryTarget(
name: "Sentry-Dynamic",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.9.0/Sentry-Dynamic.xcframework.zip",
checksum: "d5a6b84be1f0b59438e5d6ca43a4c9df8c26b45f65ddf2d9bc6606a0ca23e293" //Sentry-Dynamic
),
.binaryTarget(
name: "Sentry-Dynamic-WithARM64e",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.9.0/Sentry-Dynamic-WithARM64e.xcframework.zip",
checksum: "38a6b411ef141b9e47daa54c6c0cfa64082dc0f8d527f76feb96479ee350563b" //Sentry-Dynamic-WithARM64e
),
.binaryTarget(
name: "Sentry-WithoutUIKitOrAppKit",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.9.0/Sentry-WithoutUIKitOrAppKit.xcframework.zip",
checksum: "d5b16962a8ef18573036fd11a8f0cc3b72abece31d516d9295d4bc699345ffd2" //Sentry-WithoutUIKitOrAppKit
),
.binaryTarget(
name: "Sentry-WithoutUIKitOrAppKit-WithARM64e",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/9.9.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip",
checksum: "d518893f3e2442e2c4b758199141c99e55b3903b009984ceab7f5842da4a96b2" //Sentry-WithoutUIKitOrAppKit-WithARM64e
),
.target(
name: "SentrySwiftUI",
dependencies: ["Sentry"],
path: "Sources/SentrySwiftUI",
exclude: ["module.modulemap"],
linkerSettings: [
.linkedFramework("Sentry")
]
),
.target(
name: "SentryCppHelper",
path: "Sources/SentryCppHelper",
linkerSettings: [
.linkedLibrary("c++")
]
),
.target(name: "SentryDistribution", path: "Sources/SentryDistribution"),
.testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests")
]

// Targets required to support compile-from-source builds via SPM.
products.append(.library(name: "SentrySPM", targets: ["SentryObjCInternal"]))
targets += [
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system
.target(
name: "SentryHeaders",
path: "Sources/Sentry",
sources: ["SentryDummyPublicEmptyClass.m"],
publicHeadersPath: "Public"
),
.target(
name: "_SentryPrivate",
dependencies: ["SentryHeaders"],
path: "Sources/Sentry",
sources: ["SentryDummyPrivateEmptyClass.m"],
publicHeadersPath: "include"),
.target(
name: "SentrySwift",
dependencies: ["_SentryPrivate", "SentryHeaders"],
path: "Sources/Swift",
swiftSettings: [
.unsafeFlags(["-enable-library-evolution"]),
.define("SENTRY_NO_UI_FRAMEWORK", .when(traits: ["NoUIFramework"]))
]),

// SentryObjCInternal compiles all ObjC/C sources from the repo. Named "Internal"
// to reserve "SentryObjC" for a future public Objective-C wrapper around the SDK.
.target(
name: "SentryObjCInternal",
dependencies: ["SentrySwift"],
path: "Sources",
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
cSettings: [
.headerSearchPath("Sentry"),
.headerSearchPath("SentryCrash/Recording"),
.headerSearchPath("SentryCrash/Recording/Monitors"),
.headerSearchPath("SentryCrash/Recording/Tools"),
.headerSearchPath("SentryCrash/Installations"),
.headerSearchPath("SentryCrash/Reporting/Filters"),
.headerSearchPath("SentryCrash/Reporting/Filters/Tools"),
.define("SENTRY_NO_UI_FRAMEWORK", to: "1", .when(traits: ["NoUIFramework"]))
])
]

let package = Package(
name: "Sentry",
platforms: [.iOS(.v15), .macOS(.v10_14), .tvOS(.v15), .watchOS(.v8), .visionOS(.v1)],
products: products,
traits: [
.init(name: "NoUIFramework", description: "Build without UIKit/AppKit framework linkage. Use for command-line tools or contexts where UI frameworks are unavailable.")
],
targets: targets,
swiftLanguageModes: [.v5],
cxxLanguageStandard: .cxx14
)
1 change: 1 addition & 0 deletions Utils/VersionBump/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let files = [
"./Sentry.podspec",
"./Package.swift",
"./Package@swift-6.1.swift",
"./Package@swift-6.2.swift",
"./SentrySwiftUI.podspec",
"./Sources/Sentry/SentryMeta.m",
"./3rd-party-integrations/SentrySwiftLog/Package.swift",
Expand Down
Loading