|  | 
|  | 1 | +// REQUIRES: objc_interop | 
|  | 2 | +// UNSUPPORTED: swift_only_stable_abi | 
|  | 3 | + | 
|  | 4 | +// RUN: %empty-directory(%t) | 
|  | 5 | +// RUN: split-file %s %t | 
|  | 6 | + | 
|  | 7 | +/// Build legacy module. | 
|  | 8 | +// RUN: %target-swift-frontend -target %target-pre-stable-abi-triple -emit-module -enable-library-evolution \ | 
|  | 9 | +// RUN:   -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct -O \ | 
|  | 10 | +// RUN:   -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ | 
|  | 11 | +// RUN:   %S/../Inputs/resilient_struct.swift | 
|  | 12 | + | 
|  | 13 | +/// Scan with legacy layout. | 
|  | 14 | +// RUN: %target-swift-frontend -target %target-pre-stable-abi-triple -I %t -c -enable-library-evolution -read-legacy-type-info-path=%t/layout.yaml \ | 
|  | 15 | +// RUN:   -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache -O -module-load-mode prefer-serialized \ | 
|  | 16 | +// RUN:   -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ | 
|  | 17 | +// RUN:   %t/main.swift -o %t/deps.json -swift-version 4 -cache-compile-job -cas-path %t/cas \ | 
|  | 18 | +// RUN:   -scanner-prefix-map-paths %t /^tmp | 
|  | 19 | + | 
|  | 20 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd | 
|  | 21 | +// RUN: %swift_frontend_plain @%t/shim.cmd | 
|  | 22 | + | 
|  | 23 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json | 
|  | 24 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid | 
|  | 25 | + | 
|  | 26 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd | 
|  | 27 | + | 
|  | 28 | +// RUN: %target-swift-frontend -target %target-pre-stable-abi-triple -enable-library-evolution \ | 
|  | 29 | +// RUN:   -cache-compile-job -cas-path %t/cas -O \ | 
|  | 30 | +// RUN:   -swift-version 4 -disable-implicit-swift-modules \ | 
|  | 31 | +// RUN:   -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ | 
|  | 32 | +// RUN:   -module-name Test -explicit-swift-module-map-file @%t/map.casid \ | 
|  | 33 | +// RUN:   /^tmp/main.swift @%t/MyApp.cmd -c -o %t/main.o | 
|  | 34 | + | 
|  | 35 | +/// Now do implicit search. | 
|  | 36 | +// RUN: mkdir -p %t/resource/macosx | 
|  | 37 | +// RUN: cp %t/layout.yaml %t/resource/macosx/layouts-%target-arch.yaml | 
|  | 38 | + | 
|  | 39 | +// RUN: %target-swift-frontend -target %target-pre-stable-abi-triple -I %t -c -enable-library-evolution \ | 
|  | 40 | +// RUN:   -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache -O -module-load-mode prefer-serialized \ | 
|  | 41 | +// RUN:   -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ | 
|  | 42 | +// RUN:   %t/main.swift -o %t/deps2.json -swift-version 4 -cache-compile-job -cas-path %t/cas \ | 
|  | 43 | +// RUN:   -scanner-prefix-map-paths %t /^tmp -resource-dir %t/resource -I %platform-dylib-dir | 
|  | 44 | + | 
|  | 45 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps2.json clang:SwiftShims > %t/shim2.cmd | 
|  | 46 | +// RUN: %swift_frontend_plain @%t/shim2.cmd | 
|  | 47 | + | 
|  | 48 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps2.json > %t/map2.json | 
|  | 49 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map2.json > %t/map2.casid | 
|  | 50 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps2.json Test > %t/MyApp2.cmd | 
|  | 51 | + | 
|  | 52 | +// RUN: %target-swift-frontend -target %target-pre-stable-abi-triple -enable-library-evolution \ | 
|  | 53 | +// RUN:   -cache-compile-job -cas-path %t/cas -O \ | 
|  | 54 | +// RUN:   -swift-version 4 -disable-implicit-swift-modules \ | 
|  | 55 | +// RUN:   -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \ | 
|  | 56 | +// RUN:   -module-name Test -explicit-swift-module-map-file @%t/map2.casid \ | 
|  | 57 | +// RUN:   /^tmp/main.swift @%t/MyApp2.cmd -c -o %t/main.o | 
|  | 58 | + | 
|  | 59 | +//--- main.swift | 
|  | 60 | +import resilient_struct | 
|  | 61 | + | 
|  | 62 | +public class ClassWithResilientRef { | 
|  | 63 | +  var first: ResilientRef? = nil | 
|  | 64 | +  var second: Int = 0 | 
|  | 65 | +} | 
|  | 66 | + | 
|  | 67 | +//--- layout.yaml | 
|  | 68 | +Name:            resilient_struct | 
|  | 69 | +Decls: | 
|  | 70 | +  - Name:            16resilient_struct12ResilientRefV | 
|  | 71 | +    Size:            8 | 
|  | 72 | +    Alignment:       8 | 
|  | 73 | +    ExtraInhabitants: 4096 | 
0 commit comments