forked from apple/swift-openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
133 lines (120 loc) · 4.21 KB
/
Package.swift
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// swift-tools-version:5.8
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftOpenAPIGenerator open source project
//
// Copyright (c) 2023 Apple Inc. and the SwiftOpenAPIGenerator project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftOpenAPIGenerator project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import PackageDescription
let package = Package(
name: "swift-openapi-generator",
platforms: [
.macOS(.v13)
],
products: [
.executable(name: "swift-openapi-generator", targets: ["swift-openapi-generator"]),
.plugin(name: "OpenAPIGenerator", targets: ["OpenAPIGenerator"]),
.library(name: "_OpenAPIGeneratorCore", targets: ["_OpenAPIGeneratorCore"]),
],
dependencies: [
// Generate Swift code
.package(
url: "https://github.com/apple/swift-syntax.git",
from: "508.0.1"
),
// Format Swift code
.package(
url: "https://github.com/apple/swift-format.git",
from: "508.0.1"
),
// General algorithms
.package(
url: "https://github.com/apple/swift-algorithms",
from: "1.0.0"
),
// Read OpenAPI documents
.package(
url: "https://github.com/mattpolzin/OpenAPIKit.git",
exact: "3.0.0-alpha.6"
),
.package(
url: "https://github.com/jpsim/Yams.git",
from: "4.0.0"
),
// CLI Tool
.package(
url: "https://github.com/apple/swift-argument-parser.git",
from: "1.0.1"
),
// Tests-only: Runtime library linked by generated code
.package(url: "https://github.com/apple/swift-openapi-runtime", .upToNextMinor(from: "0.1.1")),
// Build and preview docs
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
],
targets: [
// Generator Core
.target(
name: "_OpenAPIGeneratorCore",
dependencies: [
.product(name: "OpenAPIKit30", package: "OpenAPIKit"),
.product(name: "Algorithms", package: "swift-algorithms"),
.product(name: "Yams", package: "Yams"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
.product(name: "SwiftFormat", package: "swift-format"),
.product(name: "SwiftFormatConfiguration", package: "swift-format"),
]
),
// Generator Core Tests
.testTarget(
name: "OpenAPIGeneratorCoreTests",
dependencies: [
"_OpenAPIGeneratorCore",
]
),
// GeneratorReferenceTests
.testTarget(
name: "OpenAPIGeneratorReferenceTests",
dependencies: [
"_OpenAPIGeneratorCore",
.product(name: "SwiftFormat", package: "swift-format"),
.product(name: "SwiftFormatConfiguration", package: "swift-format"),
],
resources: [
.copy("Resources"),
]
),
// PetstoreConsumerTests
// Builds and tests the reference code from GeneratorReferenceTests
// to ensure it actually works correctly at runtime.
.testTarget(
name: "PetstoreConsumerTests",
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
]
),
// Generator CLI
.executableTarget(
name: "swift-openapi-generator",
dependencies: [
"_OpenAPIGeneratorCore",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
// Build Plugin
.plugin(
name: "OpenAPIGenerator",
capability: .buildTool(),
dependencies: [
"swift-openapi-generator",
]
),
]
)