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.

@ma-oli
Copy link
Contributor Author

ma-oli commented Sep 8, 2025

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

-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 8ee21e2 to 00a97cd Compare October 31, 2025 17:19
@ma-oli ma-oli requested a review from adincebic as a code owner October 31, 2025 17:19
Copy link
Contributor

@adincebic adincebic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Letting other maintainers review @keith @brentleyjones

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.

2 participants