Skip to content

Commit a9e77dc

Browse files
feat: Properly demangle Swift class name (#2162)
Add Swift code into the framework and use it to properly demangle Swift class names Co-authored-by: Philipp Hofmann <[email protected]>
1 parent 7eee302 commit a9e77dc

35 files changed

+510
-140
lines changed

.github/workflows/lint.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ jobs:
4040
- run: ./scripts/ci-select-xcode.sh
4141
- run: make analyze
4242

43-
validate-podspec:
44-
name: Validate Podspec
43+
validate-podspec-framework:
44+
name: Validate Podspec as Framework
4545
runs-on: macos-12
4646
strategy:
4747
matrix:
@@ -51,7 +51,21 @@ jobs:
5151
- uses: actions/checkout@v3
5252
- run: ./scripts/ci-select-xcode.sh
5353
- name: Validate Podspec
54-
run: pod lib lint --verbose --platforms=${{ matrix.platform }}
54+
run: pod lib lint --verbose --platforms=${{ matrix.platform }} Sentry.podspec --include-podspecs=SentryPrivate.podspec
55+
shell: sh
56+
57+
validate-podspec-static:
58+
name: Validate Podspec as Static library
59+
runs-on: macos-12
60+
strategy:
61+
matrix:
62+
platform: ['ios', 'macos', 'tvos', 'watchos']
63+
64+
steps:
65+
- uses: actions/checkout@v3
66+
- run: ./scripts/ci-select-xcode.sh
67+
- name: Validate Podspec
68+
run: pod lib lint --verbose --platforms=${{ matrix.platform }} Sentry.podspec --include-podspecs=SentryPrivate.podspec --use-libraries
5569
shell: sh
5670

5771
validate-high-risk-files:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
This version introduces a dependency on Swift, which only impacts you if you don't use Swift. If your project uses Swift already, this change will not affect you.
6+
7+
### Features
8+
9+
- Properly demangle Swift class name (#2162)
10+
311
## 7.31.2
412

513
### Fixes

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ git-commit-add:
108108

109109
release-pod:
110110
pod trunk push Sentry.podspec
111+
pod trunk push SentryPrivate.podspec

Package.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ let package = Package(
99
.library(name: "Sentry-Dynamic", type: .dynamic, targets: ["Sentry"])
1010
],
1111
targets: [
12+
.target( name: "SentryPrivate",
13+
path: "Sources",
14+
sources: [
15+
"Swift"
16+
]
17+
),
1218
.target(
1319
name: "Sentry",
20+
dependencies: ["SentryPrivate"],
1421
path: "Sources",
1522
sources: [
1623
"Sentry/",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
$(SRCROOT)/Carthage/Build/iOS/Sentry.framework
1+
$(SRCROOT)/Carthage/Build/iOS/Sentry.framework
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Sentry.framework
1+
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Sentry.framework

Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@
132132
remoteGlobalIDString = 637AFDA5243B02760034958B;
133133
remoteInfo = "iOS-Swift";
134134
};
135+
D81A3499291D0B2C005A27A9 /* PBXContainerItemProxy */ = {
136+
isa = PBXContainerItemProxy;
137+
containerPortal = 6308532C2440C44F00DDE4CE /* Sentry.xcodeproj */;
138+
proxyType = 2;
139+
remoteGlobalIDString = D81A3488291D0AC0005A27A9;
140+
remoteInfo = SentryPrivate;
141+
};
135142
D83A30CA279F075800372D0A /* PBXContainerItemProxy */ = {
136143
isa = PBXContainerItemProxy;
137144
containerPortal = 6308532C2440C44F00DDE4CE /* Sentry.xcodeproj */;
@@ -350,6 +357,7 @@
350357
children = (
351358
630853322440C44F00DDE4CE /* Sentry.framework */,
352359
630853342440C44F00DDE4CE /* SentryTests.xctest */,
360+
D81A349A291D0B2C005A27A9 /* SentryPrivate.framework */,
353361
);
354362
name = Products;
355363
sourceTree = "<group>";
@@ -720,6 +728,13 @@
720728
remoteRef = 630853332440C44F00DDE4CE /* PBXContainerItemProxy */;
721729
sourceTree = BUILT_PRODUCTS_DIR;
722730
};
731+
D81A349A291D0B2C005A27A9 /* SentryPrivate.framework */ = {
732+
isa = PBXReferenceProxy;
733+
fileType = wrapper.framework;
734+
path = SentryPrivate.framework;
735+
remoteRef = D81A3499291D0B2C005A27A9 /* PBXContainerItemProxy */;
736+
sourceTree = BUILT_PRODUCTS_DIR;
737+
};
723738
/* End PBXReferenceProxy section */
724739

725740
/* Begin PBXResourcesBuildPhase section */

Sentry.podspec

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Pod::Spec.new do |s|
1616
s.requires_arc = true
1717
s.frameworks = 'Foundation'
1818
s.libraries = 'z', 'c++'
19+
s.swift_versions = "5.5"
1920
s.pod_target_xcconfig = {
2021
'GCC_ENABLE_CPP_EXCEPTIONS' => 'YES',
2122
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
@@ -26,20 +27,20 @@ Pod::Spec.new do |s|
2627
}
2728

2829
s.default_subspecs = ['Core']
30+
s.dependency "SentryPrivate", "7.31.0"
2931

3032
s.subspec 'Core' do |sp|
3133
sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}",
32-
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}"
33-
34-
sp.public_header_files = "Sources/Sentry/Public/*.h"
34+
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/Sentry.swift"
35+
sp.public_header_files =
36+
"Sources/Sentry/Public/*.h"
3537
end
3638

3739
s.subspec 'HybridSDK' do |sp|
3840
sp.source_files = "Sources/Sentry/**/*.{h,hpp,m,mm,c,cpp}",
39-
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}"
41+
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/Sentry.swift"
4042

4143
sp.public_header_files =
4244
"Sources/Sentry/Public/*.h", "Sources/Sentry/include/PrivateSentrySDKOnly.h"
4345
end
44-
4546
end

0 commit comments

Comments
 (0)