Skip to content

Lower deployment target to macOS 10.13 #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 1, 2024
Merged
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import class Foundation.ProcessInfo

let package = Package(
name: "WasmKit",
platforms: [.macOS(.v11), .iOS(.v14)],
platforms: [.macOS(.v10_13), .iOS(.v12)],
products: [
.library(
name: "WasmKit",
Expand Down
1 change: 1 addition & 0 deletions Sources/Spectest/Spectest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SystemPackage
import WasmKit

@main
@available(macOS 11, *)
struct Spectest: AsyncParsableCommand {
@Argument
var path: String
Expand Down
1 change: 1 addition & 0 deletions Sources/WITExtractor/ModuleTranslation.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@available(macOS 11, *)
struct ModuleTranslation {
let diagnostics: DiagnosticCollection
let typeMapping: TypeMapping
Expand Down
1 change: 1 addition & 0 deletions Sources/WITExtractor/SourceSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public struct SwiftFunctionSource {
let name: String
}

@available(macOS 11, *)
struct SourceSummaryBuilder {
let diagnostics: DiagnosticCollection
let typeMapping: TypeMapping
Expand Down
1 change: 1 addition & 0 deletions Sources/WITExtractor/SwiftAPIDigester.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct SwiftAPIDigester {
typealias SDKNodeType = SDKNodeInherit<SDKNodeBody, SDKNodeTypeBody>
typealias SDKNodeTypeNominal = SDKNodeInherit<SDKNodeType, SDKNodeTypeNominalBody>

@available(macOS 11, *)
func dumpSDK(moduleName: String, arguments: [String]) throws -> Output {
var args = [
"-dump-sdk",
Expand Down
1 change: 1 addition & 0 deletions Sources/WITExtractor/TypeMapping.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@available(macOS 11, *)
struct TypeMapping {
typealias DeclScope = [SwiftAPIDigester.SDKNodeDecl]
struct DeclSource {
Expand Down
4 changes: 4 additions & 0 deletions Sources/WITExtractor/WITExtractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public struct WITExtractor {
}

public func run(moduleName: String) throws -> Output {
guard #available(macOS 11, *) else {
fatalError("WITExtractor requires macOS 11+")
}
let header = """
// DO NOT EDIT.
//
Expand All @@ -42,6 +45,7 @@ public struct WITExtractor {
return output
}

@available(macOS 11, *)
func runWithoutHeader(moduleName: String) throws -> Output {
let output = try digester.dumpSDK(moduleName: moduleName, arguments: extraDigesterArguments)
var typeMapping = TypeMapping()
Expand Down
4 changes: 4 additions & 0 deletions Sources/WITTool/WITTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ struct ExtractWIT: ParsableCommand {
var digesterArgs: [String] = []

func run() throws {
guard #available(macOS 11, *) else {
fatalError("ExtractWIT requires macOS 11+")
}

let extractor = WITExtractor(
namespace: namespace,
packageName: packageName,
Expand Down
24 changes: 20 additions & 4 deletions Sources/WasmKit/Execution/Runtime/Stack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,16 @@ struct ValueStack {
}

extension ValueStack: Sequence {
func makeIterator() -> some IteratorProtocol {
self.values[..<count].makeIterator()
struct Iterator: IteratorProtocol {
fileprivate var base: UnsafeMutableBufferPointer<Value>.SubSequence.Iterator

mutating func next() -> Value? {
base.next()
}
}

func makeIterator() -> Iterator {
Iterator(base: self.values[..<count].makeIterator())
}
}

Expand Down Expand Up @@ -207,8 +215,16 @@ struct FixedSizeStack<Element> {
}

extension FixedSizeStack: Sequence {
func makeIterator() -> some IteratorProtocol<Element> {
self.buffer[..<numberOfElements].makeIterator()
struct Iterator: IteratorProtocol {
fileprivate var base: UnsafeMutableBufferPointer<Element>.SubSequence.Iterator

mutating func next() -> Element? {
base.next()
}
}

func makeIterator() -> Iterator {
Iterator(base: self.buffer[..<numberOfElements].makeIterator())
}
}

Expand Down
Loading