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

[SR-12830] Packages with a dot in their repo URL can't be depended on in Swift 5.2 #4546

Open
swift-ci opened this issue May 18, 2020 · 0 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-12830
Radar None
Original Reporter BalestraPatrick (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 0228638d59c746fbca2ae4455d878519

Issue Description:

I can't get the Mobius package from https://github.com/spotify/Mobius.swift to work correctly as a dependency. I have attached an example SPM package that has it as a dependency. The repo name is "Mobius.swift" but the Package.swift has name "Mobius".

let package = Package(
    name: "Test",
    products: [
        .executable(name: "test", targets: ["TestApp"])
    ],
    dependencies: [
        .package(url: "https://github.com/spotify/Mobius.swift.git", .branch("master"))
    ],
    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 which this package depends on.
        .target(
            name: "Test",
            dependencies: [
                .product(name: "MobiusCore", package: "Mobius"),
                .product(name: "MobiusExtras", package: "Mobius")
            ]
        ),
        .target(
            name: "TestApp",
            dependencies: ["Test"]
        )
    ]
)

Running `swift package update` fails with:

/Users/patrickb/Desktop/test: error: unknown package 'Mobius' in dependencies of target 'Test'

So I tried changing the name to be "Mobius.swift".

Running `swift package update` succeeds but `swift package generate-xcodeproj` fails with:

'Test' /Users/patrickb/Desktop/test: error: product dependency 'MobiusCore' in package 'Mobius.swift' not found
'Test' /Users/patrickb/Desktop/test: error: product dependency 'MobiusExtras' in package 'Mobius.swift' not found
warning: dependency 'Mobius' is not used by any target

It seems like SPM is correctly using `Mobius` as the name of the dependency in the `update` step but in `generate-xcodeproj` it gets a different name. Is it possible due to the fact that the repo name has a dot in it but the module name is different? This used to work before introducing the new syntax `.product(name: "MobiusExtras", package: "Mobius")` for specifying dependencies.

Changing the Package name to be `Mobius.swift` fixes the issue, but this is a breaking change for us and not something we want to do (https://github.com/spotify/Mobius.swift/compare/swift-5.2).

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants