Skip to content

Add $(inherited) to OTHER_SWIFT_FLAGS. #2143

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

Closed
wants to merge 1 commit into from

Conversation

drewster99
Copy link

Other defines in OTHER_SWIFT_FLAGS were being overwritten.
Resolves https://bugs.swift.org/browse/SR-10804

Other defines in OTHER_SWIFT_FLAGS were being overwritten.
Resolves https://bugs.swift.org/browse/SR-10804
projectSettings.common.OTHER_SWIFT_FLAGS += ["-DXcode"]
projectSettings.common.OTHER_SWIFT_FLAGS = ["$(inherited)"]
+ (projectSettings.common.OTHER_SWIFT_FLAGS ?? [])
+ ["-DXcode"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move this line before we append the additional compiler flags to simplify this to projectSettings.common.OTHER_SWIFT_FLAGS = ["$(inherited)", "-DXcode"]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had considered this but decided against it because I didn't know if the order of settings needed to be maintained.

For example, making the change indicated would have the effect of moving "-DXcode" to no longer be at the end, in the case that options.flags.swiftCompilerFlags isn't empty. Additionally, if the current or future implementation of Xcode.Project() were to set OTHER_SWIFT_FLAGS, for some reason, those would be lost with this change.

While I know that the position of -DXcode probably doesn't matter and the Xcode.Project() probably won't set OTHER_SWIFT_FLAGS, I felt the code I wrote best preserved the existing semantics and protected against these small possible outlier issues I described.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually start with assigning a value to these arrays and then use += to add more content into them. In this case, the order doesn't really matter and it'll be more confusing that we're not appending in later calls.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback on this.

@aciidgh aciidgh added the WIP Work in progress label Jun 10, 2019
@aciidgh
Copy link
Contributor

aciidgh commented Jun 26, 2019

Doing this here: #2193

@aciidgh aciidgh closed this Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants