|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %empty-directory(%t/clang-module-cache) |
| 3 | +// RUN: %empty-directory(%t/Foo.swiftmodule) |
| 4 | +// RUN: %empty-directory(%t/inputs) |
| 5 | +// RUN: echo "@_implementationOnly import A; public func foo() {}" > %t/Foo.swift |
| 6 | +// REQUIRES: executable_test |
| 7 | +// REQUIRES: objc_interop |
| 8 | + |
| 9 | +// Create the explicit module inputs map |
| 10 | +// RUN: echo "[{" > %/t/inputs/map.json |
| 11 | +// RUN: echo "\"moduleName\": \"Foo\"," >> %/t/inputs/map.json |
| 12 | +// RUN: echo "\"modulePath\": \"%/t/Foo.swiftmodule/%target-swiftmodule-name\"," >> %/t/inputs/map.json |
| 13 | +// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json |
| 14 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 15 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 16 | +// RUN: echo "\"moduleName\": \"Swift\"," >> %/t/inputs/map.json |
| 17 | +// RUN: echo "\"modulePath\": \"%/stdlib_module\"," >> %/t/inputs/map.json |
| 18 | +// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
| 19 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 20 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 21 | +// RUN: echo "\"moduleName\": \"SwiftOnoneSupport\"," >> %/t/inputs/map.json |
| 22 | +// RUN: echo "\"modulePath\": \"%/ononesupport_module\"," >> %/t/inputs/map.json |
| 23 | +// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
| 24 | +// RUN: echo "}," >> %/t/inputs/map.json |
| 25 | +// RUN: echo "{" >> %/t/inputs/map.json |
| 26 | +// RUN: echo "\"moduleName\": \"SwiftShims\"," >> %/t/inputs/map.json |
| 27 | +// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json |
| 28 | +// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json |
| 29 | +// RUN: echo "\"clangModulePath\": \"%t/inputs/SwiftShims.pcm\"" >> %/t/inputs/map.json |
| 30 | +// RUN: echo "}]" >> %/t/inputs/map.json |
| 31 | + |
| 32 | +// Emit the shims module PCM for explicit loading |
| 33 | +// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm |
| 34 | + |
| 35 | +@testable import Foo |
| 36 | + |
| 37 | +// Step 1: build Foo Swift module |
| 38 | +// RUN: %target-swift-frontend -emit-module %t/Foo.swift -emit-module-path %t/Foo.swiftmodule/%target-swiftmodule-name -module-name Foo -emit-module-interface-path %t/Foo.swiftmodule/%target-swiftinterface-name -enable-library-evolution -I %S/Inputs/CHeaders -I %S/Inputs/Swift -enable-testing -swift-version 5 -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import |
| 39 | + |
| 40 | +// Step 2: scan dependencies and ensure the transitive dependency on "A" is misssing |
| 41 | +// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -sdk %t -prebuilt-module-cache-path %t/clang-module-cache |
| 42 | +// RUN: %validate-json %t/deps.json | %FileCheck -check-prefix CHECK_SCAN %s |
| 43 | +// CHECK_SCAN-NOT: "swift": "A" |
| 44 | + |
| 45 | +// Step 3: Run an explicit module compile of this file ensuring object files are produced |
| 46 | +// RUN: %target-swift-frontend -emit-object -o %t/optional_transitive_dep_load_fail.o -disable-implicit-swift-modules -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -module-cache-path %t.module-cache -explicit-swift-module-map-file %t/inputs/map.json %s |
| 47 | + |
| 48 | +// Step 4: Ensure the resulting object file exists |
| 49 | +// RUN: ls %t/optional_transitive_dep_load_fail.o > /dev/null |
0 commit comments