Implement changes in symlink forest creation related to dont_symlink_directories_in_execroot.

This is a continuation of https://github.com/bazelbuild/bazel/pull/10589.

If dont_symlink_directories_in_execroot is used in WORKSPACE file with some directories (immediate children of the workspace root directory), do not symlink those directories under the execroot during symlink forest creation.
(See SymlinkForest class for more context, and also https://docs.bazel.build/versions/master/output_directories.html)

Normally, source directories are symlinked to the execroot, so that the actions can access the input (source) files.
In the case of Ninja execution (enabled with --experimental_ninja_actions flag), it is typical that the directory with build-related files contains source files for the build, and Ninja prescribes creation of the outputs in that same directory.
Since commands in the Ninja file use relative paths to address source files and directories, we must recreate the exact same directory structure under the execroot.

However, Bazel requires output directories to be separated from input directories: it is Bazel?s concept, not something that is related to this change or Ninja integration.

That is why Ninja build configuration directory (though it is part of the sources in the sense that it contains the source files) can not be directly symlinked to the execroot (if it was, the source tree would be changed by the build).

dont_symlink_directories_in_execroot can be used to specify that Ninja build configuration directories should not be symlinked to the execroot.
It is not expected that there could be other use cases for using this method.

Closes #10600.

PiperOrigin-RevId: 291681522
9 files changed
tree: 735344379aa515bb4d4b517e9878ca73ab0bed25
  1. .bazelci/
  2. examples/
  3. scripts/
  4. site/
  5. src/
  6. third_party/
  7. tools/
  8. .bazelrc
  9. .gitattributes
  10. .gitignore
  11. AUTHORS
  12. BUILD
  13. CHANGELOG.md
  14. CODEOWNERS
  15. combine_distfiles.py
  16. combine_distfiles_to_tar.sh
  17. compile.sh
  18. CONTRIBUTING.md
  19. CONTRIBUTORS
  20. distdir.bzl
  21. ISSUE_TEMPLATE.md
  22. LICENSE
  23. README.md
  24. WORKSPACE
README.md

Bazel

{Fast, Correct} - Choose two

Build and test software of any size, quickly and reliably.

  • Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.

  • One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.

  • Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.

  • Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.

Getting Started

Documentation

Contributing to Bazel

See CONTRIBUTING.md

Build status