mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
ModuleInterface/Serialization: allow library authors to define a custom module version number
This allows library authors to pass down a project version number so that library users can conditionally import that library based on the available version in the search paths. Needed for rdar://73992299
This commit is contained in:
@@ -961,10 +961,16 @@ void Serializer::writeHeader(const SerializationOptions &options) {
|
||||
size_t compatibilityVersionStringLength =
|
||||
versionString.tell() - shortVersionStringLength - 1;
|
||||
versionString << ")/" << version::getSwiftFullVersion();
|
||||
auto userModuleMajor = options.UserModuleVersion.getMajor();
|
||||
auto userModuleMinor = 0;
|
||||
if (auto minor = options.UserModuleVersion.getMinor()) {
|
||||
userModuleMinor = *minor;
|
||||
}
|
||||
Metadata.emit(ScratchRecord,
|
||||
SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR,
|
||||
shortVersionStringLength,
|
||||
compatibilityVersionStringLength,
|
||||
userModuleMajor, userModuleMinor,
|
||||
versionString.str());
|
||||
|
||||
Target.emit(ScratchRecord, M->getASTContext().LangOpts.Target.str());
|
||||
|
||||
Reference in New Issue
Block a user