Skip to content
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: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
- name: Only keep distribution lib and target in Package.swift
run: ./scripts/prepare-package.sh --only-keep-distribution true
run: ./scripts/prepare-package.sh --remove-binary-targets true

- run: ./scripts/ci-select-xcode.sh 16.4
- name: Setup Ruby
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
- name: Only keep distribution lib and target in Package.swift
run: ./scripts/prepare-package.sh --only-keep-distribution true
run: ./scripts/prepare-package.sh --remove-binary-targets true

- run: ./scripts/ci-select-xcode.sh 16.4
- run: make init-ci-build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ jobs:
--is-pr "${{ github.event_name == 'pull_request' }}" \
--change-path true
- run: ./scripts/ci-select-xcode.sh 16.4
- run: swift build
- run: swift build --target SentrySwiftUI
- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ jobs:
--package-file Package.swift \
--is-pr "${{ github.event_name == 'pull_request' }}" \
--remove-duplicate true \
--change-path false
--change-path false \
--remove-binary-targets true
- run: rm -r Sentry.xcodeproj && rm -r Sentry.xcworkspace
- run: set -o pipefail && NSUnbufferedIO=YES SKIP_BINARIES=1 xcodebuild test -scheme Sentry-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=18.4,name=iPhone 16 Pro' | tee raw-test-output-distribution.log | xcbeautify --preserve-unbeautified
shell: sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
# sample projects don't use SPM for including Sentry. Only the DistributionSample uses local SPM.
# Therefore, we only keep the local DistributionSample reference in the Package.swift as a workaround.
- name: Only keep distribution lib and target in Package.swift
run: ./scripts/prepare-package.sh --only-keep-distribution true
run: ./scripts/prepare-package.sh --remove-binary-targets true

- run: make init-ci-build
- run: make xcode-ci
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Samples/visionOS-Swift/visionOS-Swift.xcodeproj
Samples/watchOS-Swift/watchOS-Swift.xcodeproj
Samples/SentrySampleShared/SentrySampleShared.xcodeproj
Samples/DistributionSample/DistributionSample.xcodeproj
Samples/SPM/SPM.xcodeproj
TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj
TestSamples/SwiftUICrashTest/SwiftUICrashTest.xcodeproj

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ xcode:
open Sentry.xcworkspace

xcode-ci:
xcodegen --spec Samples/SPM/SPM.yml
xcodegen --spec Samples/SentrySampleShared/SentrySampleShared.yml
xcodegen --spec Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml
xcodegen --spec Samples/iOS-ObjectiveC/iOS-ObjectiveC.yml
Expand Down
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ var targets: [Target] = [
.testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests")
]

let env = getenv("EXPERIMENTAL_SPM_BUILDS")
if let env = env, String(cString: env, encoding: .utf8) == "1" {
products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"]))
targets.append(contentsOf: [
// At least one source file is required, therefore we use a dummy class to satisfy the SPM build system
Expand Down Expand Up @@ -114,7 +112,6 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
.headerSearchPath("SentryCrash/Reporting/Filters"),
.headerSearchPath("SentryCrash/Reporting/Filters/Tools")])
])
}

let package = Package(
name: "Sentry",
Expand Down
14 changes: 14 additions & 0 deletions Samples/SPM/SPM.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "../Shared/Config/_Common.xcconfig"

PRODUCT_BUNDLE_IDENTIFIER = io.sentry.sample.SPM
INFOPLIST_FILE = SPM/Info.plist
CODE_SIGN_ENTITLEMENTS = SPM/SPM.entitlements

PROVISIONING_PROFILE_SPECIFIER_Debug = match Development io.sentry.sample.SPM
PROVISIONING_PROFILE_SPECIFIER_Release = match AppStore io.sentry.sample.SPM
PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*] = $(PROVISIONING_PROFILE_SPECIFIER_$(CONFIGURATION))
PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*] =

CODE_SIGN_STYLE = Manual

SUPPORTED_PLATFORMS = iphoneos iphonesimulator
35 changes: 35 additions & 0 deletions Samples/SPM/SPM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# yaml-language-server: $schema=../../schema/xcodegen.schema.json

name: SPM
createIntermediateGroups: true
generateEmptyDirectories: true
configs:
Debug: debug
Release: release
fileGroups:
- SPM.yml
options:
bundleIdPrefix: io.sentry
packages:
Sentry:
path: ../../
targets:
SPM:
type: application
platform: auto
sources:
- SPM
dependencies:
- package: Sentry
products:
- SentrySwift
configFiles:
Debug: SPM.xcconfig
Release: SPM.xcconfig
schemes:
SPM:
templates:
- SampleAppScheme
build:
targets:
SPM: all
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors": [
{
"idiom": "universal"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"images": [
{
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
},
{
"appearances": [
{
"appearance": "luminosity",
"value": "dark"
}
],
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
},
{
"appearances": [
{
"appearance": "luminosity",
"value": "tinted"
}
],
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
6 changes: 6 additions & 0 deletions Samples/SPM/SPM/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info": {
"author": "xcode",
"version": 1
}
}
17 changes: 17 additions & 0 deletions Samples/SPM/SPM/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import SwiftUI

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}

#Preview {
ContentView()
}
56 changes: 56 additions & 0 deletions Samples/SPM/SPM/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>GIT_BRANCH</key>
<string>&lt;branch&gt;</string>
<key>GIT_COMMIT_HASH</key>
<string>&lt;sha&gt;</string>
<key>GIT_STATUS_CLEAN</key>
<string>&lt;status&gt;</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
10 changes: 10 additions & 0 deletions Samples/SPM/SPM/SPM.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
21 changes: 21 additions & 0 deletions Samples/SPM/SPM/SPMTestApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SentrySwift
import SwiftUI

@main
struct SPMTestApp: App {
init() {
let options = Options()
options.enableAppHangTracking = true
options.dsn = "https://[email protected]/5428557"
options.sessionReplay.maskAllImages = false
SentrySDK.start(options: options)
let user = User()
SentrySDK.setUser(user)
}

var body: some Scene {
WindowGroup {
ContentView()
}
}
}
3 changes: 3 additions & 0 deletions Sentry.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions scripts/prepare-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Options:
--remove-duplicate true|false
Whether to strip duplicate targets (default: false)
--change-path true|false Whether to swap SPM binary URLs for local paths (default: false)
--only-keep-distribution true|false
--remove-binary-targets true|false
Whether to keep only SentryDistribution product/target (default: false)
-h, --help Show this help message
USAGE
Expand All @@ -29,7 +29,7 @@ PACKAGE_FILE="Package.swift"
IS_PR="false"
REMOVE_DUPLICATE="false"
CHANGE_PATH="false"
ONLY_KEEP_DISTRIBUTION="false"
REMOVE_BINARY_TARGETS="false"

while [[ $# -gt 0 ]]; do
case "$1" in
Expand All @@ -53,9 +53,9 @@ while [[ $# -gt 0 ]]; do
CHANGE_PATH="$2"
shift 2
;;
--only-keep-distribution)
--remove-binary-targets)
[[ $# -lt 2 ]] && { echo "Missing value for $1" >&2; exit 1; }
ONLY_KEEP_DISTRIBUTION="$2"
REMOVE_BINARY_TARGETS="$2"
shift 2
;;
-h|--help)
Expand Down Expand Up @@ -103,7 +103,7 @@ if is_enabled "$CHANGE_PATH"; then
sed -i '' 's/platforms: \[\.iOS(\.v11), \.macOS(\.v10_13), \.tvOS(\.v11), \.watchOS(\.v4)\]$/platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4)],/g' "$PACKAGE_FILE"
fi

if is_enabled "$ONLY_KEEP_DISTRIBUTION"; then
if is_enabled "$REMOVE_BINARY_TARGETS"; then
# Remove all binary targets.
sed -i '' '/^[[:space:]]*\.binaryTarget(/,/^[[:space:]]*),\{0,1\}$/d' "$PACKAGE_FILE"

Expand All @@ -118,6 +118,7 @@ var products: [Product] = [\
sed -i '' '/^var targets: \[Target\] = \[/,/^]/c\
var targets: [Target] = [\
.target(name: "SentryDistribution", path: "Sources/SentryDistribution"),\
.testTarget(name: "SentryDistributionTests", dependencies: ["SentryDistribution"], path: "Sources/SentryDistributionTests")\
]\
' "$PACKAGE_FILE"

Expand Down
Loading