1
1
// RUN: %empty-directory(%t)
2
+ // RUN: split-file %s %t
2
3
// REQUIRES: VENDOR=apple
3
4
// REQUIRES: asserts
4
5
12
13
// RUN: -o %t/sdk/System/Library/PrivateFrameworks/PrivateSwift.framework/Modules/PrivateSwift.swiftmodule/%target-swiftmodule-name
13
14
14
15
/// Expect errors when building a public client.
15
- // RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
16
- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
17
- // RUN: -library-level api -verify -D PUBLIC_IMPORTS - module-name MainLib
16
+ // RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
17
+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
18
+ // RUN: -library-level api -verify -module-name MainLib
18
19
19
20
/// Expect no errors when building an SPI client.
20
- // RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
21
- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
22
- // RUN: -library-level spi -D PUBLIC_IMPORTS - module-name MainLib
21
+ // RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
22
+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
23
+ // RUN: -library-level spi -module-name MainLib
23
24
24
25
/// The driver should also accept the flag and pass it along.
25
- // RUN: %target-swiftc_driver -typecheck -sdk %t/sdk -module-cache-path %t %s \
26
- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
27
- // RUN: -library-level spi -D PUBLIC_IMPORTS - module-name MainLib
26
+ // RUN: %target-swiftc_driver -typecheck -sdk %t/sdk %t/PublicImports.swift \
27
+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
28
+ // RUN: -library-level spi -module-name MainLib
28
29
29
30
/// Expect no errors when building a client with some other library level.
30
- // RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
31
- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
32
- // RUN: -D PUBLIC_IMPORTS - module-name MainLib
33
- // RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
34
- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
35
- // RUN: -library-level other -D PUBLIC_IMPORTS - module-name MainLib
36
- #if PUBLIC_IMPORTS
31
+ // RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
32
+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
33
+ // RUN: -module-name MainLib
34
+ // RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/PublicImports.swift \
35
+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
36
+ // RUN: -library-level other -module-name MainLib
37
+ //--- PublicImports.swift
37
38
import PublicSwift
38
39
import PrivateSwift // expected-error{{private module 'PrivateSwift' is imported publicly from the public module 'MainLib'}}
39
40
@@ -44,30 +45,28 @@ import LocalClang // expected-error{{private module 'LocalClang' is imported pub
44
45
@_exported import MainLib // expected-warning{{private module 'MainLib' is imported publicly from the public module 'MainLib'}}
45
46
46
47
/// Expect no errors with implementation-only imports.
47
- // RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
48
- // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
48
+ // RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/ImplOnlyImports.swift \
49
+ // RUN: -F %t/sdk/System/Library/PrivateFrameworks/ -module-cache-path %t \
49
50
// RUN: -library-level api -D IMPL_ONLY_IMPORTS
50
- #elseif IMPL_ONLY_IMPORTS
51
+ //--- ImplOnlyImports.swift
51
52
52
53
@_implementationOnly import PrivateSwift
53
54
@_implementationOnly import PublicClang_Private
54
55
@_implementationOnly import FullyPrivateClang
55
56
@_implementationOnly import LocalClang
56
57
57
58
/// Expect no errors with spi-only imports.
58
- // RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
59
- // RUN: -experimental-spi-only-imports \
59
+ // RUN: %target-swift-frontend -typecheck -sdk %t/sdk %t/SpiOnlyImports.swift \
60
+ // RUN: -experimental-spi-only-imports -module-cache-path %t \
60
61
// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
61
- // RUN: -library-level api -D SPI_ONLY_IMPORTS
62
- #elseif SPI_ONLY_IMPORTS
62
+ // RUN: -library-level api
63
+ //--- SPIOnlyImports.swift
63
64
64
65
@_spiOnly import PrivateSwift
65
66
@_spiOnly import PublicClang_Private
66
67
@_spiOnly import FullyPrivateClang
67
68
@_spiOnly import LocalClang
68
69
69
- #endif
70
-
71
70
/// Test error message on an unknown library level name.
72
71
// RUN: not %target-swift-frontend -typecheck %s -library-level ThatsNotALibraryLevel 2>&1 \
73
72
// RUN: | %FileCheck %s --check-prefix CHECK-ARG
0 commit comments