mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
ExplicitModule: remove all search paths for command lines to explicitly build Swift textual interface
This commit is contained in:
@@ -1137,28 +1137,14 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
|
||||
.EffectiveLanguageVersion.asAPINotesVersionString()));
|
||||
|
||||
genericSubInvocation.setImportSearchPaths(SearchPathOpts.ImportSearchPaths);
|
||||
llvm::for_each(SearchPathOpts.ImportSearchPaths,
|
||||
[&](const std::string &path) {
|
||||
GenericArgs.push_back("-I");
|
||||
GenericArgs.push_back(path);
|
||||
});
|
||||
genericSubInvocation.setFrameworkSearchPaths(SearchPathOpts.FrameworkSearchPaths);
|
||||
llvm::for_each(SearchPathOpts.FrameworkSearchPaths,
|
||||
[&](const SearchPathOptions::FrameworkSearchPath &path) {
|
||||
GenericArgs.push_back(path.IsSystem? "-Fsystem": "-F");
|
||||
GenericArgs.push_back(path.Path);
|
||||
});
|
||||
if (!SearchPathOpts.SDKPath.empty()) {
|
||||
genericSubInvocation.setSDKPath(SearchPathOpts.SDKPath);
|
||||
GenericArgs.push_back("-sdk");
|
||||
GenericArgs.push_back(SearchPathOpts.SDKPath);
|
||||
}
|
||||
|
||||
genericSubInvocation.setInputKind(InputFileKind::SwiftModuleInterface);
|
||||
if (!SearchPathOpts.RuntimeResourcePath.empty()) {
|
||||
genericSubInvocation.setRuntimeResourcePath(SearchPathOpts.RuntimeResourcePath);
|
||||
GenericArgs.push_back("-resource-dir");
|
||||
GenericArgs.push_back(SearchPathOpts.RuntimeResourcePath);
|
||||
}
|
||||
|
||||
// Inhibit warnings from the genericSubInvocation since we are assuming the user
|
||||
@@ -1276,14 +1262,10 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
|
||||
SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly;
|
||||
if (!moduleCachePath.empty()) {
|
||||
genericSubInvocation.setClangModuleCachePath(moduleCachePath);
|
||||
GenericArgs.push_back("-module-cache-path");
|
||||
GenericArgs.push_back(moduleCachePath);
|
||||
}
|
||||
if (!prebuiltCachePath.empty()) {
|
||||
genericSubInvocation.getFrontendOptions().PrebuiltModuleCachePath =
|
||||
prebuiltCachePath.str();
|
||||
GenericArgs.push_back("-prebuilt-module-cache-path");
|
||||
GenericArgs.push_back(prebuiltCachePath);
|
||||
prebuiltCachePath.str();
|
||||
}
|
||||
if (trackSystemDependencies) {
|
||||
genericSubInvocation.getFrontendOptions().IntermoduleDependencyTracking =
|
||||
@@ -1300,22 +1282,11 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
|
||||
}
|
||||
genericSubInvocation.getSearchPathOptions().ExplicitSwiftModules =
|
||||
searchPathOpts.ExplicitSwiftModules;
|
||||
// Dependencies scanner shouldn't know any explict Swift modules to use.
|
||||
// Adding these argumnets may not be necessary.
|
||||
// FIXME: remove it?
|
||||
for (auto EM: searchPathOpts.ExplicitSwiftModules) {
|
||||
GenericArgs.push_back("-swift-module-file");
|
||||
GenericArgs.push_back(ArgSaver.save(EM));
|
||||
}
|
||||
// Pass down -explicit-swift-module-map-file
|
||||
// FIXME: we shouldn't need this. Remove it?
|
||||
StringRef explictSwiftModuleMap = searchPathOpts.ExplicitSwiftModuleMap;
|
||||
genericSubInvocation.getSearchPathOptions().ExplicitSwiftModuleMap =
|
||||
explictSwiftModuleMap;
|
||||
if (!explictSwiftModuleMap.empty()) {
|
||||
GenericArgs.push_back("-explicit-swift-module-map-file");
|
||||
GenericArgs.push_back(explictSwiftModuleMap);
|
||||
}
|
||||
if (clangImporter) {
|
||||
// We need to add these extra clang flags because explict module building
|
||||
// related flags are all there: -fno-implicit-modules, -fmodule-map-file=,
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
// Check the contents of the JSON output
|
||||
// RUN: %FileCheck %s < %t/deps.json
|
||||
|
||||
// Check the contents of the JSON output
|
||||
// RUN: %FileCheck %s -check-prefix CHECK-NO-SEARCH-PATHS < %t/deps.json
|
||||
|
||||
// Check the make-style dependencies file
|
||||
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d
|
||||
|
||||
@@ -133,7 +136,6 @@ import SubE
|
||||
// CHECK: "commandLine": [
|
||||
// CHECK: "-compile-module-from-interface"
|
||||
// CHECK: "-target"
|
||||
// CHECK: "-sdk"
|
||||
// CHECK: "-module-name"
|
||||
// CHECK: "G"
|
||||
// CHECK: "-swift-version"
|
||||
@@ -193,6 +195,10 @@ import SubE
|
||||
/// --------Clang module SwiftShims
|
||||
// CHECK-LABEL: "modulePath": "SwiftShims.pcm",
|
||||
|
||||
// CHECK-NO-SEARCH-PATHS-NOT: "-I"
|
||||
// CHECK-NO-SEARCH-PATHS-NOT: "-sdk"
|
||||
// CHECK-NO-SEARCH-PATHS-NOT: "-F"
|
||||
// CHECK-NO-SEARCH-PATHS-NOT: "-prebuilt-module-cache-path"
|
||||
|
||||
// Check make-style dependencies
|
||||
// CHECK-MAKE-DEPS: module_deps.swift
|
||||
|
||||
Reference in New Issue
Block a user