【发布时间】:2021-09-25 11:56:54
【问题描述】:
背景:
此代码基于 Mattt 多年前编写的过时 PM 示例。
目标:我正在尝试导入工作,所以我创建了一个基本包;基于 Mattt 的 working 包。他的例子完美无缺。因此尝试从头开始重新创建。
场景:
- 我创建了一个基本包。
- 我添加了一个依赖项。
- 我在包源中添加了一个“导入
这是实际代码:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "RicPackage",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "RicPackage",
targets: ["RicPackage"]),
],
dependencies: [
.package(name: "PlayingCard", url: "https://github.com/apple/example-package-playingcard.git", from: "3.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "RicPackage",
dependencies: ["PlayingCard"]),
.testTarget(
name: "RicPackageTests",
dependencies: ["RicPackage"]),
]
)
问题:
为什么会这样?
我错过了什么?
【问题讨论】:
-
我进行了您建议的更改,并根据编译器建议将“名称”字段添加到依赖项 .package 项中。现在我在没有解释的情况下构建失败。