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
3 changes: 1 addition & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["5.10"]
swift_version: ["6.0"]
runs-on: ubuntu-22.04
env:
OPENGRAPH_WERROR: 1
OPENGRAPH_SWIFT_TESTING: 1
OPENGRAPH_ATTRIBUTEGRAPH: 0
OPENGRAPH_COMPATIBILITY_TEST: 0
container: swift:${{ matrix.swift_version }}-jammy
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ jobs:
strategy:
fail-fast: false
matrix:
swift_version: ["5.10.0-RELEASE"]
swift_version: ["5.10.0-RELEASE", "6.0-SNAPSHOT-2024-09-18-a"]
os: [ubuntu-22.04]
include:
- swift_version: "6.0-SNAPSHOT-2024-09-18-a"
continue-on-error: true
runs-on: ${{ matrix.os }}
env:
OPENGRAPH_WERROR: 1
OPENGRAPH_SWIFT_TESTING: 0
OPENGRAPH_ATTRIBUTEGRAPH: 0
OPENGRAPH_COMPATIBILITY_TEST: 0
steps:
Expand All @@ -26,9 +28,9 @@ jobs:
with:
swift-version: wasm-${{ matrix.swift_version }}
- name: build
continue-on-error: ${{ matrix.continue-on-error }}
run: |
swift build --triple wasm32-unknown-wasi
# Blocked by upstream support for WASM. See https://github.com/apple/swift-testing/issues/228
# - name: test
# run: |
# swift test --triple wasm32-unknown-wasi
# run: |
# swift test --triple wasm32-unknown-wasi
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ let openGraphCompatibilityTestTarget = Target.testTarget(
swiftSettings: sharedSwiftSettings
)

let swiftBinPath = Context.environment["_"] ?? ""
let swiftBinPath = Context.environment["_"] ?? "/usr/bin/swift"
let swiftBinURL = URL(fileURLWithPath: swiftBinPath)
let SDKPath = swiftBinURL.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().path
let includePath = SDKPath.appending("/usr/lib/swift_static")
let includePath = SDKPath.appending("/usr/lib/swift")

let package = Package(
name: "OpenGraph",
Expand Down
2 changes: 1 addition & 1 deletion Package@swift-5.10.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let openGraphCompatibilityTestTarget = Target.testTarget(
swiftSettings: sharedSwiftSettings
)

let swiftBinPath = Context.environment["_"] ?? ""
let swiftBinPath = Context.environment["_"] ?? "/usr/bin/swift"
let swiftBinURL = URL(fileURLWithPath: swiftBinPath)
let SDKPath = swiftBinURL.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().path
let includePath = SDKPath.appending("/usr/lib/swift_static")
Expand Down
15 changes: 3 additions & 12 deletions Plugins/UpdateModule/UpdateModuleCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@ import Foundation
@main
struct UpdateModuleCommand: CommandPlugin {
func performCommand(context: PackagePlugin.PluginContext, arguments: [String]) async throws {
#if compiler(>=6.0) // Skip build on WASI 5.10
let process = Process()
#if os(macOS)
let path: String = try context.tool(named: "zsh").url.path()
let url: URL? = if #available(macOS 14, *) {
URL(filePath: path)
} else {
URL(string: "file://\(path)")
}
#else
let path = try context.tool(named: "zsh").path.string
let url = URL(string: "file://\(path)")
#endif
process.executableURL = url
process.executableURL = try context.tool(named: "zsh").url
process.arguments = ["AG/update.sh"]
try process.run()
process.waitUntilExit()
#endif
}
}
1 change: 0 additions & 1 deletion Scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ OPENGRAPH_ROOT="$(dirname $(dirname $(filepath $0)))"

cd $OPENGRAPH_ROOT

export OPENGRAPH_SWIFT_TESTING=0
swift build
1 change: 0 additions & 1 deletion Scripts/og_swiftinterface.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ OG_ROOT="$(dirname $(dirname $(filepath $0)))"

cd $OG_ROOT

export OPENGRAPH_SWIFT_TESTING=0
swift build -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ struct PointerOffsetTests {
#expect(invalidPointer == UnsafeMutablePointer(bitPattern: stride))
}

#if compiler(>=6.0)
@Test(.bug("https://github.com/OpenSwiftUIProject/OpenGraph/issues/70", id: 70, "Verify fix of #70"))
func ofAndOffset() {
struct Empty {
Expand Down Expand Up @@ -79,7 +78,6 @@ struct PointerOffsetTests {
.of(&invalid.third)
}
}
#endif

@Test("Extension API between UnsafePointer/UnsafeMutablePointer and PointerOffset")
func unsafePointerAndUnsafeMutablePointerExtension() {
Expand Down Expand Up @@ -147,7 +145,6 @@ struct PointerOffsetTests {
#expect((pointer + secondOffset).pointee == 4)
#expect((pointer + thirdOffset).pointee == 5)
}
#if !(!canImport(Darwin) && !DEBUG)
withUnsafePointer(to: triple) { pointer in
#expect((pointer + firstOffset).pointee == 3)
#expect((pointer + secondOffset).pointee == 4)
Expand All @@ -156,31 +153,6 @@ struct PointerOffsetTests {
#expect(triple.first == 3)
#expect(triple.second == 4)
#expect(triple.third == 5)
#endif
}
}

#if !canImport(Darwin) && !DEBUG
@Test("Undefined Behavior Issue for PointerOffset", .bug("#73", relationship: .uncoveredBug))
func unsafePointerAndUnsafeMutablePointerExtensionUB() {
var tuple = Tuple(first: 1, second: 2)
typealias Base = Tuple<Int, Int>
let firstOffset = PointerOffset<Base, Int>(byteOffset: 0)
withUnsafeMutablePointer(to: &tuple) { pointer in
#expect(pointer[offset: firstOffset] == 1)
pointer[offset: firstOffset] = 3
}
let unexpectedValue = tuple.first
// The value will be unexpected due to UB
#expect(unexpectedValue == 1)
// The value will be expected after and within a withKnownIssue block
withKnownIssue {
let expectedValue = tuple.first
#expect(expectedValue == 3)
Issue.record("To make withKnownIssue pass")
}
let expectedValue = tuple.first
#expect(expectedValue == 3)
}
#endif
}