Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wooster opened this issue Oct 23, 2024 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@wooster
Copy link

wooster commented Oct 23, 2024

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
Copy link
Author

wooster commented Oct 23, 2024

Fix would be to tag the versions without the "v" prefix.

@atiorh
Copy link
Contributor

atiorh commented Oct 23, 2024

@wooster It should work if you drop the v:

.package(url: "https://github.com/argmaxinc/WhisperKit", from: "0.9.0")

@atiorh
Copy link
Contributor

atiorh commented Oct 23, 2024

Thanks for the feedback! We will document this in the README since the tag has v but SPM expects it to be dropped which is implicit knowledge.

@wooster
Copy link
Author

wooster commented Oct 23, 2024

Great, thanks.

@ZachNagengast ZachNagengast added the documentation Improvements or additions to documentation label Oct 23, 2024
@ZachNagengast ZachNagengast self-assigned this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants