122 lines
3.8 KiB
Swift
122 lines
3.8 KiB
Swift
// swift-tools-version: 6.0
|
|
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "swift-cli-version",
|
|
platforms: [
|
|
.macOS(.v13)
|
|
],
|
|
products: [
|
|
.library(name: "CliClient", targets: ["CliClient"]),
|
|
.library(name: "ConfigurationClient", targets: ["ConfigurationClient"]),
|
|
.library(name: "FileClient", targets: ["FileClient"]),
|
|
.library(name: "GitClient", targets: ["GitClient"]),
|
|
.plugin(name: "BuildWithVersionPlugin", targets: ["BuildWithVersionPlugin"]),
|
|
.plugin(name: "GenerateVersionPlugin", targets: ["GenerateVersionPlugin"]),
|
|
.plugin(name: "UpdateVersionPlugin", targets: ["UpdateVersionPlugin"])
|
|
],
|
|
dependencies: [
|
|
.package(url: "https://github.com/pointfreeco/swift-dependencies.git", from: "1.6.2"),
|
|
.package(url: "https://github.com/m-housh/swift-shell-client.git", from: "0.2.2"),
|
|
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"),
|
|
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"),
|
|
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.2"),
|
|
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "1.3.3")
|
|
],
|
|
targets: [
|
|
.executableTarget(
|
|
name: "cli-version",
|
|
dependencies: [
|
|
"CliClient",
|
|
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
|
.product(name: "CustomDump", package: "swift-custom-dump")
|
|
]
|
|
),
|
|
.target(
|
|
name: "CliClient",
|
|
dependencies: [
|
|
"ConfigurationClient",
|
|
"FileClient",
|
|
"GitClient",
|
|
.product(name: "Logging", package: "swift-log")
|
|
]
|
|
),
|
|
.testTarget(
|
|
name: "CliVersionTests",
|
|
dependencies: ["CliClient", "TestSupport"]
|
|
),
|
|
.target(
|
|
name: "ConfigurationClient",
|
|
dependencies: [
|
|
"FileClient",
|
|
.product(name: "CustomDump", package: "swift-custom-dump"),
|
|
.product(name: "Dependencies", package: "swift-dependencies"),
|
|
.product(name: "DependenciesMacros", package: "swift-dependencies")
|
|
]
|
|
),
|
|
.testTarget(
|
|
name: "ConfigurationClientTests",
|
|
dependencies: ["ConfigurationClient", "TestSupport"]
|
|
),
|
|
.target(
|
|
name: "FileClient",
|
|
dependencies: [
|
|
.product(name: "Dependencies", package: "swift-dependencies"),
|
|
.product(name: "DependenciesMacros", package: "swift-dependencies")
|
|
]
|
|
),
|
|
.target(
|
|
name: "GitClient",
|
|
dependencies: [
|
|
"FileClient",
|
|
.product(name: "Dependencies", package: "swift-dependencies"),
|
|
.product(name: "DependenciesMacros", package: "swift-dependencies"),
|
|
.product(name: "ShellClient", package: "swift-shell-client")
|
|
]
|
|
),
|
|
.testTarget(
|
|
name: "GitClientTests",
|
|
dependencies: ["GitClient"]
|
|
),
|
|
.target(name: "TestSupport"),
|
|
.plugin(
|
|
name: "BuildWithVersionPlugin",
|
|
capability: .buildTool(),
|
|
dependencies: [
|
|
"cli-version"
|
|
]
|
|
),
|
|
.plugin(
|
|
name: "GenerateVersionPlugin",
|
|
capability: .command(
|
|
intent: .custom(
|
|
verb: "generate-version",
|
|
description: "Generates a version file in the given target."
|
|
),
|
|
permissions: [
|
|
.writeToPackageDirectory(reason: "Generate a version file in the target's directory.")
|
|
]
|
|
),
|
|
dependencies: [
|
|
"cli-version"
|
|
]
|
|
),
|
|
.plugin(
|
|
name: "UpdateVersionPlugin",
|
|
capability: .command(
|
|
intent: .custom(
|
|
verb: "update-version",
|
|
description: "Updates a version file in the given target."
|
|
),
|
|
permissions: [
|
|
.writeToPackageDirectory(reason: "Update a version file in the target's directory.")
|
|
]
|
|
),
|
|
dependencies: [
|
|
"cli-version"
|
|
]
|
|
)
|
|
]
|
|
)
|