WhisperKit icon indicating copy to clipboard operation
WhisperKit copied to clipboard

"Invalid semantic version string" when referencing version tag in SPM package

Open wooster opened this issue 4 months ago • 4 comments

When referencing WhisperKit from a SPM package as a dependency, it does not recognize the "v" prefixed version as a version string (for both from and exact). The error in Xcode is "Invalid semantic version string 'v0.9.0'".

It seems SPM doesn't recognize the "v" prefix from semantic versioning in this case.

Similarly, from the command line:

% swift build
error: 'mylibrary': invalid manifest (evaluation failed)
Invalid semantic version string 'v0.9.0'
error: 'mylibrary': invalid manifest (evaluation failed)
Invalid semantic version string 'v0.9.0'

The Package.swift file:

// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "MyLibrary",
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "MyLibrary",
            targets: ["MyLibrary"]),
    ],
    dependencies: [
        .package(url: "https://github.com/argmaxinc/WhisperKit", from: "v0.9.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: "MyLibrary",
            dependencies: [
                .product(name: "WhisperKit", package: "WhisperKit")
            ]
        ),
        .testTarget(
            name: "MyLibraryTests",
            dependencies: ["MyLibrary"]
        ),
    ]
)

wooster avatar Oct 23 '24 00:10 wooster