Skip to content

Commit

Permalink
Merge e20f1a5 into 61a1a2b
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin authored Mar 1, 2024
2 parents 61a1a2b + e20f1a5 commit 1078ecb
Show file tree
Hide file tree
Showing 47 changed files with 355 additions and 609 deletions.
3 changes: 0 additions & 3 deletions .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ changelogPolicy: auto
preReleaseCommand: bash ./scripts/bump.sh
targets:
- name: github
- name: cocoapods
id: sentryprivate-cocoapod
specPath: SentryPrivate.podspec
- name: cocoapods
id: sentry-cocoapod
specPath: Sentry.podspec
Expand Down
1 change: 1 addition & 0 deletions .github/last-release-runid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
2 changes: 2 additions & 0 deletions .github/workflows/benchmarking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ jobs:
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
- name: Build Framework
run: make build-xcframework
- name: Build test app with sentry
run: bundle exec fastlane build_perf_test_app_sentry
env:
Expand Down
69 changes: 53 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,30 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh 15.2
- run: make build-xcframework
- run: echo "FRAMEWORK_RUN_ID=$(./scripts/xcframework-generated-run.sh)" >> $GITHUB_ENV

- uses: actions/download-artifact@v4
if: startsWith(github.ref, 'refs/heads/release/')
with:
name: xcframeworks.zip
path: Carthage/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.FRAMEWORK_RUN_ID }}

- name: Check XCFramework
#We dont compile the framework during releases to not change the artefact SHA value
#instead we use the one archive as an artefact
if: startsWith(github.ref, 'refs/heads/release/')
run: |
ls -R Carthage
if [ ! -f Carthage/Sentry.xcframework.zip ]; then
echo "XCFramework is not available"
exit 1
fi
- name: Build xcframework
if: startsWith(github.ref, 'refs/heads/release/') == false
run: make build-xcframework
shell: sh

- name: Archiving XCFramework.zip
Expand All @@ -106,7 +129,7 @@ jobs:
name: ${{ github.sha }}
if-no-files-found: error
path: |
${{ github.workspace }}/*.zip
${{ github.workspace }}/Carthage/*.zip
- name: Archive build log if failed
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -135,15 +158,17 @@ jobs:
validate-spm:
name: Validate Swift Package Manager
runs-on: macos-13
needs: build-xcframework
steps:
- uses: actions/checkout@v4
- name: Set SPM revision to current git commit
run: >-
if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then
sed -i '' 's/.branch("main")/.revision("${{ github.event.pull_request.head.sha }}")/g' Samples/macOS-SPM-CommandLine/Package.swift
else
sed -i '' 's/.branch("main")/.revision("${{ github.sha }}")/g' Samples/macOS-SPM-CommandLine/Package.swift
fi
- uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- name: Change path of the framework
run: |
sed -i '' 's/url.*//g' Package.swift
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift
shell: bash
- run: swift build
working-directory: Samples/macOS-SPM-CommandLine
Expand All @@ -152,15 +177,17 @@ jobs:
validate-spm-dynamic:
name: Validate Swift Package Manager Dynamic
runs-on: macos-13
needs: build-xcframework
steps:
- uses: actions/checkout@v4
- name: Set SPM revision to current git commit
run: >-
if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then
sed -i '' 's/.branch("main")/.revision("${{ github.event.pull_request.head.sha }}")/g' Samples/SPM-Dynamic/Package.swift
else
sed -i '' 's/.branch("main")/.revision("${{ github.sha }}")/g' Samples/SPM-Dynamic/Package.swift
fi
- uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- name: Change path of the framework
run: |
sed -i '' 's/url.*//g' Package.swift
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift
shell: bash
- run: swift build
working-directory: Samples/SPM-Dynamic
Expand All @@ -169,8 +196,18 @@ jobs:
swift-build:
name: Build with Swift
runs-on: macos-13
needs: build-xcframework
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- name: Change path of the framework
run: |
sed -i '' 's/url.*//g' Package.swift
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' Package.swift
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' Package.swift
shell: bash
- run: swift build
shell: sh

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
- run: ./scripts/ci-select-xcode.sh
- run: pod repo update
- name: Validate HybridPod Podspec
run: pod lib lint ./Tests/HybridSDKTest/HybridPod.podspec --allow-warnings --verbose --platforms=ios "--include-podspecs={SentryPrivate.podspec,Sentry.podspec}"
run: pod lib lint ./Tests/HybridSDKTest/HybridPod.podspec --allow-warnings --verbose --platforms=ios "--include-podspecs={Sentry.podspec}"
35 changes: 34 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,49 @@ on:
required: false

jobs:
prepare_framework:
runs-on: macos-13-xlarge
name: 'Create XCFramework'
steps:
- uses: actions/checkout@v4

- name: 'Generate XCFramework'
run: |
./scripts/ci-select-xcode.sh 15.2
# We need to build the framework during release to get it's SHA value
# the framework will be saved as an artefact and we will use the same
# binary for the entire release process to avoid the SHA to change
make build-xcframework
- uses: actions/upload-artifact@v4
with:
name: xcframeworks.zip
path: |
Carthage/Sentry.xcframework.zip
Carthage/Sentry-Dynamic.xcframework.zip
Carthage/SentrySwiftUI.xcframework.zip
overwrite: true

job_release:
runs-on: ubuntu-latest
name: 'Release a new version'
needs: prepare_framework
steps:
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_RELEASE_PAT }}
fetch-depth: 0


- uses: actions/download-artifact@v4
with:
name: xcframeworks.zip
path: Carthage/

# update-package-sha.sh uses this env variable to update Package.swift.
# During release Craft calls bump.sh that uses update-package-sha.sh.
- run: export GITHUB_RUN_ID=${{ github.run_id }}

- name: Prepare release
uses: getsentry/action-prepare-release@v1
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Improvements

- Remove SentryPrivate library (#3623)

### Fixes

- Make SentryFramesTracker available for HybridSDKs ([#3683](https://github.com/getsentry/sentry-cocoa/pull/3683))
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ analyze:
# For more info check out: https://github.com/Carthage/Carthage/releases/tag/0.38.0
build-xcframework:
@echo "--> Carthage: creating Sentry xcframework"
carthage build --use-xcframeworks --no-skip-current --verbose > build-xcframework.log
./scripts/build-xcframework.sh > build-xcframework.log
# use ditto here to avoid clobbering symlinks which exist in macOS frameworks
ditto -c -k -X --rsrc --keepParent Carthage Sentry.xcframework.zip
ditto -c -k -X --rsrc --keepParent Carthage/Sentry.xcframework Carthage/Sentry.xcframework.zip
ditto -c -k -X --rsrc --keepParent Carthage/Sentry-Dynamic.xcframework Carthage/Sentry-Dynamic.xcframework.zip
ditto -c -k -X --rsrc --keepParent Carthage/SentrySwiftUI.xcframework Carthage/SentrySwiftUI.xcframework.zip

build-xcframework-sample:
./scripts/create-carthage-json.sh
Expand Down
61 changes: 19 additions & 42 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,34 @@ let package = Package(
platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4)],
products: [
.library(name: "Sentry", targets: ["Sentry"]),
.library(name: "Sentry-Dynamic", type: .dynamic, targets: ["Sentry"]),
.library(name: "SentrySwiftUI", targets: ["SentrySwiftUI"])
.library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]),
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"])
],
targets: [
.target(
name: "Sentry",
dependencies: ["SentryPrivate"],
path: "Sources",
sources: [
"Sentry/",
"SentryCrash/"
],
publicHeadersPath: "Sentry/Public/",
cxxSettings: [
.define("GCC_ENABLE_CPP_EXCEPTIONS", to: "YES"),
.headerSearchPath("Sentry/include"),
.headerSearchPath("Sentry/include/HybridPublic"),
.headerSearchPath("Sentry/Public"),
.headerSearchPath("SentryCrash/Installations"),
.headerSearchPath("SentryCrash/Recording"),
.headerSearchPath("SentryCrash/Recording/Monitors"),
.headerSearchPath("SentryCrash/Recording/Tools"),
.headerSearchPath("SentryCrash/Reporting/Filters"),
.headerSearchPath("SentryCrash/Reporting/Filters/Tools"),
.headerSearchPath("SentryCrash/Reporting/Tools")
]
),
.target( name: "SentryPrivate",
path: "Sources",
sources: [
"Swift"
],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy")
]
),
.binaryTarget(
name: "Sentry",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.22.0-alpha.0/Sentry.xcframework.zip",
checksum: "86156301aee5c8774a8cd5c240286f914f6e7721aaac5a7c9d049ea613a4b730" //Sentry-Static
),
.binaryTarget(
name: "Sentry-Dynamic",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.22.0-alpha.0/Sentry-Dynamic.xcframework.zip",
checksum: "86156301aee5c8774a8cd5c240286f914f6e7721aaac5a7c9d049ea613a4b730" //Sentry-Dynamic
),
.target ( name: "SentrySwiftUI",
dependencies: ["Sentry", "SentryInternal"],
path: "Sources",
exclude: ["SentrySwiftUI/SentryInternal/"],
sources: [
"SentrySwiftUI"
path: "Sources/SentrySwiftUI",
exclude: ["SentryInternal/", "module.modulemap"],
linkerSettings: [
.linkedFramework("Sentry")
]
),
//SentryInternal is how we expose some internal Sentry SDK classes to SentrySwiftUI.
.target( name: "SentryInternal",
path: "Sources",
path: "Sources/SentrySwiftUI",
sources: [
"SentrySwiftUI/SentryInternal/"
"SentryInternal/"
],
publicHeadersPath: "SentrySwiftUI/SentryInternal/"
publicHeadersPath: "SentryInternal/"
)
],
cxxLanguageStandard: .cxx14
Expand Down
6 changes: 3 additions & 3 deletions Samples/SPM-Dynamic/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ let package = Package(
name: "SPM-Dynamic",
platforms: [.macOS(.v10_13)],
products: [
.library(name: "SPM-Dynamic", type: .dynamic, targets: ["SPM-Dynamic"])
.executable(name: "SPM-Dynamic", targets: ["SPM-Dynamic"])
],
dependencies: [
// branch is replaced in CI to the current sha
.package(name: "Sentry", url: "https://github.com/getsentry/sentry-cocoa", .branch("main") )
.package(name: "Sentry", path: "../../../sentry-cocoa")
],
targets: [
.target(
name: "SPM-Dynamic",
dependencies: ["Sentry"],
dependencies: [.product(name: "Sentry-Dynamic", package: "Sentry")],
swiftSettings: [
.unsafeFlags(["-warnings-as-errors"])
])
Expand Down
3 changes: 2 additions & 1 deletion Samples/iOS-Swift/iOS-Swift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let appSupport = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).first!
let cache = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first!
for path in [appSupport, cache] {
for item in FileManager.default.enumerator(atPath: path)! {
guard let files = FileManager.default.enumerator(atPath: path) else { return }
for item in files {
try! FileManager.default.removeItem(atPath: (path as NSString).appendingPathComponent((item as! String)))
}
}
Expand Down
3 changes: 1 addition & 2 deletions Samples/macOS-SPM-CommandLine/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import PackageDescription
let package = Package(
name: "macOS-SPM-CommandLine",
dependencies: [
// branch is replaced in CI to the current sha
.package(name: "Sentry", url: "https://github.com/getsentry/sentry-cocoa", .branch("main") )
.package(name: "Sentry", path: "../../../sentry-cocoa")
],
targets: [
.target(
Expand Down
6 changes: 3 additions & 3 deletions Sentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ Pod::Spec.new do |s|
'GCC_ENABLE_CPP_EXCEPTIONS' => 'YES',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
'CLANG_CXX_LIBRARY' => 'libc++',
'APPLICATION_EXTENSION_API_ONLY' => 'YES'
}
s.watchos.pod_target_xcconfig = {
'OTHER_LDFLAGS' => '$(inherited) -framework WatchKit'
}

s.default_subspecs = ['Core']
s.dependency "SentryPrivate", "8.21.0-beta.0"

s.subspec 'Core' do |sp|
sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}",
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/Sentry.swift"
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/**/*.{swift,h,hpp,m,mm,c,cpp}"
sp.public_header_files =
"Sources/Sentry/Public/*.h"
sp.resource_bundles = { "Sentry" => "Sources/Resources/PrivacyInfo.xcprivacy" }
end

s.subspec 'HybridSDK' do |sp|
sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}",
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/Sentry.swift"
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/**/*.{swift,h,hpp,m,mm,c,cpp}"

sp.public_header_files =
"Sources/Sentry/Public/*.h", "Sources/Sentry/include/HybridPublic/*.h"
Expand Down
Loading

0 comments on commit 1078ecb

Please sign in to comment.