我正在开发一个Swift应用程序,并在其中使用我自己编写的包。一切正常,直到我尝试通过Fastlane运行测试。它抛出一个错误,说,Could not resolve package dependencies.
然而,当我从Xcode运行测试时,一切都很顺利。
如果我从xCode运行测试,它工作得很好。
我的包文件:
import PackageDescription
let package = Package(
name: "Package_Name",
platforms: [.iOS(.v17)],
products: [
.library(name: "Package_Name", targets: ["Package_Name"]),
],
dependencies: [
.package(name: "ConfigManager", path: "/Packages/ConfigManager"),
.package(name: "NetworkManager", path: "/Packages/NetworkManager"),
.package(name: "Notifications", path: "/Packages/Notifications")
],
targets: [
.target(
name: "Package_Name",
dependencies: ["ConfigManager",
"NetworkManager",
"Notifications"],
resources: [
.process("Resources")
]),
.testTarget(
name: "Package_NameTests",
dependencies: ["Package_Name",
"ConfigManager",
"NetworkManager",
"Notifications"],
resources: [
.process("Resources")
]),
]
)
字符串
fastlane错误信息:
▸ xcodebuild: error: Could not resolve package dependencies:
▸ the package at '/Packages/ConfigManager' cannot be accessed (Error Domain=NSCocoaErrorDomain Code=260 "The folder “ConfigManager” doesn’t exist." UserInfo={NSFilePath=/Packages/ConfigManager, NSUserStringVariant=(
▸ Folder
▸ ), NSUnderlyingError=0x6000007aba20 {Error Domain=NSOSStatusErrorDomain Code=-43 "fnfErr: File not found"}})
型
快速文件中的通道
lane :testPackage do
puts 'Test ' + "Package_Name"
scan(
package_path: './Packages/' + "Package_Name",
scheme: "Package_NameTests",
devices: ["iPhone 15"],
output_style: 'standard',
output_directory: './fastlane/report/' + "Package_Name" + '/',
code_coverage: true,
result_bundle: true,
fail_build: false,
clean: true,
configuration: "Debug"
)
end
型
先谢谢你了,
1条答案
按热度按时间6g8kf2rb1#
Package_Name
的依赖项被列为绝对路径。字符串
这对我来说似乎很可疑。也许你的意思是依赖项位置在当前
Package.swift
文件的子文件夹中?那就是./Packages/...
。编辑:你的评论表明这个答案是有帮助的,并且让你走上了正确的道路。听起来,在你的例子中,依赖包位于工作目录
../ConfigManager
,../NetworkManager
和../Notifications
的上一个目录。