Skip to content

Commit

Permalink
feat: Properly demangle Swift class name (#2162)
Browse files Browse the repository at this point in the history
Add Swift code into the framework and use it to properly demangle Swift class names

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
  • Loading branch information
brustolin and philipphofmann authored Nov 21, 2022
1 parent 7eee302 commit a9e77dc
Show file tree
Hide file tree
Showing 35 changed files with 510 additions and 140 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
- run: ./scripts/ci-select-xcode.sh
- run: make analyze

validate-podspec:
name: Validate Podspec
validate-podspec-framework:
name: Validate Podspec as Framework
runs-on: macos-12
strategy:
matrix:
Expand All @@ -51,7 +51,21 @@ jobs:
- uses: actions/checkout@v3
- run: ./scripts/ci-select-xcode.sh
- name: Validate Podspec
run: pod lib lint --verbose --platforms=${{ matrix.platform }}
run: pod lib lint --verbose --platforms=${{ matrix.platform }} Sentry.podspec --include-podspecs=SentryPrivate.podspec
shell: sh

validate-podspec-static:
name: Validate Podspec as Static library
runs-on: macos-12
strategy:
matrix:
platform: ['ios', 'macos', 'tvos', 'watchos']

steps:
- uses: actions/checkout@v3
- run: ./scripts/ci-select-xcode.sh
- name: Validate Podspec
run: pod lib lint --verbose --platforms=${{ matrix.platform }} Sentry.podspec --include-podspecs=SentryPrivate.podspec --use-libraries
shell: sh

validate-high-risk-files:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Unreleased

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.

### Features

- Properly demangle Swift class name (#2162)

## 7.31.2

### Fixes
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ git-commit-add:

release-pod:
pod trunk push Sentry.podspec
pod trunk push SentryPrivate.podspec
7 changes: 7 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ let package = Package(
.library(name: "Sentry-Dynamic", type: .dynamic, targets: ["Sentry"])
],
targets: [
.target( name: "SentryPrivate",
path: "Sources",
sources: [
"Swift"
]
),
.target(
name: "Sentry",
dependencies: ["SentryPrivate"],
path: "Sources",
sources: [
"Sentry/",
Expand Down
2 changes: 1 addition & 1 deletion Samples/Carthage-Validation/Framework/input.xcfilelist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(SRCROOT)/Carthage/Build/iOS/Sentry.framework
$(SRCROOT)/Carthage/Build/iOS/Sentry.framework
2 changes: 1 addition & 1 deletion Samples/Carthage-Validation/Framework/output.xcfilelist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Sentry.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Sentry.framework
15 changes: 15 additions & 0 deletions Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@
remoteGlobalIDString = 637AFDA5243B02760034958B;
remoteInfo = "iOS-Swift";
};
D81A3499291D0B2C005A27A9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6308532C2440C44F00DDE4CE /* Sentry.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D81A3488291D0AC0005A27A9;
remoteInfo = SentryPrivate;
};
D83A30CA279F075800372D0A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6308532C2440C44F00DDE4CE /* Sentry.xcodeproj */;
Expand Down Expand Up @@ -350,6 +357,7 @@
children = (
630853322440C44F00DDE4CE /* Sentry.framework */,
630853342440C44F00DDE4CE /* SentryTests.xctest */,
D81A349A291D0B2C005A27A9 /* SentryPrivate.framework */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -720,6 +728,13 @@
remoteRef = 630853332440C44F00DDE4CE /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
D81A349A291D0B2C005A27A9 /* SentryPrivate.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = SentryPrivate.framework;
remoteRef = D81A3499291D0B2C005A27A9 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down
11 changes: 6 additions & 5 deletions Sentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.frameworks = 'Foundation'
s.libraries = 'z', 'c++'
s.swift_versions = "5.5"
s.pod_target_xcconfig = {
'GCC_ENABLE_CPP_EXCEPTIONS' => 'YES',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
Expand All @@ -26,20 +27,20 @@ Pod::Spec.new do |s|
}

s.default_subspecs = ['Core']
s.dependency "SentryPrivate", "7.31.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}"
sp.public_header_files = "Sources/Sentry/Public/*.h"
"Sources/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/Sentry.swift"
sp.public_header_files =
"Sources/Sentry/Public/*.h"
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/SentryCrash/**/*.{h,hpp,m,mm,c,cpp}", "Sources/Swift/Sentry.swift"

sp.public_header_files =
"Sources/Sentry/Public/*.h", "Sources/Sentry/include/PrivateSentrySDKOnly.h"
end

end
Loading

0 comments on commit a9e77dc

Please sign in to comment.