Skip to content

Allow empty build settings arrays #2880

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

Merged

Conversation

keith
Copy link
Member

@keith keith commented Aug 19, 2020

In this case:

let linkerSettings: [LinkerSetting]
if ProcessInfo.processInfo.environment["SOMETHING"] == nil {
    linkerSettings = []
} else {
    linkerSettings = [
        .unsafeFlags(["something"]),
    ]
}

// pass linkerSettings to a .target below

It's useful to be able to pass empty lists here.

In this case:

```swift
let linkerSettings: [LinkerSetting]
if ProcessInfo.processInfo.environment["SOMETHING"] == nil {
    linkerSettings = []
} else {
    linkerSettings = [
        .unsafeFlags(["something"]),
    ]
}

// pass linkerSettings to a .target below
```

It's useful to be able to pass empty lists here.
@keith
Copy link
Member Author

keith commented Aug 19, 2020

Submitting for discussion, I haven't thoroughly tested this

@abertelrud
Copy link
Contributor

This makes sense to me — @neonichu or @aciidb0mb3r, was there a particular reason to disallow empty lists? If not, we should allow this, but it would be good to also add a unit test to the PR here.

@aciidgh
Copy link
Contributor

aciidgh commented Aug 21, 2020

IIRC the thinking was that there’s no reason to have empty list in a fully declarative manifest but I think it’s fine to relax this requirement since it’s quite useful to be able to write non-declarative manifests in practice.

@abertelrud
Copy link
Contributor

Thanks, @aciidb0mb3r, that makes sense. In this case I think that a unit test is all that's needed. Since we're relaxing the requirement we won't be breaking any projects, and I don't think this will need evolution discussion.

@abertelrud
Copy link
Contributor

@swift-ci please smoke test

@neonichu
Copy link
Contributor

@swift-ci please smoke test

@abertelrud abertelrud merged commit b579726 into swiftlang:master Aug 24, 2020
@keith
Copy link
Member Author

keith commented Aug 24, 2020

Thanks!

@keith keith deleted the ks/allow-empty-build-settings-arrays branch August 24, 2020 17:22
lorentey added a commit to lorentey/swift-package-manager that referenced this pull request Feb 16, 2021
Throwing an error on aesthetic issues like this makes it difficult to conditionally generate these arguments.

(This is a followup to swiftlang#2880.)
tomerd pushed a commit that referenced this pull request Feb 18, 2021
Throwing an error on aesthetic issues like this makes it difficult to conditionally generate these arguments.

(This is a followup to #2880.)
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

Successfully merging this pull request may close these issues.

5 participants