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
2 changes: 2 additions & 0 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
- name: Swift version
run: swift --version
- name: Run tests against Apple's AttributeGraph on macOS via SwiftPM
env:
OPENGRAPH_LIBRARY_EVOLUTION: 0
run: |
swift test \
--build-path .build-compatibility-test-debug
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- name: Swift version
run: swift --version
- name: Build and run tests in debug mode with coverage
env:
OPENGRAPH_LIBRARY_EVOLUTION: 0
run: |
swift test \
-c debug \
Expand All @@ -45,6 +47,8 @@ jobs:
.build-test-debug/debug/OpenGraphPackageTests.xctest/Contents/MacOS/OpenGraphPackageTests \
> coverage.txt
- name: Build and run tests in release mode
env:
OPENGRAPH_LIBRARY_EVOLUTION: 0
run: |
swift test \
-c release \
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ var sharedCSettings: [CSetting] = [

var sharedSwiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("InternalImportsByDefault"),
.enableExperimentalFeature("Extern"),
.swiftLanguageMode(.v5),
.unsafeFlags(["-enable-library-evolution"]),
]

// MARK: [env] OPENGRAPH_SWIFT_TOOLCHAIN_PATH
Expand Down Expand Up @@ -119,6 +119,7 @@ let libraryEvolutionCondition = envEnable("OPENGRAPH_LIBRARY_EVOLUTION")
#endif

if libraryEvolutionCondition {
// NOTE: -enable-library-evolution is not supported on `swift build` yet.
sharedSwiftSettings.append(.unsafeFlags(["-enable-library-evolution"]))
}

Expand Down
16 changes: 8 additions & 8 deletions Sources/OpenGraph/Runtime/TupleType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@

// MARK: - UnsafeMutableTuple

@_silgen_name("swift_slowAlloc")
private func slowAlloc(_ size: Int, _ alignMask: Int) -> UnsafeMutableRawPointer

@_silgen_name("swift_slowDealloc")
private func slowDealloc(_ ptr: UnsafeMutableRawPointer, _ size: Int, _ alignMask: Int)

extension UnsafeMutableTuple {
public init(with tupleType: TupleType) {
self.init(type: tupleType, value: slowAlloc(tupleType.size, -1))
self.init(
type: tupleType,
value: UnsafeMutableRawPointer.allocate(
byteCount: tupleType.size,
alignment: -1
)
)

Check warning on line 86 in Sources/OpenGraph/Runtime/TupleType.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenGraph/Runtime/TupleType.swift#L80-L86

Added lines #L80 - L86 were not covered by tests
}

public func initialize<T>(at index: Int, to element: T) {
Expand All @@ -104,7 +104,7 @@
if initialized {
deinitialize()
}
slowDealloc(value, -1, -1)
value.deallocate()

Check warning on line 107 in Sources/OpenGraph/Runtime/TupleType.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenGraph/Runtime/TupleType.swift#L107

Added line #L107 was not covered by tests
}

public var count: Int { type.count }
Expand Down