Commit Graph

3 Commits

Author SHA1 Message Date
Alexis Laferrière
020d5784df Serialization: reword diagnostic about serialization channel mismatch
This diagnostic reports when two compilers that are marked as targetting
different distribution channels try to read swiftmodules produced by the
other one. For a resilient module, this error is usually silently ignored
as the reader compiler picks the swiftinterface over the swiftmodule.
It is visibile to the end user when the module is non-resilient.
For such a case, we here try to improve the diagnostic to be more
meaningful.

The new diagnostics looks like so:
```
import ChannelLib // error: the binary module for 'ChannelLib' was compiled
                  // for 'restricted-channel', it cannot be imported by the
                  // current compiler which is aligned with 'other-channel'.
                  // Binary module loaded from path: .../ChannelLib.swiftmodule
```

Vendors should be mindful to pick meaningful channel names
to guide users in the direction of the actual solution.
2024-08-15 13:29:10 -07:00
Alexis Laferrière
7edd23a627 Serialization: allow different channels to share a module cache location 2024-03-01 10:54:29 -08:00
Alexis Laferrière
1e4fe67f40 Serialization: restrict swiftmodules to distribution channels
There are scenarios where different compilers are distributed with
compatible serialization format versions and the same tag. Distinguish
swiftmodules in such a case by assigning them to different distribution
channels. A compiler expecting a specific channel will only read
swiftmodules from the same channel. The channels should be defined by
downstream code as it is by definition vendor specific.

For development, a no-channel compiler loads or defining the env var
SWIFT_IGNORE_SWIFTMODULE_REVISION skips this new check.

rdar://123731777
2024-03-01 10:52:44 -08:00