|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %empty-directory(%t/clang-module-cache) |
| 3 | +// RUN: %empty-directory(%t/PCH) |
| 4 | +// RUN: %empty-directory(%t/SwiftModules) |
| 5 | + |
| 6 | +// - Set up Foo Swift dependency |
| 7 | +// RUN: echo "extension Profiler {" >> %t/foo.swift |
| 8 | +// RUN: echo " public static let count: Int = 42" >> %t/foo.swift |
| 9 | +// RUN: echo "}" >> %t/foo.swift |
| 10 | + |
| 11 | +// - Set up Foo bridging header |
| 12 | +// RUN: echo "struct Profiler { void* ptr; };" >> %t/foo.h |
| 13 | + |
| 14 | +// - Compile bridging header |
| 15 | +// RUN: %target-swift-frontend -enable-objc-interop -emit-pch %t/foo.h -o %t/PCH/foo.pch -disable-implicit-swift-modules |
| 16 | + |
| 17 | +// - Set up explicit dependencies for Foo |
| 18 | +// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm |
| 19 | +// RUN: %target-swift-emit-pcm -module-name _SwiftConcurrencyShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/_SwiftConcurrencyShims.pcm |
| 20 | +// RUN: echo "[{" > %t/foo_inputs_map.json |
| 21 | +// RUN: echo "\"moduleName\": \"Swift\"," >> %t/foo_inputs_map.json |
| 22 | +// RUN: echo "\"modulePath\": \"%/stdlib_module\"," >> %t/foo_inputs_map.json |
| 23 | +// RUN: echo "\"isFramework\": false" >> %t/foo_inputs_map.json |
| 24 | +// RUN: echo "}," >> %t/foo_inputs_map.json |
| 25 | +// RUN: echo "{" >> %t/foo_inputs_map.json |
| 26 | +// RUN: echo "\"moduleName\": \"SwiftOnoneSupport\"," >> %t/foo_inputs_map.json |
| 27 | +// RUN: echo "\"modulePath\": \"%/ononesupport_module\"," >> %t/foo_inputs_map.json |
| 28 | +// RUN: echo "\"isFramework\": false" >> %t/foo_inputs_map.json |
| 29 | +// RUN: echo "}," >> %t/foo_inputs_map.json |
| 30 | +// RUN: echo "{" >> %t/foo_inputs_map.json |
| 31 | +// RUN: echo "\"moduleName\": \"_StringProcessing\"," >> %t/foo_inputs_map.json |
| 32 | +// RUN: echo "\"modulePath\": \"%/string_processing_module\"," >> %t/foo_inputs_map.json |
| 33 | +// RUN: echo "\"isFramework\": false" >> %t/foo_inputs_map.json |
| 34 | +// RUN: echo "}," >> %t/foo_inputs_map.json |
| 35 | +// RUN: echo "{" >> %t/foo_inputs_map.json |
| 36 | +// RUN: echo "\"moduleName\": \"SwiftShims\"," >> %t/foo_inputs_map.json |
| 37 | +// RUN: echo "\"isFramework\": false," >> %t/foo_inputs_map.json |
| 38 | +// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %t/foo_inputs_map.json |
| 39 | +// RUN: echo "\"clangModulePath\": \"%t/inputs/SwiftShims.pcm\"" >> %t/foo_inputs_map.json |
| 40 | +// RUN: echo "}," >> %t/foo_inputs_map.json |
| 41 | +// RUN: echo "{" >> %t/foo_inputs_map.json |
| 42 | +// RUN: echo "\"moduleName\": \"_SwiftConcurrencyShims\"," >> %t/foo_inputs_map.json |
| 43 | +// RUN: echo "\"isFramework\": false," >> %t/foo_inputs_map.json |
| 44 | +// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %t/foo_inputs_map.json |
| 45 | +// RUN: echo "\"clangModulePath\": \"%t/inputs/_SwiftConcurrencyShims.pcm\"" >> %t/foo_inputs_map.json |
| 46 | +// RUN: echo "}]" >> %t/foo_inputs_map.json |
| 47 | + |
| 48 | +// - Build Foo module dependency, explicitly |
| 49 | +// RUN: %target-swift-frontend -emit-module -emit-module-path %t/SwiftModules/Foo.swiftmodule %t/foo.swift -module-name Foo -import-objc-header %t/PCH/foo.pch -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -disable-implicit-swift-modules -explicit-swift-module-map-file %t/foo_inputs_map.json |
| 50 | + |
| 51 | +// - Scan main module |
| 52 | +// RUN: %target-swift-frontend -scan-dependencies %s -I %t/SwiftModules -o %t/deps.json |
| 53 | +// RUN: %FileCheck %s --input-file %t/deps.json |
| 54 | + |
| 55 | +// Ensure 'Foo' header dependency is captured |
| 56 | +// CHECK: "swiftPrebuiltExternal": "Foo" |
| 57 | +// CHECK: "swiftPrebuiltExternal": "Foo" |
| 58 | +// CHECK: "headerDependencies": [ |
| 59 | +// CHECK: "{{.*}}{{/|\\}}PCH{{/|\\}}foo.pch" |
| 60 | +// CHECK: ], |
| 61 | + |
| 62 | +import Foo |
| 63 | +print(Profiler.count) |
0 commit comments