I'm trying to migrate a CocoaPod to SPM. It should be very simple, but for some reason I keep getting the error "Failed to parse manifest file".
The repo with the library an be found here: https://github.com/agcoesbenr/RBSManager/tree/swift-package-manager
// swift-tools-version:5.1
import PackageDescription
let package = Package(
name: "RBSManager",
platforms: [
.iOS(.v10),
],
products: [
.library(
name: "RBSManager",
targets: ["RBSManager"])
],
dependencies: [
.package(url: "https://github.com/daltoniam/Starscream.git", from: "3.1.1"),
.package(url: "https://github.com/tristanhimmelman/ObjectMapper.git", from: "4.2")
],
targets: [
.target(
name: "RBSManager",
dependencies: ["Starscream", "ObjectMapper"],
path: "./RBSManager/Classes")
]
)
CodePudding user response:
I don't know from where you got only your error message, but it's incomplete. In Terminal.app, if you do $> swift build
, you'll get this error:
$>swift build
/[...]/RBSManager-swift-package-manager: error: manifest parse error(s):
/[...]/RBSManager-swift-package-manager/Package.swift:21:39: error: expected ',' separator
path: "RBSManager/Classes"
^
,
/Users/armel/Downloads/RBSManager-swift-package-manager/Package.swift:22:13: error: argument 'dependencies' must precede argument 'path'
dependencies: []),
So a possible fix, would be:
targets: [
.target(
name: "RBSManager",
dependencies: [],
path: "RBSManager",
sources: ["Classes"])
]
Then, you'll have another error:
error: manifest parse error(s):
Invalid semantic version string '4.2'
So 4.2.0
for ObjectMapper
as it is in fact in the repo.
I didn't fully check if the files where correctly added to the package, but it's more to explain how you could debug your issue and fix it. sources
/path
values I set might not be the correct one, I'll let you debug that part if needed.