Skip to content

Ignore in-package transitive dependencies when building from non-package textual interface #77686

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

artemcm
Copy link
Contributor

@artemcm artemcm commented Nov 18, 2024

This change ensures that when loading some module dependency 'Bar' which has a package-only dependency on 'Foo', only the following clients attempt to resolve/load 'Foo':

  • Source compilation with package-name equal to that of 'Bar'.
  • Textual interface compilation of a 'package' interface with package-name equal to that of 'Bar'.

Ensuring that the following kinds of clients do not attempt to resolve/load 'Foo':

  • Source compilation with package-name different to that of 'Bar'
  • Textual interface compilation of a public or private interface, regardless of package name.

This fixes the behavior where previously compilation of a Swift textual interface dependency 'X' from its public or private interface, with an interface-specified package-name, from a client without a matching package-name, resulted in a lookup of package-only dependencies of modules loaded into 'X'. This behavior is invalid if we are not building from the package textual interface, becuase the module dependency graph is defined by the package name of the source client, not individual module dependency package name. i.e. In-package module dependencies are resolved/loaded only if the parent source compile matches the package name.

Resolves rdar://139979180

@artemcm
Copy link
Contributor Author

artemcm commented Nov 18, 2024

@swift-ci test

@nkcsgexi
Copy link
Contributor

Thank you Artem! This change is reasonable to me.

…age textual interface

This change ensures that when loading some module dependency 'Bar' which has a package-only dependency on 'Foo', only the following clients attempt to resolve/load 'Foo':
- Source compilation with package-name equal to that of 'Bar'.
- Textual interface compilation of a *'package'* interface with package-name equal to that of 'Bar'.

Ensuring that the following kinds of clients do not attempt to resolve/load 'Foo':
- Source compilation with package-name different to that of 'Bar'
- Textual interface compilation of a public or private interface, regardless of package name.

This fixes the behavior where previously compilation of a Swift textual interface dependency 'X' from its public or private interface, with an interface-specified package-name, from a client without a matching package-name, resulted in a lookup of package-only dependencies of modules loaded into 'X'. This behavior is invalid if we are not building from the package textual interface, becuase the module dependency graph is defined by the package name of the source client, not individual module dependency package name. i.e. In-package module dependencies are resolved/loaded only if the parent source compile matches the package name.

Resolves rdar://139979180
@artemcm artemcm force-pushed the NoInPackageDepsForNonPackageInterface branch from 8ffda2a to 77fde76 Compare November 18, 2024 21:29
@artemcm
Copy link
Contributor Author

artemcm commented Nov 18, 2024

@swift-ci test

@artemcm artemcm enabled auto-merge November 18, 2024 21:38
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.

4 participants