[roll] Roll fuchsia [build][bazel] Create one @gn_targets directory per bazel_action() GN target.

This slightly simplifies and speeds up how the @gn_targets
external repository is generated in the Fuchsia build.

Before this CL, each bazel_action() invocation updated a
manifest file, that was read by a Bazel repository rule to
change the content of @gn_targets.

After this CL:

- Each bazel_action() call will also generate a target-specific
  directory containing the content of the corresponding
  @gn_targets repository.

- In toplevel.WORKSPACE.bazel, @gn_targets is defined with
  a local_repository() directive that points to
  fuchsia_build_generated/gn_targets_dir, a symlink that
  initially points to an empty workspace (just after 'fx gen').

- bazel_action.py, invoked from bazel_action(), will update
  the symlink to point to a target-specific location,
  just before invoking Bazel.

This is better in several ways:

- It is possible to inspect the @gn_targets content of
  different bazel_action() targets in the Ninja build
  directory, if needed.

- This avoids re-running a repository rule on each
  Bazel invocation, so slightly speeding it up.

- We now have proper unit-tests for the generation
  code!

This will be used to implement
`fx bazel-tool set-gn-targets <gn_label>` in a future
CL, which can be used before invoking `fx bazel` directly.

Another CL will also implement `fx build @<bazel_label>`
using a similar mechanism to populate a @gn_targets
repository based on a prior Bazel query, and ensure
the pointed inputs are first built with Ninja.

+ Add force_raw_symlink() to workspace_utils.py since
  absolute and relative target links must be explicitly
  specified for this to work correctly.

Original-Bug: 341258445
Original-Bug: 42084668
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1207007
Original-Revision: 84c531ea3493f0b9741b076e941d1b50c9159bf2
GitOrigin-RevId: 528260e78e7ef590bb1ce6f2b49b57d8e036f3ee
Change-Id: I50d95996565cd72e3c75a2a7f052aff41a841147
1 file changed
tree: 5d3623dadc251b4a3db097f7250e1edf618c9dfa
  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.