Skip to content

[Gardening] Clean Up OS Conditionals With canImport and Vendor=apple #32642

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
merged 2 commits into from
Jul 1, 2020

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Jul 1, 2020

Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
swiftlang/swift-package-manager#1826.

CodaFi added 2 commits June 30, 2020 22:55
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
swiftlang/swift-package-manager#1826.
This simplifies the usual bundle of OS checks

OS=macosx || OS=ios || OS=tvos || OS=watchos

into

VENDOR=apple

which was added in swiftlang#27307
@CodaFi CodaFi requested review from DougGregor and cyndyishida July 1, 2020 06:03
@CodaFi CodaFi changed the title Ossignpost [Gardening] Clean Up OS Conditionals With canImport and Vendor=apple Jul 1, 2020
@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 1, 2020

@swift-ci test

@CodaFi CodaFi requested a review from compnerd July 1, 2020 06:08
@cyndyishida
Copy link
Contributor

Could usages of REQUIRES: objc_interop be replaced with REQUIRES: VENDOR=apple too?

@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 1, 2020

Absolutely! I think it would make for a great cleanup to the tests that use the mock SDK specifically. I'm unsure if we currently support, or may support in the future, a non-Darwin platform that undertakes the effort necessary to satisfy objc_interop but in such a case we ought to leave the more codegen/execution-oriented tests alone.

@compnerd
Copy link
Member

compnerd commented Jul 1, 2020

@cyndyishida @CodaFi I dont think that conflating VENDOR=apple and REQUIRES: objc_interop makes sense. As long as you have a compatible ObjC runtime, it is possible to enable ObjC interop elsewhere. Please don't mix the two.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I'm still not a fan of the canImport means because it just checks if the module exists. The module existing doesn't mean that it is the correct module to import IMO.

@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 1, 2020

Certainly, but should a future platform define their own Darwin or Glibc, we'll need to have a stern talking-to with them anyways about naming conventions!

@CodaFi
Copy link
Contributor Author

CodaFi commented Jul 1, 2020

@CodaFi CodaFi merged commit b766544 into swiftlang:master Jul 1, 2020
@CodaFi CodaFi deleted the ossignpost branch July 1, 2020 19:08
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.

3 participants