|
1 | 1 | /// Test the loading order of module interfaces between the SDK and the
|
2 | 2 | /// prebuilt cache. The order should be:
|
3 | 3 | ///
|
4 |
| -/// 1. Local cache (not tested here) |
5 |
| -/// 2. Next to the swiftinterface file |
6 |
| -/// 3. Prebuilt-module cache |
| 4 | +/// 1. swiftmodule in the local cache (not tested here) |
| 5 | +/// 2. swiftmodule next to the swiftinterface file |
| 6 | +/// 3. If it's a private swiftinterface, rebuild the swiftmodule from the private swiftinterface |
| 7 | +/// 4. swiftmodule in the prebuilt-module cache |
| 8 | +/// 5. Rebuild the swiftmodule from the swiftinterface file and keep in the local cache |
7 | 9 |
|
8 | 10 | /// Create folders for a) our Swift module, b) the module cache, and c) a
|
9 | 11 | /// fake resource dir with a default prebuilt module cache inside.
|
|
16 | 18 | // RUN: echo 'public func prebuiltModule() {}' > %t/PrebuiltModule.swift
|
17 | 19 |
|
18 | 20 | /// Compile this into a module in the SDK.
|
19 |
| -// RUN: %target-swift-frontend -emit-module %t/NextToSwiftinterface.swift -o %t/MyModule.swiftmodule/%target-swiftmodule-name -module-name MyModule -parse-stdlib -emit-module-interface-path %t/MyModule.swiftmodule/%target-swiftinterface-name |
| 21 | +// RUN: %target-swift-frontend -emit-module %t/NextToSwiftinterface.swift -o %t/MyModule.swiftmodule/%target-swiftmodule-name -module-name MyModule -parse-stdlib -emit-module-interface-path %t/MyModule.swiftmodule/%target-swiftinterface-name -emit-private-module-interface-path %t/MyModule.swiftmodule/%target-private-swiftinterface-name |
20 | 22 |
|
21 |
| -/// Also put a module with a different API into the default prebuilt cache under the same name. |
| 23 | +/// Also put a module with a different API into the default prebuilt cache under the same name to detect when its picked. |
22 | 24 | // RUN: %target-swift-frontend -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/%target-sdk-name/prebuilt-modules/MyModule.swiftmodule/%target-swiftmodule-name -module-name MyModule -parse-stdlib
|
23 | 25 |
|
24 | 26 | /// Import this module and expect to use the swiftmodule next to the swiftinterface.
|
25 | 27 | // RUN: %target-swift-frontend -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t -D FIRST_NEXT_TO_SWIFTINTERFACE
|
26 | 28 |
|
27 |
| -/// Remove the first swiftmodule and import again to use the prebuilt swiftmodule. |
| 29 | +/// Remove the swiftmodule next to the swiftinterface, the compiler should rebuild from the private swiftinterface. |
28 | 30 | // RUN: rm %t/MyModule.swiftmodule/%target-swiftmodule-name
|
| 31 | +// RUN: %target-swift-frontend -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t -D FIRST_NEXT_TO_SWIFTINTERFACE |
| 32 | + |
| 33 | +/// Remove the private swiftinterface and import again to use the prebuilt swiftmodule. |
| 34 | +// RUN: rm %t/MyModule.swiftmodule/%target-private-swiftinterface-name |
29 | 35 | // RUN: %target-swift-frontend -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t -D THEN_PREBUILT_MODULE
|
30 | 36 |
|
31 | 37 | import MyModule
|
|
0 commit comments