[roll] Roll fuchsia [build_flags] Implement build_flags for fx_cc_{binary,library} + tests

This CL implements support for `build_flags()` target in the
`fx_cc_{binary,library}` macros from //build/bazel/rules/cc/.

- build_flags.bzl: Implement the compute_final_build_flags() rule,
  which computes the final set of build flags values that apply
  to a given wrapped target. This implements label de-duplication
  and removal from `disable_build_labels` arguments. Then exposes
  the result through a provider. The rule does not generate
  artifacts.

  Note that this does not deal with default toolchain
  build_flags() values for now, this will be introduced
  in a future CL.

- cc.bzl: Implement _cc_response_file() which generate a response
  file from the results of compute_final_build_flags(),
  filtering the flags for a specific C++ action type.

  Implement wrap_cc_macro_args_for_build_flags() which modifies
  the kwargs dictionary of an incoming `fx_cc_xxxx()` call
  to adjust compiler and linker flags appropriately. This
  ensures that the response files are used by each corresponding
  action type, and added as inputs using the right arguments.

fx_cc_binary.bzl and fx_cc_library.bzl are then modified
to call wrap_cc_macro_args_for_build_flags() with the right
arguments, in order to generate the final kwargs dictionary
passed to cc_binary() or cc_library(), respectively.

This also comes with a test suite, consisting of tiny programs
that check at runtime that they were compiled with the right
set of flags. It can be run with:

`fx bazel test --config=host //build/bazel/host_tests/build_flags/...`

Or more simply with:

`fx bazel test --config=host //build/bazel/host_tests`

Which also runs all other host test suites.

A future CL will modify the `rustc_xxx()` macros in a similar
way (and add support for Rust-specific response files in build_flags.bzl).

Another CL will modify the `fx bazel-tool expand <label> -- <config_args>`
command to recognize build flags response files in action command lines
and automatically expand them in the output with the right content.

Support for default toolchain build flags will appear in several
other CLs after that.

Original-Original-Bug: 516793642
Test: fx bazel test --config=host //build/bazel/host_tests/build_flags/...
Original-Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1650836
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Original-Original-Revision: 2adc5a91121f7513bc9bd524035aafff18ad1722
GitOrigin-RevId: 42c6f875b08f212d4335c434d8572d7127bb5e47
Change-Id: I0aeeb890aa10282fe774250eead3ba35830f754f
Reviewed-on: https://fuchsia-review.googlesource.com/c/integration/+/1687096
Cr-Commit-Position: refs/heads/main@{#195887}
1 file changed
tree: 1ede17d683ccb3e83cdd60daae9e717f74e1725b
  1. ctf/
  2. git-hooks/
  3. infra/
  4. third_party/
  5. cobalt
  6. flower
  7. jiri.lock
  8. MILESTONE
  9. minimal
  10. prebuilts
  11. README.md
  12. stem
  13. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance in one of the communication channels documented at get involved.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.