Skip to content

Conversation

ma-oli
Copy link
Contributor

@ma-oli ma-oli commented Sep 5, 2025

-cxx-interoperability-mode currently needs to be passed as copts to targets who depend on C++ code, as seen in
examples/xplatform/cxx_from_swift.

This works in simple cases, but it currently fails if the swift_symbol_graph_aspect is applied on this target, as copts are not propagated to this action (rightfully, as not all copts will work).

So in order to make it work, we're turning this flag into a feature, and we add corresponding action configs to both the compile action and to the symbol_graph_extract action.

We're also enhancing the cxx_from_swift test by testing for this case. We're doing so by doing the following changes:

  • we're adding a swift_library() between the swift_binary() and the cc_library() targets
  • we're adding a new swift_extract_symbol_graph() target that depends on this new library

This test will fail if -cxx-interoperability-mode=default is not passed to swift-symbolgraph-extract.

-cxx-interoperability-mode currently needs to be passed as copts to
targets who depend on C++ code, as seen in
examples/xplatform/cxx_from_swift.

This works in simple cases, but it currently fails if the
`swift_symbol_graph_aspect` is applied on this target, as copts are not
propagated to this action (rightfully, as not all copts will work).

So in order to make it work, we're turning this flag into a feature, and
we add corresponding action configs to both the compile action and to
the symbol_graph_extract action.

We're also enhancing the cxx_from_swift test by testing for this case.
We're doing so by doing the following changes:
* we're adding a swift_library() between the swift_binary() and the
  cc_library() targets
* we're adding a new swift_extract_symbol_graph() target that depends on
  this new library

This test will fail if -cxx-interoperability-mode=default is not passed
to swift-symbolgraph-extract.
@ma-oli ma-oli force-pushed the add-cpp-interop-feature branch from e1b2ad7 to 8ee21e2 Compare September 8, 2025 19:26
@ma-oli
Copy link
Contributor Author

ma-oli commented Sep 8, 2025

Cc @allevato who recently pushed another fix wrt symbol extraction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant