You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, you need B.swiftmodule and C.swiftmodule to compile A。
So if C‘s public interface changed, module A must be recompiled.
To change this, you will need add C to B's private deps,and use internal/private import C in B's implementation.
(Thanks for swift.experimental.AccessLevelOnImport feature,you won't need to write the _implementationOnly syntax )
So in this way, Bazel will not consider C.swiftmodule as A’s compile inputs,and compiler won't complain about it.
So can this be more automatic?
My requested feature is: as for module B, any internal/private modules it imports, automatically become private deps,and won't propagate to module A.
And is there any support for new swift feature InternalImportsByDefault?
Hopefully, make import internal by default and automatically change these dependencies to private deps will decrease lots of transitive dependencies and decrease build time in non-trivial projects.
One way to archive this may analyze swiftinterface for module B(if any),and find all public imports. Comparing these modules to deps of module B,changing any deps that not in B.swiftinterface to private_deps.
The text was updated successfully, but these errors were encountered:
CharlieSuP1
changed the title
Support for changing internal/private import to private_deps automatically
[Feature Request] Support for changing internal/private import to private_deps automatically
Jan 13, 2025
Updates: I think we can mimic xcodebuild's behavior:
when using "split derived files" feature,pass -emit-dependencies alongside -emit-module.
then use the swiftdeps result from -emit-dependencies, to trim input files for actual swift compilation.
Let's say A depends on B,B depends on C。
By default, you need B.swiftmodule and C.swiftmodule to compile A。
So if C‘s public interface changed, module A must be recompiled.
To change this, you will need add C to B's private deps,and use
internal/private import C
in B's implementation.(Thanks for
swift.experimental.AccessLevelOnImport
feature,you won't need to write the_implementationOnly
syntax )So in this way, Bazel will not consider C.swiftmodule as A’s compile inputs,and compiler won't complain about it.
So can this be more automatic?
My requested feature is: as for module B, any internal/private modules it imports, automatically become private deps,and won't propagate to module A.
And is there any support for new swift feature
InternalImportsByDefault
?Hopefully, make import internal by default and automatically change these dependencies to private deps will decrease lots of transitive dependencies and decrease build time in non-trivial projects.
One way to archive this may analyze swiftinterface for module B(if any),and find all public imports. Comparing these modules to deps of module B,changing any deps that not in B.swiftinterface to private_deps.
The text was updated successfully, but these errors were encountered: