Skip to content

Commit d1e36b0

Browse files
committed
[Sema|lit] Intro lit substitution for generating the 2 swiftinterfaces
Intro the lit substitution `%target-swift-emit-module-interfaces(Main.swiftinterface, Main.private.swiftinterface` to generate both the public and private swiftinterface. And use it in spi-only-import-exportability.swift. To verify the generated interfaces I would recommend to keep two calls to `%target-swift-typecheck-module-from-interface` as each is a different invocation likely to fail.
1 parent 021dc8e commit d1e36b0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

docs/Testing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ code for the target that is not the build machine:
344344
swiftinterface to the given path and passing additional default flags
345345
appropriate for resilient frameworks.
346346

347+
* ``%target-swift-emit-module-interfaces(`` *swift interface path*,
348+
*swift private interface path* ``)`` *other arguments*:
349+
run ``swift-frontend`` for the target, emitting both swiftinterfaces
350+
to the given paths and passing additional default flags appropriate for
351+
resilient frameworks.
352+
347353
* ``%target-swift-typecheck-module-from-interface(`` *swift interface path*
348354
``)`` *other arguments*: run ``swift-frontend`` for the target, verifying
349355
the swiftinterface at the given path and passing additional default flags

test/SPI/spi-only-import-exportability.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
// RUN: -enable-library-evolution
2121

2222
/// Generate the swiftinterface of the working code and verify it.
23-
// RUN: %target-swift-emit-module-interface(%t/Client.swiftinterface) \
23+
// RUN: %target-swift-emit-module-interfaces(%t/Client.swiftinterface, %t/Client.private.swiftinterface) \
2424
// RUN: %t/Client.swift -I %t -DSKIP_ERRORS \
2525
// RUN: -experimental-spi-only-imports
2626
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.swiftinterface) -I %t
27+
// RUN: %target-swift-typecheck-module-from-interface(%t/Client.private.swiftinterface) -I %t
2728

2829

2930
//--- PublicLib.swift

test/lit.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,8 @@ config.substitutions.append(('%target-pic-opt', config.target_pic_opt))
23002300
config.substitutions.append(('%target-msvc-runtime-opt',
23012301
config.target_msvc_runtime_opt))
23022302

2303+
config.substitutions.append(('%target-swift-emit-module-interfaces\(([^)]+),\w*([^)]+)\)',
2304+
SubstituteCaptures(r'%target-swift-emit-module-interface(\1) -emit-private-module-interface-path \2')))
23032305
config.substitutions.append(('%target-swift-emit-module-interface\(([^)]+)\)',
23042306
SubstituteCaptures(r'%target-swift-frontend -swift-version 5 -enable-library-evolution -typecheck -emit-module-interface-path \1')))
23052307

0 commit comments

Comments
 (0)