Skip to content

Commit da4460c

Browse files
authored
Merge pull request #35 from sidepelican/transport
Use macro for Server Side Swift code
2 parents 9df1c96 + 6a88485 commit da4460c

39 files changed

+656
-984
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ on:
99

1010
jobs:
1111
build_and_test:
12-
runs-on: ubuntu-latest
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
1316
defaults:
1417
run:
1518
working-directory: example
1619
steps:
17-
- uses: swift-actions/setup-swift@v1
18-
- uses: actions/setup-node@v3
19-
with:
20-
node-version: 20
21-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2221
- run: npm ci
2322
working-directory: example/TSClient
2423
- run: ./test.sh vapor

Package.resolved

Lines changed: 241 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,70 @@
1-
// swift-tools-version: 5.9
1+
// swift-tools-version: 5.10
22

3+
import CompilerPluginSupport
34
import PackageDescription
45

56
let package = Package(
67
name: "CallableKit",
7-
platforms: [.macOS(.v13)],
8+
platforms: [.macOS(.v14)],
89
products: [
910
.executable(name: "codegen", targets: ["Codegen"]),
1011
.library(name: "CallableKit", targets: ["CallableKit"]),
12+
.library(name: "CallableKitVaporTransport", targets: ["CallableKitVaporTransport"]),
13+
.library(name: "CallableKitHummingbirdTransport", targets: ["CallableKitHummingbirdTransport"]),
1114
],
1215
dependencies: [
1316
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.2"),
14-
.package(url: "https://github.com/omochi/CodableToTypeScript", from: "2.11.0"),
15-
.package(url: "https://github.com/omochi/SwiftTypeReader", from: "2.8.0"),
17+
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.1"),
18+
.package(url: "https://github.com/omochi/CodableToTypeScript.git", from: "2.11.0"),
19+
.package(url: "https://github.com/omochi/SwiftTypeReader.git", from: "2.8.0"),
20+
.package(url: "https://github.com/vapor/vapor.git", from: "4.106.7"),
21+
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.5.0"),
1622
],
1723
targets: [
1824
.executableTarget(
1925
name: "Codegen",
2026
dependencies: [
2127
.product(name: "ArgumentParser", package: "swift-argument-parser"),
22-
"CallableKit"
28+
"CodegenImpl",
2329
]
2430
),
2531
.target(
26-
name: "CallableKit",
32+
name: "CodegenImpl",
2733
dependencies: [
2834
"CodableToTypeScript",
29-
"SwiftTypeReader"
35+
"SwiftTypeReader",
3036
],
3137
swiftSettings: [
3238
.enableUpcomingFeature("BareSlashRegexLiterals"),
3339
]
40+
),
41+
.target(
42+
name: "CallableKit",
43+
dependencies: [
44+
"CallableKitMacros",
45+
]
46+
),
47+
.macro(
48+
name: "CallableKitMacros",
49+
dependencies: [
50+
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
51+
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
52+
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
53+
]
54+
),
55+
.target(
56+
name: "CallableKitVaporTransport",
57+
dependencies: [
58+
.product(name: "Vapor", package: "vapor"),
59+
"CallableKit",
60+
]
61+
),
62+
.target(
63+
name: "CallableKitHummingbirdTransport",
64+
dependencies: [
65+
.product(name: "Hummingbird", package: "hummingbird"),
66+
"CallableKit",
67+
]
3468
)
3569
]
3670
)

0 commit comments

Comments
 (0)