|
4 | 4 | // RUN: mkdir -p %t/clang-module-cache
|
5 | 5 | // RUN: mkdir -p %t/cas
|
6 | 6 | // RUN: split-file %s %t
|
7 |
| -// RUN: %hmaptool write %t/hmap.json %t/empty.hmap |
| 7 | +// RUN: sed "s|DIR|%/t|g" %t/hmap.json.template > %t/hmap.json |
| 8 | +// RUN: sed "s|DIR|%/t|g" %t/test.yaml.template > %t/test.yaml |
| 9 | +// RUN: %hmaptool write %t/hmap.json %t/test.hmap |
8 | 10 |
|
9 | 11 | // RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache \
|
10 |
| -// RUN: %t/Test.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas \ |
11 |
| -// RUN: -Xcc -fmodule-map-file=%t/module.modulemap -Xcc -ivfsoverlay -Xcc %t/empty.yaml \ |
12 |
| -// RUN: -Xcc -I%t/empty.hmap |
| 12 | +// RUN: %t/Test.swift -module-name Test -o %t/deps.json -cache-compile-job -cas-path %t/cas \ |
| 13 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ |
| 14 | +// RUN: -Xcc -fmodule-map-file=%t/include/module.modulemap -Xcc -ivfsoverlay -Xcc %t/test.yaml \ |
| 15 | +// RUN: -Xcc -I%t/test.hmap -module-load-mode prefer-serialized -scanner-output-dir %t \ |
| 16 | +// RUN: -import-objc-header %t/Bridge.h -auto-bridging-header-chaining |
13 | 17 | // RUN: %validate-json %t/deps.json &>/dev/null
|
14 | 18 |
|
15 |
| -// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/fs.casid |
| 19 | +// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json Test casFSRootID > %t/fs.casid |
16 | 20 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-include-tree-list @%t/fs.casid | %FileCheck %s -DDIR=%basename_t -check-prefix FS_ROOT
|
17 |
| -// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:Dummy clangIncludeTree > %t/tree.casid |
18 |
| -// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/tree.casid | %FileCheck %s -DDIR=%basename_t -check-prefix INCLUDE_TREE |
19 | 21 |
|
20 |
| -// FS_ROOT: [[DIR]].tmp/empty.hmap |
21 |
| -// FS_ROOT: [[DIR]].tmp/empty.yaml |
| 22 | +// FS_ROOT: [[DIR]].tmp/hidden/Dummy.h |
| 23 | +// FS_ROOT: [[DIR]].tmp/hidden/a.h |
| 24 | +// FS_ROOT: [[DIR]].tmp/hidden/b.h |
22 | 25 |
|
23 |
| -// INCLUDE_TREE: [[DIR]].tmp/Dummy.h |
| 26 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd |
| 27 | +// RUN: %swift_frontend_plain @%t/shim.cmd |
| 28 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:Dummy > %t/dummy.cmd |
| 29 | +// RUN: %swift_frontend_plain @%t/dummy.cmd |
| 30 | + |
| 31 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json bridgingHeader > %t/header.cmd |
| 32 | +// RUN: %target-swift-frontend @%t/header.cmd -disable-implicit-swift-modules -O -o %t/objc.pch |
| 33 | +// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \ |
| 34 | +// RUN: %target-swift-frontend @%t/header.cmd -disable-implicit-swift-modules -O -o %t/objc.pch > %t/keys.json |
| 35 | +// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/keys.json > %t/key |
| 36 | + |
| 37 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json |
| 38 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid |
| 39 | + |
| 40 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd |
| 41 | +// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd |
| 42 | +// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd |
| 43 | +// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd |
| 44 | +// RUN: echo "\"-import-objc-header\"" >> %t/MyApp.cmd |
| 45 | +// RUN: echo "\"%t/objc.pch\"" >> %t/MyApp.cmd |
| 46 | +// RUN: echo "\"-bridging-header-pch-key\"" >> %t/MyApp.cmd |
| 47 | +// RUN: echo "\"@%t/key\"" >> %t/MyApp.cmd |
| 48 | +// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd |
| 49 | +// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd |
| 50 | + |
| 51 | +// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd %t/Test.swift \ |
| 52 | +// RUN: -emit-module -o %t/test.swiftmodule |
24 | 53 |
|
25 | 54 | //--- Test.swift
|
26 | 55 | import Dummy
|
27 | 56 | func test() {}
|
28 | 57 |
|
29 |
| -//--- module.modulemap |
| 58 | +//--- Bridge.h |
| 59 | +#include "b.h" |
| 60 | + |
| 61 | +//--- hidden/module.modulemap |
30 | 62 | module Dummy {
|
31 | 63 | umbrella header "Dummy.h"
|
32 | 64 | }
|
33 | 65 |
|
34 |
| -//--- Dummy.h |
| 66 | +//--- hidden/Dummy.h |
| 67 | +#include "a.h" |
35 | 68 | void dummy(void);
|
36 | 69 |
|
37 |
| -//--- hmap.json |
| 70 | +//--- hidden/a.h |
| 71 | +/* empty file */ |
| 72 | + |
| 73 | +//--- hidden/b.h |
| 74 | +/* empty file */ |
| 75 | + |
| 76 | +//--- hmap.json.template |
38 | 77 | {
|
39 |
| - "mappings": {} |
| 78 | + "mappings": { |
| 79 | + "a.h": "DIR/hidden/a.h", |
| 80 | + "b.h": "DIR/hidden/b.h" |
| 81 | + } |
40 | 82 | }
|
41 | 83 |
|
42 |
| -//--- empty.yaml |
| 84 | +//--- test.yaml.template |
43 | 85 | {
|
44 | 86 | "version": 0,
|
45 | 87 | "case-sensitive": "false",
|
46 | 88 | "use-external-names": true,
|
47 |
| - "roots": [] |
| 89 | + "roots": [ |
| 90 | + { |
| 91 | + "type": "file", |
| 92 | + "name": "DIR/include/module.modulemap", |
| 93 | + "external-contents": "DIR/hidden/module.modulemap" |
| 94 | + }, |
| 95 | + { |
| 96 | + "type": "file", |
| 97 | + "name": "DIR/include/Dummy.h", |
| 98 | + "external-contents": "DIR/hidden/Dummy.h" |
| 99 | + }, |
| 100 | + ] |
48 | 101 | }
|
49 | 102 |
|
0 commit comments