Skip to content

Conversation

@ma-oli
Copy link
Contributor

@ma-oli ma-oli commented Nov 11, 2025

Embedded swift is documented here:
https://www.swift.org/get-started/embedded/

This change does multiple things required to get a little closer to being able to build embedded code in rules_swift:

  • add a new swift.enable_embedded feature that automatically add the "-enable-experimental-feature Embedded" option to all swift compile actions
  • when the feature is enabled, WMO will also be enabled automatically, as this is a requirement when using swift-embedded
  • default alwayslink to False when the embedded feature is enabled. Indeed, when bulding for embedded, the features that require -force_load cannot be used, and we want the resulted binaries to be as small as possible.

Embedded swift is documented here:
https://www.swift.org/get-started/embedded/

This change does multiple things required to get a little closer to
being able to build embedded code in rules_swift:
* add a new swift.enable_embedded feature that automatically add the
  "-enable-experimental-feature Embedded" option to all swift compile
  actions
* when the feature is enabled, WMO will also be enabled automatically,
  as this is a requirement when using swift-embedded
* default alwayslink to False when the embedded feature is enabled.
  Indeed, when bulding for embedded, the features that require
  -force_load cannot be used, and we want the resulted binaries to be as
  small as possible.
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.

Thanks.

@adincebic adincebic merged commit 6a4f0bb into bazelbuild:master Nov 11, 2025
15 checks passed
@adincebic
Copy link
Contributor

In the end I would love to have working example in the examples dir once the upcoming changes around env vars land.

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.

3 participants