Defined the products, dependencies, and targets in the Package file.

This commit is contained in:
2025-10-02 17:05:58 +02:00
parent 5bc14377fb
commit 400a035ca1
3 changed files with 40 additions and 12 deletions
+40 -12
View File
@@ -1,26 +1,54 @@
// swift-tools-version: 6.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swift-tools-version: 5.10
import PackageDescription
let package = Package(
name: "marvel-service",
name: MarvelService.package,
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.visionOS(.v1),
.watchOS(.v6)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "marvel-service",
targets: ["marvel-service"]
),
name: MarvelService.package,
targets: [MarvelService.target]
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-openapi-generator.git", from: "1.3.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.2"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "marvel-service"
name: MarvelService.target,
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession")
],
path: "Sources/MarvelService",
plugins: [
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator")
]
),
.testTarget(
name: "marvel-serviceTests",
dependencies: ["marvel-service"]
name: MarvelService.test,
dependencies: [
.byName(name: MarvelService.target)
],
path: "Tests/MarvelService"
),
]
)
// MARK: - Constants
enum MarvelService {
static let package = "marvel-service"
static let target = "AmiiboMarvelService"
static let test = "\(MarvelService.target)Tests"
}