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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
// swift-tools-version:5.9
/*
This source file is part of the Swift.org open source project
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/
import PackageDescription
import class Foundation.ProcessInfo
let swiftSettings: [SwiftSetting] = [
.unsafeFlags(["-Xfrontend", "-warn-long-expression-type-checking=1000"], .when(configuration: .debug)),
]
let package = Package(
name: "SwiftDocC",
platforms: [
.macOS(.v10_15),
.iOS(.v13)
],
products: [
.library(
name: "SwiftDocC",
targets: ["SwiftDocC"]
),
.library(
name: "SwiftDocCUtilities",
targets: ["SwiftDocCUtilities"]
),
.executable(
name: "docc",
targets: ["docc"]
)
],
targets: [
// SwiftDocC library
.target(
name: "SwiftDocC",
dependencies: [
.product(name: "Markdown", package: "swift-markdown"),
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
.product(name: "CLMDB", package: "swift-lmdb"),
.product(name: "Crypto", package: "swift-crypto"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "SwiftDocCTests",
dependencies: [
.target(name: "SwiftDocC"),
.target(name: "SwiftDocCTestUtilities"),
],
resources: [
.copy("Test Resources"),
.copy("Test Bundles"),
.copy("Converter/Converter Fixtures"),
.copy("Rendering/Rendering Fixtures"),
],
swiftSettings: swiftSettings
),
// Command-line tool library
.target(
name: "SwiftDocCUtilities",
dependencies: [
.target(name: "SwiftDocC"),
.product(name: "NIOHTTP1", package: "swift-nio", condition: .when(platforms: [.macOS, .iOS, .linux, .android])),
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
swiftSettings: swiftSettings
),
.testTarget(
name: "SwiftDocCUtilitiesTests",
dependencies: [
.target(name: "SwiftDocCUtilities"),
.target(name: "SwiftDocC"),
.target(name: "SwiftDocCTestUtilities"),
],
resources: [
.copy("Test Resources"),
.copy("Test Bundles"),
],
swiftSettings: swiftSettings
),
// Test utility library
.target(
name: "SwiftDocCTestUtilities",
dependencies: [
.target(name: "SwiftDocC"),
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
],
swiftSettings: swiftSettings
),
// Command-line tool
.executableTarget(
name: "docc",
dependencies: [
.target(name: "SwiftDocCUtilities"),
],
swiftSettings: swiftSettings
),
// Test app for SwiftDocCUtilities
.executableTarget(
name: "signal-test-app",
dependencies: [
.target(name: "SwiftDocCUtilities"),
],
path: "Tests/signal-test-app",
swiftSettings: swiftSettings
),
.executableTarget(
name: "generate-symbol-graph",
dependencies: [
.target(name: "SwiftDocC"),
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
],
swiftSettings: swiftSettings
),
]
)
// If the `SWIFTCI_USE_LOCAL_DEPS` environment variable is set,
// we're building in the Swift.org CI system alongside other projects in the Swift toolchain and
// we can depend on local versions of our dependencies instead of fetching them remotely.
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
// Building standalone, so fetch all dependencies remotely.
package.dependencies += [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.53.0"),
.package(url: "https://github.com/apple/swift-markdown.git", branch: "release/6.0"),
.package(url: "https://github.com/apple/swift-lmdb.git", branch: "release/6.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
.package(url: "https://github.com/apple/swift-docc-symbolkit", branch: "release/6.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "2.5.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.2.0"),
]
} else {
// Building in the Swift.org CI system, so rely on local versions of dependencies.
package.dependencies += [
.package(path: "../swift-nio"),
.package(path: "../swift-markdown"),
.package(path: "../swift-lmdb"),
.package(path: "../swift-argument-parser"),
.package(path: "../swift-docc-symbolkit"),
.package(path: "../swift-crypto"),
]
}
|