|
| 1 | +// REQUIRES: objc_interop |
| 2 | +// RUN: %empty-directory(%t) |
| 3 | +// RUN: %empty-directory(%t/module-cache) |
| 4 | +// RUN: %empty-directory(%t/inputs) |
| 5 | + |
| 6 | +// RUN: %empty-directory(%t/mock.sdk/System/Library/Frameworks/A.framework/Modules/A.swiftmodule) |
| 7 | +// RUN: %empty-directory(%t/mock.sdk/System/Library/Frameworks/A.framework/Headers) |
| 8 | +// RUN: %empty-directory(%t/mock.sdk/System/Library/Frameworks/CycleKit.framework/Modules/CycleKit.swiftmodule) |
| 9 | +// RUN: %empty-directory(%t/mock.sdk/System/Library/Frameworks/CycleKit.framework/Headers) |
| 10 | + |
| 11 | +// RUN: split-file %s %t |
| 12 | + |
| 13 | +// RUN: cp %t/inputs/A.swiftinterface %t/mock.sdk/System/Library/Frameworks/A.framework/Modules/A.swiftmodule/%target-swiftinterface-name |
| 14 | +// RUN: cp %t/inputs/framework_A.modulemap %t/mock.sdk/System/Library/Frameworks/A.framework/Modules/module.modulemap |
| 15 | +// RUN: cp %t/inputs/A-framework.h %t/mock.sdk/System/Library/Frameworks/A.framework/Headers/A.h |
| 16 | + |
| 17 | +// RUN: cp %t/inputs/CycleKit.swiftinterface %t/mock.sdk/System/Library/Frameworks/CycleKit.framework/Modules/CycleKit.swiftmodule/%target-swiftinterface-name |
| 18 | +// RUN: cp %t/inputs/framework_CycleKit.modulemap %t/mock.sdk/System/Library/Frameworks/CycleKit.framework/Modules/module.modulemap |
| 19 | +// RUN: cp %t/inputs/CycleKit.h %t/mock.sdk/System/Library/Frameworks/CycleKit.framework/Headers/CycleKit.h |
| 20 | + |
| 21 | +// Non-SDK dependency shadowing |
| 22 | +// RUN: not %target-swift-frontend -scan-dependencies -module-cache-path %t/module-cache %t/test.swift -o %t/deps.json -I %t/inputs -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -module-name CycleKit &> %t/out.txt |
| 23 | +// RUN: %FileCheck --check-prefix=CHECK-NONSDK %s < %t/out.txt |
| 24 | + |
| 25 | +// CHECK-NONSDK: note: source target 'CycleKit' shadowing a Swift module with the same name at: '{{.*}}{{/|\\}}diagnose_dependency_cycle_shadow.swift.tmp{{/|\\}}inputs' |
| 26 | + |
| 27 | +// SDK dependency shadowing |
| 28 | +// RUN: not %target-swift-frontend -scan-dependencies -module-cache-path %t/module-cache %t/test.swift -o %t/deps.json -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -module-name CycleKit -sdk %t/mock.sdk &> %t/out-sdk.txt |
| 29 | +// RUN: %FileCheck --check-prefix=CHECK-SDK %s < %t/out-sdk.txt |
| 30 | + |
| 31 | +// CHECK-SDK: note: source target 'CycleKit' shadowing an SDK Swift module with the same name at: '{{.*}}{{/|\\}}mock.sdk{{/|\\}}System{{/|\\}}Library{{/|\\}}Frameworks{{/|\\}}CycleKit.framework{{/|\\}}Modules{{/|\\}}CycleKit.swiftmodule' |
| 32 | + |
| 33 | +//--- test.swift |
| 34 | +import A |
| 35 | + |
| 36 | +//--- inputs/CycleKit.swiftinterface |
| 37 | +// swift-interface-format-version: 1.0 |
| 38 | +// swift-module-flags: -module-name CycleKit -enable-library-evolution |
| 39 | + |
| 40 | +public func CycleKitFunc() {} |
| 41 | + |
| 42 | +//--- inputs/A.swiftinterface |
| 43 | +// swift-interface-format-version: 1.0 |
| 44 | +// swift-module-flags: -module-name A -enable-library-evolution |
| 45 | +@_exported import A |
| 46 | +public func AFunc() {} |
| 47 | + |
| 48 | +//--- inputs/A.h |
| 49 | +#import <CycleKit.h> |
| 50 | +void funcA(void); |
| 51 | + |
| 52 | +//--- inputs/A-framework.h |
| 53 | +#import <CycleKit/CycleKit.h> |
| 54 | +void funcA(void); |
| 55 | + |
| 56 | +//--- inputs/CycleKit.h |
| 57 | +void funcCycleKit(void); |
| 58 | + |
| 59 | +//--- inputs/module.modulemap |
| 60 | +module A { |
| 61 | + header "A.h" |
| 62 | + export * |
| 63 | +} |
| 64 | + |
| 65 | +module CycleKit { |
| 66 | + header "CycleKit.h" |
| 67 | + export * |
| 68 | +} |
| 69 | + |
| 70 | +//--- inputs/framework_A.modulemap |
| 71 | +framework module A { |
| 72 | + header "A.h" |
| 73 | + export * |
| 74 | +} |
| 75 | + |
| 76 | +//--- inputs/framework_CycleKit.modulemap |
| 77 | +framework module CycleKit { |
| 78 | + header "CycleKit.h" |
| 79 | + export * |
| 80 | +} |
0 commit comments