Skip to content

[Darwin] Further restrict inference of the simulator environment #30771

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 7 commits into from
Apr 18, 2020

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Apr 2, 2020

The *-simulator target triples have been used mostly consistently in build systems for
several years to indicate simulator targets... except for Swift's own CMake configuration
and build-script, which was still not doing it until recently. There are still .swiftinterface
files around that depend on the inference.

Rather than outright removing inference of the "simulator" environment, move it into
the driver and warn that it's happening, so other tools can move off it over time. This
ensures that all frontend/linker/etc. jobs see the "simulator" environment, so the hack is
only in a single place.

This is as far as we can go toward completely removing the hack (rdar://problem/35810403),
because of the need to continue supporting existing .swiftinterface files.

@DougGregor
Copy link
Member Author

@swift-ci please test

@harlanhaskins
Copy link
Contributor

Seems like we should also remove this from swift-driver. https://github.com/apple/swift-driver/blob/master/Sources/SwiftDriver/Utilities/Triple%2BPlatforms.swift#L133

@swift-ci
Copy link
Contributor

swift-ci commented Apr 2, 2020

Build failed
Swift Test Linux Platform
Git Sha - 2d66f2b50a3a28f3b8beb7986eec59cc8aa5cc48

@DougGregor
Copy link
Member Author

Linux failure is unrelated. Trying again...

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor
Copy link
Member Author

GitHub connectivity problems affected the compatibility suite. Sigh.

1 similar comment
@DougGregor
Copy link
Member Author

GitHub connectivity problems affected the compatibility suite. Sigh.

@DougGregor
Copy link
Member Author

@swift please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Apr 2, 2020

Build failed
Swift Test OS X Platform
Git Sha - 2d66f2b50a3a28f3b8beb7986eec59cc8aa5cc48

@DougGregor DougGregor force-pushed the stop-inferring-simulator branch from 2d66f2b to 8e0717c Compare April 3, 2020 17:11
@DougGregor DougGregor changed the title [Platform] Stop inferring simulator-ness. [CMake/build-script/Platform] Stop depending on and inferring simulator-ness. Apr 3, 2020
@DougGregor DougGregor force-pushed the stop-inferring-simulator branch from 8e0717c to 36bc9e3 Compare April 3, 2020 19:49
@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 3, 2020

Build failed
Swift Test Linux Platform
Git Sha - 2d66f2b50a3a28f3b8beb7986eec59cc8aa5cc48

@swift-ci
Copy link
Contributor

swift-ci commented Apr 3, 2020

Build failed
Swift Test OS X Platform
Git Sha - 2d66f2b50a3a28f3b8beb7986eec59cc8aa5cc48

@DougGregor
Copy link
Member Author

@swift-ci please clean test

@DougGregor DougGregor force-pushed the stop-inferring-simulator branch from 36bc9e3 to 7346da6 Compare April 4, 2020 03:57
@DougGregor
Copy link
Member Author

@swift-ci please clean test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please clean test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Apr 4, 2020

Build failed
Swift Test OS X Platform
Git Sha - 7346da6a2719ce6024eb8758e5feacbee3dcea18

@swift-ci
Copy link
Contributor

swift-ci commented Apr 4, 2020

Build failed
Swift Test Linux Platform
Git Sha - 7346da6a2719ce6024eb8758e5feacbee3dcea18

@DougGregor DougGregor force-pushed the stop-inferring-simulator branch from 7346da6 to 462a783 Compare April 6, 2020 17:18
@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 6, 2020

Build failed
Swift Test Linux Platform
Git Sha - 7346da6a2719ce6024eb8758e5feacbee3dcea18

@swift-ci
Copy link
Contributor

swift-ci commented Apr 6, 2020

Build failed
Swift Test OS X Platform
Git Sha - 7346da6a2719ce6024eb8758e5feacbee3dcea18

@DougGregor
Copy link
Member Author

Much of this pull request came in via #30843. I'll rebase the rest on top of this.

@@ -172,6 +174,13 @@ macro(configure_sdk_darwin
"${SWIFT_SDK_${prefix}_ARCHITECTURES}" # rhs
SWIFT_SDK_${prefix}_MODULE_ARCHITECTURES) # result

# Determine whether this is a simulator SDK.
if ( ${xcrun_name} MATCHES "simulator" )
Copy link
Member

Choose a reason for hiding this comment

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

The convention in LLVM (and Swift) is not have spaces after the if and not to have spaces inside the (.

Suggested change
if ( ${xcrun_name} MATCHES "simulator" )
if(xcrun_name MATCHES simulator)

Copy link
Member Author

Choose a reason for hiding this comment

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

I had no idea, thank you!

@@ -181,6 +190,12 @@ macro(configure_sdk_darwin
set(SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE
"${arch}-apple-${SWIFT_SDK_${prefix}_TRIPLE_NAME}")

# If this is a simulator target, append -simulator.
if (SWIFT_SDK_${prefix}_IS_SIMULATOR)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (SWIFT_SDK_${prefix}_IS_SIMULATOR)
if(SWIFT_SDK_${prefix}_IS_SIMULATOR)

if (SWIFT_SDK_${prefix}_IS_SIMULATOR)
set(SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE
"${SWIFT_SDK_${prefix}_ARCH_${arch}_TRIPLE}-simulator")
endif ()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
endif ()
endif()

The *-simulator target triples have been used consistently in tools for
several years to indicate simulator targets. Stop inferring the
simulator part, rdar://problem/35810403.
It's just Triple::isSimulatorEnvironment() now.
Localize the hack to infer simulator-ness of the target in the driver
itself, when it first processes the target. Emit a warning about the
missing "-simulator" and correct the triple immediately.

This gives a longer grace period for tools that might still not pass
through the simulator environment, while narrowing the hack.
@DougGregor DougGregor force-pushed the stop-inferring-simulator branch from 462a783 to 643491e Compare April 16, 2020 20:40
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor DougGregor changed the title [CMake/build-script/Platform] Stop depending on and inferring simulator-ness. [Darwin] Further restrict inference of the simulator environment Apr 16, 2020
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 643491e

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 643491e

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 643491e

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 643491e

Some code paths that see target triples go through the frontend
without seeing the driver. Therefore, perform the same "simulator"
inference for x86 iOS/tvOS/watchOS triples also in the frontend,
to ensure that we remain compatible. Also make sure that
-print-target-info performs the appropriate adjustment.
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 856855d

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 856855d

@DougGregor
Copy link
Member Author

@swift-ci please test

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1a860e7

@DougGregor
Copy link
Member Author

@swift-ci test platform Linux

@DougGregor
Copy link
Member Author

@swift-ci smoke test Linux

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci smoke test Linux

@DougGregor DougGregor merged commit 22cdddd into swiftlang:master Apr 18, 2020
@DougGregor DougGregor deleted the stop-inferring-simulator branch April 18, 2020 03:59
@fredriss
Copy link
Contributor

When this was merged, the Linux PR testing started failing in lldb tests. First Failure here: https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/4933/

I have no idea what's going on, it doesn't make much sense, but the revert unblocked things.

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