Skip to content

[6.0] Change interface printing behaviors for -package-name and -project-name #74940

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

tshortli
Copy link
Contributor

@tshortli tshortli commented Jul 3, 2024

  • Explanation: The first change adds an option to only print the -package-name flag in the package .swiftinterface. The second change always excludes the -project-name flag from the public .swiftinterface file for a module, while continuing to print it in the private and package interfaces. These changes are bundled because they are related and one builds on top of the other.
  • Scope: Affects .swiftinterface printing when the -package-name and -project-name flags are specified.
  • Issue/Radars: rdar://130992944, rdar://130701866
  • Original PRs: Option to disable printing package-name in public or private interface. #74827, Frontend: Only print -project-name in private and package interfaces #74921
  • Risk: Medium. This change refactors saving compiler flags for emission in .swiftinterface files works in general.
  • Testing: New tests added to the compiler test suite.
  • Reviewer: @xymus @elsh @artemcm

elsh and others added 6 commits July 3, 2024 09:23
Having package-name flag in non-package interfaces causes them to be built as if
belonging to a package, which causes an issue for a loading client outside of the
package as follows.

For example, when building X that depends on A with the following dependency chain:
  X --> A --> B --(package-only)--> C

1. X itself is not in the same package as A, B, and C.
2. When dependency scanning X, and opening up B, because the scan target is in a
   different package domain, the scanner decides that B's package-only dependency
   on C is to be ignored.
3. When then finally building A itself, it will load its dependencies, but because
   the .private.swiftinterface of A still specifies -package-name, when it loads
   B, it will then examine its dependencies and deem that this package-only dependency
   on C is required.

Because (2) and (3) disagree, we get an error now when building the private A textual interface.

rdar://130701866
There are two axes on which a saved frontend flag can be categorized for
printing in a `.swiftinterface` file:

1. Whether the flag is "ignorable" or not.
2. Which levels of interface the flag should be in (public, package).

This refactor ensures that those two axes are modeled independently and
prepares the infrastructure to allow flags to appear in the private and package
interfaces without being included in the public interface.
@tshortli
Copy link
Contributor Author

tshortli commented Jul 3, 2024

@swift-ci please test

@tshortli tshortli marked this pull request as ready for review July 3, 2024 19:06
@tshortli tshortli requested a review from a team as a code owner July 3, 2024 19:06
@tshortli tshortli changed the title [6.0] Frontend: Only print -project-name in private and package interfaces [6.0] Change interface printing behaviors for -package-name and -project-name Jul 3, 2024
@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Jul 3, 2024
@tshortli tshortli enabled auto-merge July 3, 2024 19:16
@tshortli tshortli merged commit de5d500 into swiftlang:release/6.0 Jul 3, 2024
5 checks passed
@tshortli tshortli deleted the private-module-interface-flags-6.0 branch July 10, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants