11// RUN: %empty-directory(%t)
2- // RUN: %empty-directory(%t/cache)
2+ // RUN: %empty-directory(%t/cache0)
3+ // RUN: %empty-directory(%t/cache1)
4+ // RUN: cp -r %S/../Sema/Inputs/public-private-sdk %t/sdk
35// REQUIRES: VENDOR=apple
46
57/// Prepare the SDK.
6- // RUN: cp -r %S/../Sema/Inputs/public-private-sdk %t/sdk
8+ //// stdlib
9+ // RUN: %target-swift-frontend -emit-module -module-name Swift -enable-library-evolution -swift-version 5 \
10+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -Osize \
11+ // RUN: %t/sdk/usr/lib/swift/Swift.swiftmodule/source.swift \
12+ // RUN: -o %t/sdk/usr/lib/swift/Swift.swiftmodule/%target-swiftmodule-name \
13+ // RUN: -emit-module-interface-path %t/sdk/usr/lib/swift/Swift.swiftmodule/%target-swiftinterface-name \
14+ // RUN: -parse-stdlib
15+ // RUN: %target-swift-typecheck-module-from-interface(%t/sdk/usr/lib/swift/Swift.swiftmodule/%target-swiftinterface-name) -module-name Swift -parse-stdlib
16+
17+ //// Public framework
718// RUN: %target-swift-frontend -emit-module -module-name PublicSwift -enable-library-evolution -swift-version 5 \
19+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -Osize -sdk %t/sdk \
820// RUN: %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/source.swift \
921// RUN: -o %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftmodule-name \
1022// RUN: -emit-module-interface-path %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftinterface-name
1123// RUN: %target-swift-typecheck-module-from-interface(%t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftinterface-name) -module-name PublicSwift
24+
25+ //// Private framework
1226// RUN: %target-swift-frontend -emit-module -module-name PrivateSwift -enable-library-evolution -swift-version 5 \
27+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -Osize -sdk %t/sdk \
1328// RUN: %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/source.swift \
1429// RUN: -o %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftmodule-name \
1530// RUN: -emit-module-interface-path %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftinterface-name
1631// RUN: %target-swift-typecheck-module-from-interface(%t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftinterface-name) -module-name PrivateSwift
1732
33+ //// Public library
34+ // RUN: %target-swift-frontend -emit-module -module-name PublicSwiftLibrary -enable-library-evolution -swift-version 5 \
35+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -Osize -sdk %t/sdk \
36+ // RUN: %t/sdk/usr/lib/swift/PublicSwiftLibrary.swiftmodule/source.swift \
37+ // RUN: -o %t/sdk/usr/lib/swift/PublicSwiftLibrary.swiftmodule/%target-swiftmodule-name \
38+ // RUN: -emit-module-interface-path %t/sdk/usr/lib/swift/PublicSwiftLibrary.swiftmodule/%target-swiftinterface-name
39+ // RUN: %target-swift-typecheck-module-from-interface(%t/sdk/usr/lib/swift/PublicSwiftLibrary.swiftmodule/%target-swiftinterface-name) -module-name PublicSwiftLibrary
40+
41+ //// Public subframework
42+ // RUN: %target-swift-frontend -emit-module -module-name SubSwift -enable-library-evolution -swift-version 5 \
43+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -Osize -sdk %t/sdk \
44+ // RUN: %t/sdk/System/Library/SubFrameworks/SubSwift.framework/Modules/SubSwift.swiftmodule/source.swift \
45+ // RUN: -o %t/sdk/System/Library/SubFrameworks/SubSwift.framework/Modules/SubSwift.swiftmodule/%target-swiftmodule-name \
46+ // RUN: -emit-module-interface-path %t/sdk/System/Library/SubFrameworks/SubSwift.framework/Modules/SubSwift.swiftmodule/%target-swiftinterface-name
47+ // RUN: %target-swift-typecheck-module-from-interface(%t/sdk/System/Library/SubFrameworks/SubSwift.framework/Modules/SubSwift.swiftmodule/%target-swiftinterface-name) -module-name SubSwift
48+
1849/// Break the swiftmodules.
1950// RUN: echo "This is a malformed swiftmodule" > %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftmodule-name
2051// RUN: echo "This is a malformed swiftmodule" > %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftmodule-name
52+ // RUN: echo "This is a malformed swiftmodule" > %t/sdk/System/Library/SubFrameworks/SubSwift.framework/Modules/SubSwift.swiftmodule/%target-swiftmodule-name
53+ // RUN: echo "This is a malformed swiftmodule" > %t/sdk/usr/lib/swift/PublicSwiftLibrary.swiftmodule/%target-swiftmodule-name
2154
22- /// There should be no attempt at loading the malformed PublicSwift swiftmodule.
23- /// This means no notes about :
55+ /// Check the loading behavior from attempts at loading the malformed swiftmodules,
56+ /// printing the notes:
2457/// * compiled module is out of date
2558/// * unable to load compiled module '*': malformed
59+
60+ /// Check diagnostics in the local file:
2661// RUN: %target-swift-frontend -typecheck %s -sdk %t/sdk \
27- // RUN: -module-name Main -module-cache-path %t/cache \
28- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
29- // RUN: -verify -Rmodule-interface-rebuild
62+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import \
63+ // RUN: -module-name Main -module-cache-path %t/cache0 \
64+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -resource-dir "" \
65+ // RUN: -verify -verify-ignore-unknown -Rmodule-interface-rebuild -diagnostic-style=llvm
66+
67+ /// Check diagnostic for implicit imports:
68+ // RUN: echo "This is a malformed swiftmodule" > %t/sdk/usr/lib/swift/Swift.swiftmodule/%target-swiftmodule-name
69+ // RUN: %target-swift-frontend -typecheck %s -sdk %t/sdk \
70+ // RUN: -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import \
71+ // RUN: -module-name Main -module-cache-path %t/cache1 \
72+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -resource-dir "" \
73+ // RUN: -Rmodule-interface-rebuild -Rmodule-loading -diagnostic-style=llvm 2> %t/out
74+ // RUN: %FileCheck --input-file %t/out %s
75+
76+ import Swift
77+ // CHECK: rebuilding module 'Swift' from interface
78+ // CHECK-NEXT: compiled module is out of date
79+ // CHECK-NEXT: : malformed
3080
3181import PublicSwift // expected-remark {{rebuilding module 'PublicSwift' from interface}}
3282// expected-note @-1 {{was ignored because it belongs to a framework in the SDK}}
@@ -36,3 +86,9 @@ import PrivateSwift
3686// expected-remark @-1 {{rebuilding module 'PrivateSwift' from interface}}
3787// expected-note @-2 {{compiled module is out of date}}
3888// expected-note @-3 {{: malformed}}
89+
90+ import PublicSwiftLibrary // expected-remark {{rebuilding module 'PublicSwiftLibrary' from interface}}
91+ // expected-note @-1 {{was ignored because it's a library module in the SDK}}
92+
93+ import SubSwift // expected-remark {{rebuilding module 'SubSwift' from interface}}
94+ // expected-note @-1 {{was ignored because it belongs to a framework in the SDK}}
0 commit comments