Skip to content

Conversation

@luispadron
Copy link
Contributor

@luispadron luispadron commented Sep 23, 2025

5.x base

This is the "base commits" for the upcoming 5.x (after 4.x drops WORKSPACE support). This PR primarily works towards syncing our swift_runner code with Google's upstream branch, in order to make maintaining it easier in the future as well as to pickup new features like parallel compilation (replacement for split derived files feature) and mixed language support (replacement for mixed_language_library).

At a high level 5.x will drop these features:

  • Incremental compilation
  • Persistent worker mode (only needed for incremental compilation)
  • Split derived files generation

Overall this should get us more in-sync with Googles changes and make cherry-picks easier, especially those to the runner/worker code which lately has been the majority of changes.

Breaking Changes

Commit Summary
ed867ea Remove support for incremental compilation mode.
307108d Remove support for persistent worker.
78e9a68 Fully remove split derived files feature.

Cherry-picks (Parallel Compilation)

Commit Summary
05d08ea Sync swift_runner code with upstream (as of 12-18-2025).
cca025a Remove remaining persistent worker support from the rules, keeping tool wrapping for Xcode placeholder substitution.
f853330 Add initial parallel compilation infrastructure.
8425381 Add initial parallel compilation support.
a359ec6 Disable parallel compilation when -O optimization flags are used (single frontend invocation required for cross-module optimization).
73f7559 Simplify single-batch codegen jobs by passing empty string instead of full object file list.
9abec74 Add tests for parallel compilation covering various optimization mode interactions.
7687374 Update parallel compilation to handle optimization correctly; disable cross-module optimization in exec configs.
8f895bd Detect -O flags set via --swiftcopt when planning parallel compilation.
5299c39 Fix edge case in compile planning when -c opt is used with -wmo on command line.

Fixes

Commit Summary Related Cherry-pick
65dbe11 Force swift.compile_in_parallel in tests that check specific mnemonics. 9abec74 (parallel compilation tests)
3ae61f0 Fix broken swift_runner progress messages. 05d08ea (swift_runner sync)
22aff3e Fix parallel compilation on Linux due to params file issue. 8425381 / a359ec6
3148da2 Rebase and fix conflicts with latest main.

@qyang-nj
Copy link
Contributor

Just curious: what's the motivation to remove incremental compilation?

@brentleyjones
Copy link
Collaborator

It's removed in Google's upstream branch. More context / us asking for feedback: https://bazelbuild.slack.com/archives/CD3QY5C2X/p1758578665272229.

@luispadron luispadron force-pushed the luis/4.x branch 6 times, most recently from 87abef8 to 6ab4bec Compare September 26, 2025 04:17
@luispadron luispadron force-pushed the luis/4.x branch 9 times, most recently from 6cd2df4 to 230b2dc Compare December 17, 2025 20:00
@luispadron luispadron changed the title WIP: rules_swift 4.x base WIP: rules_swift 5.x base Dec 18, 2025
@luispadron luispadron force-pushed the luis/4.x branch 10 times, most recently from 77976d4 to 8ed2fa4 Compare December 19, 2025 03:53
@luispadron luispadron changed the base branch from main to 5.x December 19, 2025 04:03
@luispadron luispadron changed the title WIP: rules_swift 5.x base Create 5.x base branch Dec 19, 2025
@luispadron luispadron marked this pull request as ready for review December 19, 2025 04:12
luispadron and others added 17 commits December 20, 2025 00:51
Up-to-date with upstream as of: 12-18-2025
…s themselves.

We leave in the ability for a tool to be configured that isn't wrapped by the worker, even though it isn't currently being used—all actions are currently wrapped, because they all need to, at a minimum, do Xcode placeholder substitution.

PiperOrigin-RevId: 576856156

Cherry-pick: 3997da2
…the -O group is being used.

Unless cross-module-optimization is disabled (which we don't really support at this time), the driver in this case will create a single frontend invocation that emits both the module and performs codegen.

Cherry-pick of upstream: 29f0ec2
…assing an empty string instead of the full list of object files.

This reduces unnecessary processing for huge modules with hundreds of source files.

Cherry-pick: c413bd3
… various optimization modes interact as we expect.

The tests highlight a couple cases that are currently known to be wrong so we can fix and test them without just manually building all possible combinations.

Chery-pick: f6302a2
…ctly.

Explicitly disable cross-module optimization in `exec` configs so that Swift tools can be built in parallel to speed up critical build paths.

Cherry-pic: d1ecc8a
…planning parallel compilation.

In the future, we should consider whether we should more strictly control where these flags can be applied, since they don't just control optimizations but also how the driver plans its work.

Cherry-pick: ab55a12
…`-c opt` is used and `-wmo` is passed on the command line.

Cherry-pick: 66a6a6b
@luispadron luispadron changed the base branch from 5.x to main December 20, 2025 05:58
@luispadron luispadron changed the base branch from main to 5.x December 20, 2025 05:58
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.

5 participants