|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: split-file %s %t |
| 3 | + |
| 4 | +// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O -module-cache-path %t/clang-module-cache \ |
| 5 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
| 6 | +// RUN: -import-objc-header %t/base/Bridging.h -scanner-output-dir %t -auto-bridging-header-chaining -scanner-debug-write-output \ |
| 7 | +// RUN: %t/base/test.swift %t/base/foo.swift -I %t/include -o %t/deps.json -cache-compile-job -cas-path %t/cas |
| 8 | + |
| 9 | +// RUN: %{python} %S/../CAS/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd |
| 10 | +// RUN: %swift_frontend_plain @%t/shim.cmd |
| 11 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:Dummy > %t/dummy.cmd |
| 12 | +// RUN: %swift_frontend_plain @%t/dummy.cmd |
| 13 | + |
| 14 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json |
| 15 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid |
| 16 | + |
| 17 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json bridgingHeader > %t/header.cmd |
| 18 | +// RUN: %target-swift-frontend @%t/header.cmd -disable-implicit-swift-modules -O -o %t/bridging.pch |
| 19 | +// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \ |
| 20 | +// RUN: %target-swift-frontend @%t/header.cmd -disable-implicit-swift-modules -O -o %t/bridging.pch > %t/keys.json |
| 21 | +// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/keys.json > %t/key |
| 22 | + |
| 23 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd |
| 24 | +// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd |
| 25 | +// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd |
| 26 | +// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd |
| 27 | +// RUN: echo "\"-import-objc-header\"" >> %t/MyApp.cmd |
| 28 | +// RUN: echo "\"%t/base/Bridging.h\"" >> %t/MyApp.cmd |
| 29 | +// RUN: echo "\"-import-pch\"" >> %t/MyApp.cmd |
| 30 | +// RUN: echo "\"%t/bridging.pch\"" >> %t/MyApp.cmd |
| 31 | +// RUN: echo "\"-bridging-header-pch-key\"" >> %t/MyApp.cmd |
| 32 | +// RUN: echo "\"@%t/key\"" >> %t/MyApp.cmd |
| 33 | +// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd |
| 34 | +// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd |
| 35 | + |
| 36 | +// RUN: sed -e "s@VFS_DIR@%{/t:regex_replacement}/base@g" -e "s@EXTERNAL_DIR@%{/t:regex_replacement}/modified@g" %t/base.yaml > %t/overlay.yaml |
| 37 | + |
| 38 | +// RUN: %target-swift-frontend %t/base/test.swift %t/base/foo.swift -O -emit-module -emit-module-path %t/Test.swiftmodule -c \ |
| 39 | +// RUN: -module-name Test -o %t/test.o -cas-path %t/cas @%t/MyApp.cmd -vfsoverlay %t/overlay.yaml -module-import-from-cas |
| 40 | + |
| 41 | + |
| 42 | +//--- base/test.swift |
| 43 | +import Dummy |
| 44 | +public func testFunc() { |
| 45 | + non_existing_func() |
| 46 | +} |
| 47 | + |
| 48 | +//--- base/foo.swift |
| 49 | +public func foo() {} |
| 50 | + |
| 51 | +//--- modified/test.swift |
| 52 | +import Dummy |
| 53 | +public func testFunc() { |
| 54 | + dummy() |
| 55 | + bridge() |
| 56 | +} |
| 57 | + |
| 58 | +//--- base/Bridging.h |
| 59 | +void bridge(void); |
| 60 | + |
| 61 | +//--- include/module.modulemap |
| 62 | +module Dummy { |
| 63 | + umbrella header "Dummy.h" |
| 64 | +} |
| 65 | + |
| 66 | +//--- include/Dummy.h |
| 67 | +void dummy(void); |
| 68 | + |
| 69 | +//--- base.yaml |
| 70 | +{ |
| 71 | + version: 0, |
| 72 | + roots: [ |
| 73 | + { |
| 74 | + type: "directory-remap", |
| 75 | + name: "VFS_DIR", |
| 76 | + external-contents: "EXTERNAL_DIR" |
| 77 | + } |
| 78 | + ] |
| 79 | +} |
0 commit comments