Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
93 lines (86 loc) · 2.93 KB
/
Copy pathPackage.swift
File metadata and controls
93 lines (86 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swiftlint:disable explicit_acl explicit_top_level_acl file_name
import PackageDescription
// Bare imports in swift-openapi-generator output must stay public; do not apply
// InternalImportsByDefault to the generated MistKitOpenAPI target.
let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("InternalImportsByDefault"),
]
let package = Package(
name: "MistKit",
platforms: [
.macOS(.v11),
.iOS(.v14),
.tvOS(.v14),
.watchOS(.v7),
.visionOS(.v1)
// Note: WASM/WASI support doesn't require explicit platform declaration
// Use --swift-sdk wasm32-unknown-wasi when building for WASM
],
products: [
// Products define the executables and libraries a package produces,
// making them visible to other packages.
.library(
name: "MistKit",
targets: ["MistKit"]
),
.library(
name: "MistKitOpenAPI",
targets: ["MistKitOpenAPI"]
),
],
dependencies: [
// Swift OpenAPI Runtime dependencies
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.8.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.2.0"),
// Crypto library for cross-platform cryptographic operations
.package(url: "https://github.com/apple/swift-crypto.git", from: "4.0.0"),
// Logging library for cross-platform logging
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "MistKitOpenAPI",
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
]
),
.target(
name: "MistKit",
dependencies: [
"MistKitOpenAPI",
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
// URLSession transport only available on non-WASM platforms
.product(
name: "OpenAPIURLSession",
package: "swift-openapi-urlsession",
condition: .when(platforms: Platform.without(Platform.wasi))
),
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "Logging", package: "swift-log"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "MistKitTests",
dependencies: ["MistKit", "MistKitOpenAPI"],
swiftSettings: swiftSettings
),
]
)
extension Platform {
static let all: [Platform] = [
.macOS, .iOS, .tvOS, .watchOS, .visionOS, .linux, .windows, android, .driverKit, .wasi
]
static func without(_ platform: Platform) -> [Platform] {
var result = all
result.removeAll{
$0 == platform
}
return result
}
}
// swiftlint:enable explicit_acl explicit_top_level_acl