The .swiftsourceinfo files emitted by the compiler have two things that make them nondeterministic:
- Absolute paths to the referenced source files (regardless of how they are passed to the frontend)
- Modified times of the referenced source files
For build systems that care about this kind of thing (Bazel), we don't declare the .swiftsourceinfo files as outputs of our compilation actions so we don't harm our output caching.
I'm looking at upstreaming a change that would make those files deterministic, most likely by:
- Applying the
-serialized-path-obfuscate <prefix>=<replacement>flags to the paths in.swiftsourceinfofiles - Emitting zero for the mtimes (this would probably need a new flag to control this behavior)
Are there any workflows that I should be aware of that might break with those changes (like SourceKit, incremental compilation, etc.)? It especially wasn't clear to me from looking through the implementation what the mtimes are being used for—they're serialized but I don't see any code that actually references them when they're read back in. If not, it would be fantastic if we could just unconditionally zero out that field.