Skip to content

Commit 6adee68

Browse files
authored
Fix library evolution. (#90)
1 parent 8a9ed5d commit 6adee68

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ jobs:
2828
- name: Run tests
2929
run: make test-${{ matrix.config }}
3030

31+
library-evolution:
32+
name: Library evolution
33+
runs-on: macos-14
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Select Xcode
37+
run: sudo xcode-select -s /Applications/Xcode_15.4.app
38+
- name: Run tests
39+
run: make build-for-library-evolution
40+
3141
examples:
3242
strategy:
3343
matrix:

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ test-wasm:
3131
build-for-static-stdlib:
3232
@swift build -c $(CONFIG) --static-swift-stdlib
3333

34+
build-for-library-evolution:
35+
swift build \
36+
-c release \
37+
--target IssueReporting \
38+
-Xswiftc -emit-module-interface \
39+
-Xswiftc -enable-library-evolution
40+
3441
format:
3542
@swift format \
3643
--ignore-unparsable-files \

Sources/IssueReporting/IssueReporters/RuntimeWarningReporter.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ public struct RuntimeWarningReporter: IssueReporter {
3030
#endif
3131
@usableFromInline var dso: UnsafeRawPointer
3232

33-
#if canImport(Darwin)
34-
@_transparent
35-
#endif
33+
init(dso: UnsafeRawPointer) {
34+
self.dso = dso
35+
}
36+
3637
@usableFromInline
3738
init() {
3839
// NB: Xcode runtime warnings offer a much better experience than traditional assertions and
@@ -41,18 +42,18 @@ public struct RuntimeWarningReporter: IssueReporter {
4142
//
4243
// Feedback filed: https://gist.github.com/stephencelis/a8d06383ed6ccde3e5ef5d1b3ad52bbc
4344
let count = _dyld_image_count()
44-
self.dso = #dsohandle
4545
for i in 0..<count {
4646
if let name = _dyld_get_image_name(i) {
4747
let swiftString = String(cString: name)
4848
if swiftString.hasSuffix("/SwiftUI") {
4949
if let header = _dyld_get_image_header(i) {
50-
self.dso = UnsafeRawPointer(header)
50+
self.init(dso: UnsafeRawPointer(header))
5151
return
5252
}
5353
}
5454
}
5555
}
56+
self.init(dso: #dsohandle)
5657
}
5758
#endif
5859

0 commit comments

Comments
 (0)