|
| 1 | +// swift-tools-version:5.5 |
| 2 | +//===----------------------------------------------------------------------===// |
| 3 | +// |
| 4 | +// This source file is part of the AsyncHTTPClient open source project |
| 5 | +// |
| 6 | +// Copyright (c) 2018-2022 Apple Inc. and the AsyncHTTPClient project authors |
| 7 | +// Licensed under Apache License v2.0 |
| 8 | +// |
| 9 | +// See LICENSE.txt for license information |
| 10 | +// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors |
| 11 | +// |
| 12 | +// SPDX-License-Identifier: Apache-2.0 |
| 13 | +// |
| 14 | +//===----------------------------------------------------------------------===// |
| 15 | + |
| 16 | +import PackageDescription |
| 17 | + |
| 18 | +let package = Package( |
| 19 | + name: "async-http-client-examples", |
| 20 | + platforms: [ |
| 21 | + .macOS(.v10_15), |
| 22 | + .iOS(.v13), |
| 23 | + .tvOS(.v13), |
| 24 | + .watchOS(.v6), |
| 25 | + ], |
| 26 | + products: [ |
| 27 | + .executable(name: "GetHTML", targets: ["GetHTML"]), |
| 28 | + .executable(name: "GetJSON", targets: ["GetJSON"]), |
| 29 | + .executable(name: "StreamingByteCounter", targets: ["StreamingByteCounter"]), |
| 30 | + ], |
| 31 | + dependencies: [ |
| 32 | + .package(url: "https://github.com/apple/swift-nio.git", .branch("main")), |
| 33 | + |
| 34 | + // in real-world projects this would be |
| 35 | + // .package(url: "https://github.com/swift-server/async-http-client.git", from: "1.9.0") |
| 36 | + .package(name: "async-http-client", path: "../"), |
| 37 | + ], |
| 38 | + targets: [ |
| 39 | + // MARK: - Examples |
| 40 | + |
| 41 | + .executableTarget( |
| 42 | + name: "GetHTML", |
| 43 | + dependencies: [ |
| 44 | + .product(name: "AsyncHTTPClient", package: "async-http-client"), |
| 45 | + .product(name: "NIOCore", package: "swift-nio"), |
| 46 | + ], path: "GetHTML" |
| 47 | + ), |
| 48 | + .executableTarget( |
| 49 | + name: "GetJSON", |
| 50 | + dependencies: [ |
| 51 | + .product(name: "AsyncHTTPClient", package: "async-http-client"), |
| 52 | + .product(name: "NIOCore", package: "swift-nio"), |
| 53 | + .product(name: "NIOFoundationCompat", package: "swift-nio"), |
| 54 | + ], path: "GetJSON" |
| 55 | + ), |
| 56 | + .executableTarget( |
| 57 | + name: "StreamingByteCounter", |
| 58 | + dependencies: [ |
| 59 | + .product(name: "AsyncHTTPClient", package: "async-http-client"), |
| 60 | + .product(name: "NIOCore", package: "swift-nio"), |
| 61 | + ], path: "StreamingByteCounter" |
| 62 | + ), |
| 63 | + ] |
| 64 | +) |
0 commit comments