Skip to content
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

[SR-3205] Ability to restrict the import of implicit module dependencies #45793

Open
abertelrud opened this issue Nov 14, 2016 · 1 comment
Open
Labels
compiler The Swift compiler in itself improvement

Comments

@abertelrud
Copy link
Contributor

Previous ID SR-3205
Radar None
Original Reporter @abertelrud
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: d61b3766597a6f9be201ca763390bd53

relates to:

  • SR-655 Private C modules
  • SR-1393 [SwiftPM] Enforce Swift module import dependencies

Issue Description:

If a module X imports a module Y, then the compilation of any source code that imports module X also needs to provide search paths that lets the compiler find module Y. Unfortunately it doesn't seem possible to do this in a way that doesn't allow the source code that imports X to also import Y directly.

The Swift Package Manager would like to do this, so that only those modules that are directly declared as dependencies are available for import, regardless of any other implicit dependencies those modules have on other modules.

So this is a request for a way to provide this kind of control, either through:

a) a way to list the names of the modules (out of the set of modules findable through -I args) that are allowed to be explicitly imported by the code being compiled

or

b) a way to pass additional search paths, other than those provided by -I arguments, that will be searched only for implicit module references

Either way would work, and would allow the build system (in this case Swift Package Manager) to enforce that only modules specifically declared as dependencies are permitted to be directly imported by the source code being compiled.

@abertelrud
Copy link
Contributor Author

This is the compiler support that would be needed to implement https://bugs.swift.org/browse/SR-1393

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

1 participant