Skip to content

Ninja: Swift: Add swiftmodule dependency tracking

The swiftmodule works somewhat like headers in C/C++, indicating the public interface for a given library. The difference is that they are generated by the compiler as one of the build products.

Static libraries only have an order-only dependency between them since they are linked in the dylib/executable. This breaks down in incremental builds when the public interface of a library that is depended on by another library changes, since the intermediate library isn't rebuilt. Instead of getting an actionable compiler error, the final DSO fails to link.

This patch set adds a swiftmodule dependency edge between libraries linked with Swift to ensure that intermediate libraries are rebuilt when the public interface of one of their dependencies changes. Only targets that are linked with the Swift compiler will have a swiftmodule. In the case of executables, only executables that have exports are link-able and will correctly emit swiftmodules once !8048 (merged) lands. Therefore, we add the swiftmodule dependency when the current target is linked with Swift and when the dependency target is linked with Swift.

Topic-rename: swiftmodule-dependency-tracking

Edited by Brad King

Merge request reports