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-13761] Swift Package Manager requires macOS version from Linux only dependency #4484

Open
adam-fowler opened this issue Oct 21, 2020 · 4 comments
Labels

Comments

@adam-fowler
Copy link

Previous ID SR-13761
Radar rdar://problem/70543422
Original Reporter @adam-fowler
Type Bug
Environment

Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
Target: x86_64-apple-darwin19.6.0

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

md5: 7f4e55b02e396816b5cbe9a36104fbea

Issue Description:

If a swift package includes a dependency that has a condition to be Linux only the platform requirements of that dependent package are still applied to other platforms.

The following Package.swift contains a dependency on apple/swift-crypto but only for Linux.

// swift-tools-version:5.3

import PackageDescription

let package = Package(
    name: "swift-5.3-deps",
    products: [
        .library(name: "swift-5.3-deps", targets: ["swift-5.3-deps"]),
    ],
    dependencies: [
        .package(url: "https://github.com/apple/swift-crypto.git", from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "swift-5.3-deps",
            dependencies: [.product(name: "Crypto", package: "swift-crypto", condition: .when(platforms: [.linux]))]),
    ]
)

When I run `swift build` I get the following error even though I am not linking swift-crypto into the macOS version of my library.

error: the library 'swift-5.3-deps' requires macos 10.10, but depends on the product 'Crypto' which requires macos 10.15; consider changing the library 'swift-5.3-deps' to require macos 10.15 or later, or the product 'Crypto' to require macos 10.10 or earlier.
@typesanitizer
Copy link

@swift-ci create

@neonichu
Copy link
Member

This could be a quirk of the fact that the dependency is still present and not conditional, plus the fact that the minimum deployment target is a package-level property. But needs more investigation.

@adam-fowler
Copy link
Author

Interestingly Xcode doesn't complain about this.

@adam-fowler
Copy link
Author

Do you think this is something that is going to be resolved soon? I was hoping to replace an if statement at the end of my Package.swift https://github.com/soto-project/soto-core/blob/main/Package.swift with the new .when(platforms: [.linux]) before doing a new major release of Soto. But this issue means I can't.

@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

4 participants