[roll] Roll fuchsia [bazel] Fix `no_sdk = true` incrementality failures.

This fixes flaky incremental build failures introduced by using
`no_sdk = true` in GN `bazel_action()` target, by *completely*
refactoring the way the Bazel workspace is setup when
`--config=no_sdk` is used.

In a nutshell:

- Both `fx bazel` and `bazel_action.py` will change the workspace
  configuration, based on the presence of `--config=no_sdk` when
  invoking Bazel.

- When `--config=no_sdk` is not present, root Bazel files like
  `WORKSPACE.bazel` or `.bazelrc` will point to versions of these
  file that contain the full set of Fuchsia-related definitions,
  including the ones that define the `@fuchsia_sdk`.

- When `--config=no_sdk` is present, the same files will point
  to reduced versions that never define `@fuchsia_sdk` or other
  IDK/SDK-related repositories or settings.

By doing this, the content of $OUTPUT_BASE/external/fuchsia_sdk
is preserved when switching between fuchsia and non-sdk workspace
variants (which can happen in a single `fx build` invocation)
and the incrementality issues disappear.

This is a temporary work-around until the @fuchsia_in_tree_idk
can be generated at `fx gen` time directly, which will allow
removing this scheme.

- toplevel.WORKSPACE.bazel, toplevel.BUILD.bazel, template.bazelrc,
  template.platform_mappings: Move Fuchsia-specific definitions
  after a special marker line starting with "### FUCHSIA_SDK_CUTOFF"
  which is used to generate the no-sdk variants of these files
  by omitting that line and everything that follows it.

- workspace_utils.py: Add RootBazelFilesVariantsGenerator class
  to handle the generation of the multiple variants of root
  Bazel files in the workspace.

- bazel_utils.sh: Detect --config=no_sdk on the command-line
  and adjust the bazel_root_files symlink accordingly
  before launching Bazel.

- bazel_action.py: Do the same from Python.

- build/bazel/README.md: Fix a few obsolete paragraphs and
  add a new section documenting the behavior.

- build/bazel/examples/hello_no_sdk: Add a new bazel_action()
  target that sets `no_sdk = true`, and add it to the set of
  Bazel related tests to exercise switching between fuchsia
  and no_sdk bazel actions in CQ.

Original-Fixed: 401120294
Original-Bug: 322881092

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1253187
Original-Revision: a560caaa61a7ece94f19013869d06a41161f7eb9
GitOrigin-RevId: e817fda9d3de38937d4b12adaef3775e2c80e21e
Change-Id: I777866c781471cafbb5877847d5a84ae6ff0d70a
1 file changed
tree: 639ec32c9eca3377af884e0ae9210c469a9674e1
  1. ctf/
  2. git-hooks/
  3. infra/
  4. third_party/
  5. cts
  6. firmware
  7. flower
  8. jiri.lock
  9. MILESTONE
  10. minimal
  11. prebuilts
  12. README.md
  13. stem
  14. test_durations
  15. toolchain
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.