-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathindex_only_sdk_system_modules.swift
67 lines (55 loc) · 3 KB
/
index_only_sdk_system_modules.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/cache)
// RUN: %empty-directory(%t/idx)
// RUN: %empty-directory(%t/sdk)
// RUN: split-file %s %t
/// Create a Swift module to import.
// RUN: cp %t/module.modulemap %t/sdk/
// RUN: %target-swift-frontend -emit-module \
// RUN: -enable-library-evolution -swift-version 5 \
// RUN: -emit-module-path %t/sdk/LocalSystemModule.swiftmodule \
// RUN: -emit-module-interface-path %t/sdk/LocalSystemModule.swiftinterface \
// RUN: %t/LocalSystemModule.swift -I %t/sdk \
// RUN: -enable-testing
/// Build a test client once with indexing, not setting an SDK.
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN: -I %t/sdk -module-cache-path %t/cache \
// RUN: -index-system-modules \
// RUN: -index-store-path %t/idx \
// RUN: -index-ignore-stdlib \
// RUN: -sdk %t/someothersdk -Rmodule-loading 2>&1 \
// RUN: | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s
// CHECK-SWIFTMODULE: source: '{{.*}}LocalSystemModule.swiftmodule'
/// Build the test client again not setting an SDK, this one should still use
/// the adjacent module that is built for testing.
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN: -I %t/sdk -module-cache-path %t/cache \
// RUN: -sdk %t/someothersdk -Rmodule-loading 2>&1 \
// RUN: | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s
/// @testable import of a module in the SDK works once but not after it's cached.
// RUN: %empty-directory(%t/idx)
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN: -I %t/sdk -module-cache-path %t/cache \
// RUN: -index-system-modules \
// RUN: -index-store-path %t/idx \
// RUN: -index-ignore-stdlib \
// RUN: -sdk %t/sdk -Rmodule-loading 2>&1 \
// RUN: | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s
/// Failing case when building against the cached swiftmodule.
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN: -I %t/sdk -module-cache-path %t/cache \
// RUN: -sdk %t/sdk -Rmodule-loading \
// RUN: -verify -verify-ignore-unknown -show-diagnostics-after-fatal 2>&1
//--- module.modulemap
module LocalSystemModule [system] { }
//--- LocalSystemModule.swift
@_exported import LocalSystemModule
//--- TestClient.swift
@testable import LocalSystemModule // expected-error {{module 'LocalSystemModule' was not compiled for testing}}
// expected-remark @-1 {{LocalSystemModule.swiftinterface}}
// expected-remark @-2 {{'LocalSystemModule' has a required transitive dependency on 'LocalSystemModule'}}
// expected-remark @-3 {{'LocalSystemModule' has a required transitive dependency on 'Swift'}}
// expected-remark @-4 {{'LocalSystemModule' has a required transitive dependency on 'SwiftOnoneSupport'}}
// expected-remark @-5 {{'LocalSystemModule' has a required transitive dependency on '_Concurrency'}}
// expected-remark @-6 {{'LocalSystemModule' has a required transitive dependency on '_StringProcessing'}}
// expected-remark @-7 {{'LocalSystemModule' has a required transitive dependency on '_SwiftConcurrencyShims'}}