Commit Graph
2 Commits
Author SHA1 Message Date
Chandler Carruth a1a9c02cdc Refactor Bazel toolchain to use rules_cc action groups (#7086)
Rather than defining our own action groups, work to re-use the
`rules_cc` ones, as they are (much) more comprehensive. Also, completely
eliminate the `codegen` action group as it was not well used. For
example, `-march` flags and `-O` flags change the preprocessor macros
defined. There isn't a really great "codegen" heuristic, so just pass
those flags to all compiles which is simpler anyways.

I'm tempted to do the same with preprocessor actions, but maybe it makes
sense to have that one stay separate.

Assisted-by: Antigravity with Gemini
2026-04-21 16:40:24 +00:00
Chandler CarruthandGeoff Romer 3603ec7d54 Start refactoring toolchain config into separate files (#6587)
This moves the simplest parts of the toolchain config into separate
files. These parts are either unparameterized or trivially parameterized
and so easily extracted from the main file.

I tried to minimize the interesting edits here, but wasn't _completely_
successful I'm afraid. I'll try to describe them.

First, all of the interesting content of the new files is copied and
re-indented, no interesting edits were done.

The main file sees some more significant edits in order to realize this
refactoring:

- Extract the feature array building to a helper method.
- Collapse some extraneous features as there was no where to extract
them.
- Restructure how the array itself is built to support building it using
array fragments from the various files.

The only interesting semantic change I'm aware of here is that this
somewhat changes the order of command line flags in compiles and links.
The previous order was "fine", but not especially logical. I've tried to
more logically have features that should "override" or are "more
specific" come later here. However, that results in a slightly different
ordering. None of the current features had any flags that overlap, so
this should have no behavior change other than the changed flag order.

This is only the first step, however. There remain complex features in
the main configuration that I want to move out. However, to make those
moves simple requires some significant changes to how these remaining
features work and so I wanted to break them out. I've tried to leave
TODOs that can help as breadcrumbs on the parts of this refactoring that
aren't yet complete.

The comments also are mostly what we already had. I'm happy to try and
add some, but not sure how much I can cover as there is a _lot_ of code
here that I'm just moving around. Please let me know if there are
particularly places that would benefit from comments.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
2026-01-14 06:19:26 +00:00