mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Treat resource-directory-discovered modules as stable and make them use the SDK-specific module cache path
This commit is contained in:
@@ -2890,13 +2890,18 @@ void setOutputPath(ResultTy &resolvedOutputPath, const StringRef &moduleName,
|
||||
const CompilerInvocation &CI, const ArgListTy &extraArgs) {
|
||||
auto &outputPath = resolvedOutputPath.outputPath;
|
||||
outputPath = CI.getClangModuleCachePath();
|
||||
auto isPrefixedWith = [interfacePath](StringRef path) {
|
||||
return !path.empty() &&
|
||||
hasPrefix(llvm::sys::path::begin(interfacePath.str()),
|
||||
llvm::sys::path::end(interfacePath.str()),
|
||||
llvm::sys::path::begin(path), llvm::sys::path::end(path));
|
||||
};
|
||||
|
||||
// Dependency-scanner-specific module output path handling
|
||||
if ((CI.getFrontendOptions().RequestedAction ==
|
||||
FrontendOptions::ActionType::ScanDependencies)) {
|
||||
if (!sdkPath.empty() &&
|
||||
hasPrefix(llvm::sys::path::begin(interfacePath.str()), llvm::sys::path::end(interfacePath.str()),
|
||||
llvm::sys::path::begin(sdkPath), llvm::sys::path::end(sdkPath)))
|
||||
auto runtimeResourcePath = CI.getSearchPathOptions().RuntimeResourcePath;
|
||||
if (isPrefixedWith(sdkPath) || isPrefixedWith(runtimeResourcePath))
|
||||
outputPath = CI.getFrontendOptions().ExplicitSDKModulesOutputPath;
|
||||
else
|
||||
outputPath = CI.getFrontendOptions().ExplicitModulesOutputPath;
|
||||
|
||||
Reference in New Issue
Block a user