|
| 1 | +// swift-tools-version:5.5 |
| 2 | +/* |
| 3 | + This source file is part of the Swift.org open source project |
| 4 | + |
| 5 | + Copyright (c) 2021 Apple Inc. and the Swift project authors |
| 6 | + Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | + |
| 8 | + See https://swift.org/LICENSE.txt for license information |
| 9 | + See https://swift.org/CONTRIBUTORS.txt for Swift project authors |
| 10 | +*/ |
| 11 | + |
| 12 | +import PackageDescription |
| 13 | +import class Foundation.ProcessInfo |
| 14 | + |
| 15 | +let package = Package( |
| 16 | + name: "swift-markdown", |
| 17 | + products: [ |
| 18 | + .library( |
| 19 | + name: "Markdown", |
| 20 | + targets: ["Markdown"]), |
| 21 | + .executable( |
| 22 | + name: "markdown-tool", |
| 23 | + targets: ["markdown-tool"]), |
| 24 | + ], |
| 25 | + targets: [ |
| 26 | + .target( |
| 27 | + name: "Markdown", |
| 28 | + dependencies: [ |
| 29 | + "CAtomic", |
| 30 | + .product(name: "cmark-gfm", package: "swift-cmark"), |
| 31 | + .product(name: "cmark-gfm-extensions", package: "swift-cmark"), |
| 32 | + ]), |
| 33 | + .executableTarget( |
| 34 | + name: "markdown-tool", |
| 35 | + dependencies: [ |
| 36 | + "Markdown", |
| 37 | + .product(name: "ArgumentParser", package: "swift-argument-parser"), |
| 38 | + ]), |
| 39 | + .testTarget( |
| 40 | + name: "MarkdownTests", |
| 41 | + dependencies: ["Markdown"], |
| 42 | + resources: [.copy("Visitors/Everything.md")] |
| 43 | + ), |
| 44 | + .target(name: "CAtomic"), |
| 45 | + ] |
| 46 | +) |
| 47 | + |
| 48 | +// If the `SWIFTCI_USE_LOCAL_DEPS` environment variable is set, |
| 49 | +// we're building in the Swift.org CI system alongside other projects in the Swift toolchain and |
| 50 | +// we can depend on local versions of our dependencies instead of fetching them remotely. |
| 51 | +if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { |
| 52 | + // Building standalone, so fetch all dependencies remotely. |
| 53 | + package.dependencies += [ |
| 54 | + .package(url: "https://github.com/apple/swift-cmark.git", .branch("gfm")), |
| 55 | + .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.4")), |
| 56 | + ] |
| 57 | +} else { |
| 58 | + // Building in the Swift.org CI system, so rely on local versions of dependencies. |
| 59 | + package.dependencies += [ |
| 60 | + .package(path: "../swift-cmark-gfm"), |
| 61 | + .package(path: "../swift-argument-parser"), |
| 62 | + ] |
| 63 | +} |
0 commit comments