|
| 1 | +/// Check that only public imports are printed in modules interfaces, |
| 2 | +/// package imports and below are not. |
| 3 | + |
| 4 | +// RUN: %empty-directory(%t) |
| 5 | +// RUN: split-file %s %t |
| 6 | + |
| 7 | +/// Build the libraries. |
| 8 | +// RUN: %target-swift-frontend -emit-module %t/PublicLib.swift -o %t \ |
| 9 | +// RUN: -swift-version 5 -enable-library-evolution |
| 10 | +// RUN: %target-swift-frontend -emit-module %t/PackageLib.swift -o %t \ |
| 11 | +// RUN: -swift-version 5 -enable-library-evolution |
| 12 | +// RUN: %target-swift-frontend -emit-module %t/InternalLib.swift -o %t \ |
| 13 | +// RUN: -swift-version 5 -enable-library-evolution |
| 14 | +// RUN: %target-swift-frontend -emit-module %t/FileprivateLib.swift -o %t \ |
| 15 | +// RUN: -swift-version 5 -enable-library-evolution |
| 16 | +// RUN: %target-swift-frontend -emit-module %t/PrivateLib.swift -o %t \ |
| 17 | +// RUN: -swift-version 5 -enable-library-evolution |
| 18 | + |
| 19 | +/// Build client and generate swiftinterfaces. |
| 20 | +// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \ |
| 21 | +// RUN: -package-name TestPackage \ |
| 22 | +// RUN: -enable-library-evolution \ |
| 23 | +// RUN: -emit-module-interface-path %t/Client.swiftinterface \ |
| 24 | +// RUN: -emit-private-module-interface-path %t/Client.private.swiftinterface \ |
| 25 | +// RUN: -enable-experimental-feature AccessLevelOnImport |
| 26 | + |
| 27 | +// RUN: %target-swift-typecheck-module-from-interface(%t/Client.swiftinterface) -I %t |
| 28 | +// RUN: %target-swift-typecheck-module-from-interface(%t/Client.private.swiftinterface) -I %t \ |
| 29 | +// RUN: -module-name Client |
| 30 | + |
| 31 | +// RUN: %FileCheck -check-prefix=CHECK-PUBLIC %s < %t/Client.swiftinterface |
| 32 | +// RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/Client.private.swiftinterface |
| 33 | + |
| 34 | +/// Build a client composed of many files. |
| 35 | +// RUN: %target-swift-frontend -typecheck %t/MultiFiles?.swift -I %t \ |
| 36 | +// RUN: -package-name TestPackage \ |
| 37 | +// RUN: -enable-library-evolution \ |
| 38 | +// RUN: -emit-module-interface-path %t/MultiFiles.swiftinterface \ |
| 39 | +// RUN: -emit-private-module-interface-path %t/MultiFiles.private.swiftinterface \ |
| 40 | +// RUN: -enable-experimental-feature AccessLevelOnImport |
| 41 | + |
| 42 | +// RUN: %target-swift-typecheck-module-from-interface(%t/MultiFiles.swiftinterface) -I %t |
| 43 | +// RUN: %target-swift-typecheck-module-from-interface(%t/MultiFiles.private.swiftinterface) -I %t \ |
| 44 | +// RUN: -module-name MultiFiles |
| 45 | + |
| 46 | +// RUN: %FileCheck -check-prefix=CHECK-PUBLIC %s < %t/MultiFiles.swiftinterface |
| 47 | +// RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/MultiFiles.private.swiftinterface |
| 48 | + |
| 49 | +//--- PublicLib.swift |
| 50 | +//--- PackageLib.swift |
| 51 | +//--- InternalLib.swift |
| 52 | +//--- FileprivateLib.swift |
| 53 | +//--- PrivateLib.swift |
| 54 | + |
| 55 | +//--- Client.swift |
| 56 | +package import PackageLib |
| 57 | +// CHECK-PUBLIC-NOT: PackageLib |
| 58 | +// CHECK-PRIVATE-NOT: PackageLib |
| 59 | + |
| 60 | +internal import InternalLib |
| 61 | +// CHECK-PUBLIC-NOT: InternalLib |
| 62 | +// CHECK-PRIVATE-NOT: InternalLib |
| 63 | + |
| 64 | +fileprivate import FileprivateLib |
| 65 | +// CHECK-PUBLIC-NOT: FileprivateLib |
| 66 | +// CHECK-PRIVATE-NOT: FileprivateLib |
| 67 | + |
| 68 | +private import PrivateLib |
| 69 | +// CHECK-PUBLIC-NOT: PrivateLib |
| 70 | +// CHECK-PRIVATE-NOT: PrivateLib |
| 71 | + |
| 72 | +//--- MultiFilesA.swift |
| 73 | +public import PublicLib |
| 74 | +private import InternalLib |
| 75 | + |
| 76 | +//--- MultiFilesB.swift |
| 77 | +internal import PublicLib |
| 78 | +internal import InternalLib |
0 commit comments