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:
@@ -489,10 +489,11 @@ void DocSerializer::writeDocHeader() {
|
||||
control_block::TargetLayout Target(Out);
|
||||
|
||||
auto& LangOpts = M->getASTContext().LangOpts;
|
||||
auto verText = version::getSwiftFullVersion(LangOpts.EffectiveLanguageVersion);
|
||||
Metadata.emit(ScratchRecord, SWIFTDOC_VERSION_MAJOR, SWIFTDOC_VERSION_MINOR,
|
||||
/*short version string length*/0, /*compatibility length*/0,
|
||||
version::getSwiftFullVersion(
|
||||
LangOpts.EffectiveLanguageVersion));
|
||||
/*user module version major*/0,
|
||||
/*user module version minor*/0, verText);
|
||||
|
||||
ModuleName.emit(ScratchRecord, M->getName().str());
|
||||
Target.emit(ScratchRecord, LangOpts.Target.str());
|
||||
@@ -875,10 +876,12 @@ public:
|
||||
control_block::TargetLayout Target(Out);
|
||||
|
||||
auto& LangOpts = M->getASTContext().LangOpts;
|
||||
auto verText = version::getSwiftFullVersion(LangOpts.EffectiveLanguageVersion);
|
||||
Metadata.emit(ScratchRecord, SWIFTSOURCEINFO_VERSION_MAJOR,
|
||||
SWIFTSOURCEINFO_VERSION_MINOR,
|
||||
/*short version string length*/0, /*compatibility length*/0,
|
||||
version::getSwiftFullVersion(LangOpts.EffectiveLanguageVersion));
|
||||
/*user module version major*/0,
|
||||
/*user module version minor*/0, verText);
|
||||
|
||||
ModuleName.emit(ScratchRecord, M->getName().str());
|
||||
Target.emit(ScratchRecord, LangOpts.Target.str());
|
||||
|
||||
Reference in New Issue
Block a user