DependenciesScanner: include -sdk in Swift module building command

Swift module building commands need -sdk because dependencies sometimes use
sdk-relative paths (prebuilt modules for example). Without -sdk, the command
will not be able to local these dependencies, leading to unnecessary
rebuilding from textual interfaces.

rdar://81177968
This commit is contained in:
Xi Ge
2021-07-28 17:32:21 -07:00
parent f64833b046
commit 2132a9034d
3 changed files with 18 additions and 1 deletions

View File

@@ -1290,6 +1290,13 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
genericSubInvocation.setImportSearchPaths(SearchPathOpts.ImportSearchPaths);
genericSubInvocation.setFrameworkSearchPaths(SearchPathOpts.FrameworkSearchPaths);
if (!SearchPathOpts.SDKPath.empty()) {
// Add -sdk arguments to the module building commands.
// Module building commands need this because dependencies sometimes use
// sdk-relative paths (prebuilt modules for example). Without -sdk, the command
// will not be able to local these dependencies, leading to unnecessary
// building from textual interfaces.
GenericArgs.push_back("-sdk");
GenericArgs.push_back(ArgSaver.save(SearchPathOpts.SDKPath));
genericSubInvocation.setSDKPath(SearchPathOpts.SDKPath);
}