1
1
// 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
3
5
// REQUIRES: VENDOR=apple
4
6
5
7
/// 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
7
18
// 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 \
8
20
// RUN: %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/source.swift \
9
21
// RUN: -o %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftmodule-name \
10
22
// RUN: -emit-module-interface-path %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftinterface-name
11
23
// 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
12
26
// 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 \
13
28
// RUN: %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/source.swift \
14
29
// RUN: -o %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftmodule-name \
15
30
// RUN: -emit-module-interface-path %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftinterface-name
16
31
// RUN: %target-swift-typecheck-module-from-interface(%t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftinterface-name) -module-name PrivateSwift
17
32
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
+
18
49
/// Break the swiftmodules.
19
50
// RUN: echo "This is a malformed swiftmodule" > %t/sdk/System/Library/Frameworks/PublicSwift.framework/Modules/PublicSwift.swiftmodule/%target-swiftmodule-name
20
51
// 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
21
54
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:
24
57
/// * compiled module is out of date
25
58
/// * unable to load compiled module '*': malformed
59
+
60
+ /// Check diagnostics in the local file:
26
61
// 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
30
80
31
81
import PublicSwift // expected-remark {{rebuilding module 'PublicSwift' from interface}}
32
82
// expected-note @-1 {{was ignored because it belongs to a framework in the SDK}}
@@ -36,3 +86,9 @@ import PrivateSwift
36
86
// expected-remark @-1 {{rebuilding module 'PrivateSwift' from interface}}
37
87
// expected-note @-2 {{compiled module is out of date}}
38
88
// 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