ATProto for TCA applications in Swift
1// swift-tools-version: 6.3
2// The swift-tools-version declares the minimum version of Swift required to build this package.
3
4import PackageDescription
5
6let package = Package(
7 name: "tcatproto",
8 platforms: [
9 .iOS(.v17),
10 .macOS(.v14)
11 ],
12 products: [
13 // Products define the executables and libraries a package produces, making them visible to other packages.
14 .library(
15 name: "ATProto",
16 targets: ["ATProto"]
17 ),
18
19 .library(name: "DNSResolverClient", targets: ["DNSResolverClient"]),
20 .library(name: "XRPCClient", targets: ["XRPCClient"]),
21 .library(name: "ATProtoOAuth", targets: ["ATProtoOAuth"]),
22 .library(name: "ATProtoServer", targets: ["ATProtoServer"]),
23
24 .library(name: "TCATProtoAuthentication", targets: ["TCATProtoAuthentication"]),
25 .library(name: "ComposableAtmosphereAuthentication", targets: ["ComposableAtmosphereAuthentication"]),
26 ],
27 traits: [
28 .trait(
29 name: "TCA26",
30 description: "Enables TCA 2.6 (ComposableArchitecture2) integration"
31 ),
32 .trait(
33 name: "TCA1OAuth",
34 description: "Enables TCA 1.0 OAuth integration"
35 ),
36 ],
37 dependencies: [
38 .package(url: "https://github.com/apple/swift-async-dns-resolver", from: "0.5.0"),
39 .package(url: "https://github.com/apple/swift-crypto", from: "3.0.0"),
40
41 .package(url: "https://github.com/pointfreeco/swift-tagged.git", .upToNextMajor(from: "0.10.0")),
42 .package(url: "https://github.com/pointfreeco/swift-sharing", .upToNextMajor(from: "2.0.0")),
43 .package(url: "https://github.com/pointfreeco/swift-dependencies", branch: "26"),
44
45 .package(url: "https://github.com/pointfreeco/TCA26", branch: "main"),
46
47 .package(url: "https://tangled.org/woody.fm/swift-dependencies-http-client", branch: "main"),
48
49 .package(url: "https://tangled.org/woody.fm/swift-urlqueryitem-coder", branch: "main"),
50 .package(url: "https://tangled.org/woody.fm/swift-tagged-types-macro", branch: "main"),
51
52
53 ],
54 targets: [
55 // Targets are the basic building blocks of a package, defining a module or a test suite.
56 // Targets can depend on other targets in this package and products from dependencies.
57 .target(
58 name: "ATProto",
59 dependencies: [
60 .product(name: "TaggedTypesMacro", package: "swift-tagged-types-macro"),
61 .product(name: "Dependencies", package: "swift-dependencies"),
62 .product(name: "DependenciesMacros", package: "swift-dependencies"),
63
64 .product(name: "HTTPClient", package: "swift-dependencies-http-client"),
65
66 "DNSResolverClient"
67 ]
68 ),
69
70 .target(
71 name: "DNSResolverClient",
72 dependencies: [
73 .product(name: "Dependencies", package: "swift-dependencies"),
74 .product(name: "DependenciesMacros", package: "swift-dependencies"),
75
76 .product(
77 name: "AsyncDNSResolver",
78 package: "swift-async-dns-resolver",
79 condition: .when(platforms: [.iOS, .macOS, .tvOS, .watchOS, .visionOS])
80 ),
81 ]
82 ),
83
84 .target(
85 name: "XRPCClient",
86 dependencies: [
87 "ATProto",
88 .product(name: "HTTPClient", package: "swift-dependencies-http-client"),
89
90 .product(name: "Tagged", package: "swift-tagged"),
91 .product(name: "Dependencies", package: "swift-dependencies"),
92 .product(name: "DependenciesMacros", package: "swift-dependencies"),
93 .product(name: "URLQueryItemCoder", package: "swift-urlqueryitem-coder"),
94 ]
95 ),
96
97 .target(
98 name: "ATProtoServer",
99 dependencies: [
100 "ATProto",
101 "XRPCClient",
102 "ATProtoOAuth",
103 ]
104 ),
105
106 .target(
107 name: "ATProtoOAuth",
108 dependencies: [
109 "ATProto",
110 "XRPCClient",
111 .product(name: "HTTPClient", package: "swift-dependencies-http-client"),
112 .product(name: "Dependencies", package: "swift-dependencies"),
113 .product(name: "Sharing", package: "swift-sharing"),
114 .product(name: "DependenciesMacros", package: "swift-dependencies"),
115 .product(name: "TaggedTypesMacro", package: "swift-tagged-types-macro"),
116 .product(
117 name: "Crypto",
118 package: "swift-crypto",
119 condition: .when(platforms: [.android, .linux, .windows, .wasi, .openbsd])
120 ),
121 ]
122 ),
123 .target(
124 name: "TCATProtoAuthentication",
125 dependencies: [
126 "ATProtoOAuth",
127 .product(name: "Sharing", package: "swift-sharing"),
128 .product(name: "ComposableArchitecture2", package: "TCA26"),
129 ]
130 ),
131 .target(
132 name: "ComposableAtmosphereAuthentication",
133 dependencies: [
134 "ATProtoOAuth",
135 ]
136 ),
137
138 .testTarget(
139 name: "ATProtoTests",
140 dependencies: [
141 "ATProto",
142 .product(name: "DependenciesTestSupport", package: "swift-dependencies"),
143 ]
144 ),
145
146 .testTarget(
147 name: "ATProtoOAuthTests",
148 dependencies: [
149 "ATProtoOAuth",
150 .product(name: "DependenciesTestSupport", package: "swift-dependencies"),
151
152 ]
153 ),
154 .testTarget(
155 name: "XRPCClientTests",
156 dependencies: [
157 "XRPCClient",
158 .product(name: "DependenciesTestSupport", package: "swift-dependencies"),
159
160 ]
161 ),
162 .testTarget(
163 name: "TCATProtoAuthenticationTests",
164 dependencies: [
165 "TCATProtoAuthentication",
166 "ATProtoOAuth",
167 .product(name: "HTTPClient", package: "swift-dependencies-http-client"),
168 .product(name: "DependenciesTestSupport", package: "swift-dependencies"),
169 .product(name: "ComposableArchitecture2", package: "TCA26"),
170 ]
171 ),
172 ]
173)