Skip to content

[5.1 08-28-2019] Cherry-picking recent Swift framework ABI checker enhancements #27011

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

Conversation

nkcsgexi
Copy link
Contributor

@nkcsgexi nkcsgexi commented Sep 4, 2019

Explanation: Cherry-picking recent Swift ABI checker changes into the submission branch. The changes are mostly in three parts: (1) submitting known Swift framework baselines into the toolchain, (2) submitting workflow enhancements python scripts into the toolchain, and (3) fixing issues reported by adopting Swift framework authors.

Scope: These are only enhancements to swift-api-digester and the tool's driving python scripts.

Issue: rdar://54309029, rdar://50217247, rdar://54273296, rdar://54797695, and rdar://54559888

Risk: Very Low since the changes are of no direct impacts on end users

Testing: local testing; unit testing; CI testing

Reviewed by: @akyrtzi

There could be cases where several modules having types of the same name.
Using fully qualified names could help us detect changing from using
one of them to another.

The commit also updates the existing ABI/API baselines to incorporate such change.
…modules

This patch also adds fixed-swift-modules to hard-code CreateML, which could
not be found in the regular framework search path.
…xtensions themselves

"Extension A has been removed" isn't very informative, we should emit diagnostics for
each members in the extension.
…agnosing module difference

This change introduces a Json format change where we always print fully
qualified type names everywhere. This is beneficial for diagnosing purposes but
may not be ideal for generating migrator scripts. To resolve this conflict, the
patch also introduces a flag -migrator to opt-out fully qualified type names.

After the format change, we need to update the ABI and API baselines for the
Swift stdlib.
… prefer to loading via interfaces

ABI checker imports Swift frameworks by using Swift interfaces for various
reasons. The existing way of controlling preferred importing mechanism is by
setting an environment variable (SWIFT_FORCE_MODULE_LOADING), which may lead
to performance issues because the stdlib could also be loaded in this way.

This patch adds a new front-end option to specify module names for
which we prefer to importing via Swift interface. The option currently is only
accessible via swift-api-digester.

rdar://54559888
…inary.swift

Under `-enable-library-evolution`, a slight AST difference is still found when importing
from .swiftinterface and from .swiftmodule. The difference is whether @objc attribute
is inherited by a Swift class subclassing an Objc class.
Framework authors usually have different schemes for different deployment
targets. We should exclude platform-unavailable ABIs from the Json file so
developers will only be warned of the breakages that are relevant to the current
scheme.

rdar://54273296
ABI/API checker should check semantic differences of two modules.
Adhering too strictly to the actual ASTs could yield false positives. This
patch populates ObjC, Dynamic and Final to the attribute list if AST
APIs say so.

rdar://50217247
…seline for a single module

This allows us to generate baselines for the Swift stdlib using an Xcode release.
When running the ABI checker from the build artifact, the executable
should be able to find baselines in the same relative paths as if
it's running from a toolchain.
…for ABI baselines

In case we need to also include framework API baselines in the future, we should have
an additional layer of directory for ABI baseline files.
@nkcsgexi nkcsgexi requested a review from a team as a code owner September 4, 2019 00:26
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Sep 4, 2019

@swift-ci please test

…derBase to ParseableInterfaceModuleLoader, NFC

We shouldn't over-expose this field since only ParseableInterfaceModuleLoader
is using it.
…aseline

Framework authors may be interested in comparing the current framework build
against an empty baseline to find public APIs without @available attributes. This
change makes such exercise easier.
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Sep 4, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Sep 4, 2019

Build failed
Swift Test Linux Platform
Git Sha - 0768452

@swift-ci
Copy link
Contributor

swift-ci commented Sep 4, 2019

Build failed
Swift Test OS X Platform
Git Sha - 0768452

@nkcsgexi nkcsgexi merged commit c370c4d into swiftlang:swift-5.1-branch-08-28-2019 Sep 6, 2019
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