70 lines
2.9 KiB
Swift
70 lines
2.9 KiB
Swift
// swift-tools-version:5.5
|
|
import PackageDescription
|
|
|
|
#if os(macOS)
|
|
private let addCryptoSwift = false
|
|
private let staticSwiftSyntax = true
|
|
#else
|
|
private let addCryptoSwift = true
|
|
private let staticSwiftSyntax = false
|
|
#endif
|
|
|
|
let frameworkDependencies: [Target.Dependency] = [
|
|
.product(name: "SourceKittenFramework", package: "SourceKitten"),
|
|
.product(name: "SwiftSyntax", package: "SwiftSyntax"),
|
|
.product(name: "SwiftSyntaxBuilder", package: "SwiftSyntax"),
|
|
.product(name: "SwiftSyntaxParser", package: "SwiftSyntax"),
|
|
"Yams",
|
|
]
|
|
+ (addCryptoSwift ? ["CryptoSwift"] : [])
|
|
+ (staticSwiftSyntax ? ["lib_InternalSwiftSyntaxParser"] : [])
|
|
|
|
let package = Package(
|
|
name: "SwiftLint",
|
|
platforms: [.macOS(.v12)],
|
|
products: [
|
|
.executable(name: "swiftlint", targets: ["swiftlint"]),
|
|
.library(name: "SwiftLintFramework", targets: ["SwiftLintFramework"])
|
|
],
|
|
dependencies: [
|
|
.package(name: "swift-argument-parser", url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.1.3")),
|
|
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .exact("0.50700.0")),
|
|
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.33.0"),
|
|
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.1"),
|
|
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
|
.package(url: "https://github.com/JohnSundell/CollectionConcurrencyKit.git", from: "0.2.0")
|
|
] + (addCryptoSwift ? [.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.5.1"))] : []),
|
|
targets: [
|
|
.executableTarget(
|
|
name: "swiftlint",
|
|
dependencies: [
|
|
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
|
"CollectionConcurrencyKit",
|
|
"SwiftLintFramework",
|
|
"SwiftyTextTable",
|
|
]
|
|
),
|
|
.target(
|
|
name: "SwiftLintFramework",
|
|
dependencies: frameworkDependencies,
|
|
// Pass `-dead_strip_dylibs` to ignore the dynamic version of `lib_InternalSwiftSyntaxParser`
|
|
// that ships with SwiftSyntax because we want the static version from
|
|
// `StaticInternalSwiftSyntaxParser`.
|
|
linkerSettings: staticSwiftSyntax ? [.unsafeFlags(["-Xlinker", "-dead_strip_dylibs"])] : []
|
|
),
|
|
.testTarget(
|
|
name: "SwiftLintFrameworkTests",
|
|
dependencies: [
|
|
"SwiftLintFramework"
|
|
],
|
|
exclude: [
|
|
"Resources",
|
|
]
|
|
),
|
|
] + (staticSwiftSyntax ? [.binaryTarget(
|
|
name: "lib_InternalSwiftSyntaxParser",
|
|
url: "https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/download/5.7/lib_InternalSwiftSyntaxParser.xcframework.zip",
|
|
checksum: "99803975d10b2664fc37cc223a39b4e37fe3c79d3d6a2c44432007206d49db15"
|
|
)] : [])
|
|
)
|