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-13813] The Platform struct in PackageDescription should be Equatable #4479

Closed
swift-ci opened this issue Nov 3, 2020 · 3 comments
Closed
Assignees

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Nov 3, 2020

Previous ID SR-13813
Radar rdar://problem/70999132
Original Reporter broadway_lamb (JIRA User)
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Improvement
Assignee @MaxDesiatov
Priority Medium

md5: 8924d79e885f93b683c0f26b81c074b5

Issue Description:

In my project, I want to only build an SPM target when the platform I'm building for is not .wasi. For that, I've wrote the following code:

// This list should be updated whenever SwiftPM adds support for a new platform.
let supportedPlatforms: [Platform] = [
    .macOS,
    .iOS,
    .watchOS,
    .tvOS,
    .linux,
    .android,
    .windows,
    .wasi,
]

extension Array where Element: Equatable {
    func except(_ exceptions: [Element]) -> [Element] {
        return filter { platform in
            !exceptions.contains(platform)
        }
    }
}

I expected that I could write:

.target(name: "WASIIncompatibleTarget",
        condition: .when(platforms: supportedPlatforms.except([.wasi])))

However, that didn't work because Platform is not Equatable. I see no reason why it shouldn't conform to that protocol, and propose that we fix it.

@typesanitizer
Copy link

@swift-ci create

@MaxDesiatov
Copy link
Member

Resolved in #3018

@MaxDesiatov
Copy link
Member

This was merged and should appear in some future development snapshot.

@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
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants