Skip to content

Commit fde4877

Browse files
committed
Have the frontend and new swift-driver look in an external -sdk for non-Darwin platform runtime libraries and modules too
as done originally in #25990 with the legacy C++ Driver, but since lost in the new swift-driver. Only difference is this checks if a Swift resource directory exists in `-sdk` and falls back to the default if not.
1 parent bf2c6e8 commit fde4877

29 files changed

+125
-102
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
WARNING(warning_no_such_sdk,none,
2525
"no such SDK: '%0'", (StringRef))
2626

27+
WARNING(warning_no_resource_dir_in_sdk, none,
28+
"You passed in an external -sdk without a Swift runtime.\n"
29+
" Either specify a directory containing the runtime libraries with\n"
30+
" the -resource-dir flag, or use -sysroot instead to point at a C/C++\n"
31+
" sysroot alone. Falling back to this path for the Swift runtime modules\n"
32+
" and libraries:\n"
33+
" %0", (StringRef))
2734
ERROR(error_no_frontend_args, none,
2835
"no arguments provided to '-frontend'", ())
2936

lib/ClangImporter/ClangImporter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,8 @@ void importer::getNormalInvocationArguments(
768768
invocationArgStrs.push_back("-fapinotes-swift-version=" +
769769
languageVersion.asAPINotesVersionString());
770770

771-
// Prefer `-sdk` paths.
772-
if (!searchPathOpts.getSDKPath().empty()) {
771+
// Prefer `-sdk` paths for Darwin.
772+
if (triple.isOSDarwin() && !searchPathOpts.getSDKPath().empty()) {
773773
llvm::SmallString<261> path{searchPathOpts.getSDKPath()};
774774
llvm::sys::path::append(path, "usr", "lib", "swift", "apinotes");
775775

lib/Frontend/CompilerInvocation.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,6 +2271,7 @@ static bool validateSwiftModuleFileArgumentAndAdd(const std::string &swiftModule
22712271

22722272
static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
22732273
DiagnosticEngine &Diags,
2274+
const llvm::Triple &Triple,
22742275
const CASOptions &CASOpts,
22752276
const FrontendOptions &FrontendOpts,
22762277
StringRef workingDirectory) {
@@ -2405,6 +2406,18 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
24052406

24062407
if (const Arg *A = Args.getLastArg(OPT_resource_dir))
24072408
Opts.RuntimeResourcePath = A->getValue();
2409+
else if (!Triple.isOSDarwin() && Args.hasArg(OPT_sdk)) {
2410+
llvm::SmallString<128> SDKResourcePath(Opts.getSDKPath());
2411+
llvm::sys::path::append(
2412+
SDKResourcePath, "usr", "lib",
2413+
FrontendOpts.UseSharedResourceFolder ? "swift" : "swift_static");
2414+
// Check for eg <sdkRoot>/usr/lib/swift/
2415+
if (llvm::sys::fs::exists(SDKResourcePath))
2416+
Opts.RuntimeResourcePath = SDKResourcePath.str();
2417+
else
2418+
Diags.diagnose(SourceLoc(), diag::warning_no_resource_dir_in_sdk,
2419+
Opts.RuntimeResourcePath);
2420+
}
24082421

24092422
Opts.SkipAllImplicitImportPaths |= Args.hasArg(OPT_nostdimport);
24102423
Opts.SkipSDKImportPaths |= Args.hasArg(OPT_nostdlibimport);
@@ -4064,7 +4077,7 @@ bool CompilerInvocation::parseArgs(
40644077

40654078
ParseSymbolGraphArgs(SymbolGraphOpts, ParsedArgs, Diags, LangOpts);
40664079

4067-
if (ParseSearchPathArgs(SearchPathOpts, ParsedArgs, Diags,
4080+
if (ParseSearchPathArgs(SearchPathOpts, ParsedArgs, Diags, LangOpts.Target,
40684081
CASOpts, FrontendOpts, workingDirectory)) {
40694082
return true;
40704083
}

test/ClangImporter/sdk-apinotes.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify
1+
// RUN: %empty-directory(%t/sdk/usr/lib/swift/apinotes)
2+
// RUN: %empty-directory(%t/sdk/usr/lib/swift/%target-sdk-name)
3+
// RUN: cp -r %clang-importer-sdk-path/usr/include %t/sdk/usr
4+
// RUN: cp -r %test-resource-dir/shims %t/sdk/usr/lib/swift
5+
// RUN: cp %S/Inputs/cfuncs.apinotes %t/sdk/usr/lib/swift/apinotes
6+
// RUN: cp -r %platform-module-dir/Swift.swiftmodule %t/sdk/usr/lib/swift/%target-sdk-name/
7+
// RUN: %target-swift-frontend(mock-sdk: -sdk %t/sdk) -typecheck %s -verify -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
28

39
import cfuncs
410

test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule
2+
// RUN: mkdir -p %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule
33
// RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule
4+
// RUN: %empty-directory(%t/sdk/usr/lib/swift/%target-sdk-name)
5+
// RUN: cp -r %platform-module-dir/{_Concurrency,_StringProcessing,Swift,SwiftOnoneSupport}.swiftmodule %t/sdk/usr/lib/swift/%target-sdk-name/
6+
// RUN: cp -r %test-resource-dir/shims %t/sdk/usr/lib/swift
47

5-
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
8+
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
69
// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat
710
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK
811

@@ -12,14 +15,14 @@
1215
// CHECK-DAG: Flat.swiftmodule
1316
// CHECK-DAG: FMWK.swiftmodule
1417

15-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
16-
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
18+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
19+
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/{Normal,Flat,FMWK}-*.swiftmodule
1720

1821
// Touch a file in the SDK (to make it look like it changed) and try again.
1922
// In -check-only mode, this should force a rebuild.
2023
// RUN: rm -rf %t/MCP
21-
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
22-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
24+
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
25+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
2326
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule
2427

2528
import Normal

test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt-envvar.swift

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule
2+
// RUN: mkdir -p %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule
33
// RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule
4+
// RUN: %empty-directory(%t/sdk/usr/lib/swift/%target-sdk-name)
5+
// RUN: cp -r %platform-module-dir/{_Concurrency,_StringProcessing,Swift,SwiftOnoneSupport}.swiftmodule %t/sdk/usr/lib/swift/%target-sdk-name/
6+
// RUN: cp -r %test-resource-dir/shims %t/sdk/usr/lib/swift
47

5-
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
8+
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
69
// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat
710
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK
811

@@ -12,17 +15,17 @@
1215
// CHECK-DAG: Flat.swiftmodule
1316
// CHECK-DAG: FMWK.swiftmodule
1417

15-
// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP
16-
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
18+
// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP
19+
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/{FMWK,Flat,Normal}-*.swiftmodule
1720

1821
// Touch a file in the SDK (to make it look like it changed) and try again.
1922
// This should still be able to use the prebuilt modules because they track
2023
// content hashes, not just size+mtime.
2124
// RUN: rm -rf %t/MCP
22-
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
23-
// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP
25+
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
26+
// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP
2427
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
25-
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
28+
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/{FMWK,Flat,Normal}-*.swiftmodule
2629

2730
// CHECK-CACHE-DAG: Normal-{{.+}}.swiftmodule
2831
// CHECK-CACHE-DAG: Flat-{{.+}}.swiftmodule
@@ -31,8 +34,8 @@
3134
// Actually change a file in the SDK, to check that we're tracking dependencies
3235
// at all.
3336
// RUN: rm -rf %t/MCP
34-
// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
35-
// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP
37+
// RUN: echo "public func another()" >> %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
38+
// RUN: env SWIFT_OVERLOAD_PREBUILT_MODULE_CACHE_PATH=%t/prebuilt %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP
3639
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
3740
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule
3841
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Flat-*.swiftmodule
@@ -41,7 +44,7 @@
4144
// Without the prebuilt cache everything should still work; it'll just take time
4245
// because we have to build the interfaces.
4346
// RUN: rm -rf %t/MCP
44-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP
47+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP
4548
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
4649
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule
4750
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Flat-*.swiftmodule

test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule
2+
// RUN: mkdir -p %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule
33
// RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule
4+
// RUN: %empty-directory(%t/sdk/usr/lib/swift/%target-sdk-name)
5+
// RUN: cp -r %platform-module-dir/{_Concurrency,_StringProcessing,Swift,SwiftOnoneSupport}.swiftmodule %t/sdk/usr/lib/swift/%target-sdk-name/
6+
// RUN: cp -r %test-resource-dir/shims %t/sdk/usr/lib/swift
47

5-
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
8+
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
69
// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat
710
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK
811

@@ -12,17 +15,17 @@
1215
// CHECK-DAG: Flat.swiftmodule
1316
// CHECK-DAG: FMWK.swiftmodule
1417

15-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
16-
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
18+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
19+
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/{FMWK,Flat,Normal}-*.swiftmodule
1720

1821
// Touch a file in the SDK (to make it look like it changed) and try again.
1922
// This should still be able to use the prebuilt modules because they track
2023
// content hashes, not just size+mtime.
2124
// RUN: rm -rf %t/MCP
22-
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
23-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
25+
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
26+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
2427
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
25-
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
28+
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/{FMWK,Flat,Normal}-*.swiftmodule
2629

2730
// CHECK-CACHE-DAG: Normal-{{.+}}.swiftmodule
2831
// CHECK-CACHE-DAG: Flat-{{.+}}.swiftmodule
@@ -31,8 +34,8 @@
3134
// Actually change a file in the SDK, to check that we're tracking dependencies
3235
// at all.
3336
// RUN: rm -rf %t/MCP
34-
// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
35-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
37+
// RUN: echo "public func another()" >> %t/sdk/System/iOSSupport/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
38+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
3639
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
3740
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule
3841
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Flat-*.swiftmodule
@@ -41,7 +44,7 @@
4144
// Without the prebuilt cache everything should still work; it'll just take time
4245
// because we have to build the interfaces.
4346
// RUN: rm -rf %t/MCP
44-
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP
47+
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -I %t/sdk/System/iOSSupport/usr/lib/swift/ -module-cache-path %t/MCP
4548
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
4649
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule
4750
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Flat-*.swiftmodule

test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// RUN: %empty-directory(%t)
22
// RUN: cp -r %S/Inputs/system-dependencies-sdk %t/sdk
3+
// RUN: %empty-directory(%t/sdk/usr/lib/swift/%target-sdk-name)
4+
// RUN: cp -r %platform-module-dir/{_Concurrency,_StringProcessing,Swift,SwiftOnoneSupport}.swiftmodule %t/sdk/usr/lib/swift/%target-sdk-name/
5+
// RUN: cp -r %test-resource-dir/shims %t/sdk/usr/lib/swift
36
// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk
47

58
// RUN: %swift_build_sdk_interfaces -sdk %t/sdk -v -o %t/prebuilt
69
// RUN: ls %t/prebuilt | %FileCheck %s
710
// CHECK: Swifty.swiftmodule
811

912
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
10-
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
13+
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Swifty-*.swiftmodule
1114

1215
// Touch a file in the SDK (to make it look like it changed) and try again.
1316
// This should still be able to use the prebuilt modules because they track

0 commit comments

Comments
 (0)