Allow CommandLine expansion to throw an exception.

This paves the way for Skylark-side compact command lines that can fail during expansion.

In general, expansion happens in these scenarios:

* Action execution expands the command line to execute it. This is fine since we are well equipped already to handle failing actions.

* In the analysis phase we expand command lines to investigate whether we need a params file. This could be moved to the execution phase, which would have the benefit of getting params files out of the action graph and saving memory.

* Key computation expands the command line. This could be fixed by allowing command lines to compute their own keys (which wouldn't try to expand the command line). This could have the benefit of being more efficient.

* Extra actions expand the command line to construct the extra action proto. This could maybe be deferred to the execution phase (writing the extra action), which would also be more memory efficient.

For failed key computations, we return a singleton "error" key. This means multiple actions that will fail will map to the same key. These actions will necessarily fail if executed, so we should not need to worry about these ending up in the action cache. If we do manage to make the command line compute its own keys then this will become moot in the future.

RELNOTES: None
PiperOrigin-RevId: 166266385
28 files changed
tree: f708d2e1132a71236307bb1bce3f2179b7701bad
  1. examples/
  2. scripts/
  3. site/
  4. src/
  5. third_party/
  6. tools/
  7. .gitattributes
  8. .gitignore
  9. AUTHORS
  10. BUILD
  11. CHANGELOG.md
  12. combine_distfiles.py
  13. combine_distfiles_to_tar.sh
  14. compile.sh
  15. CONTRIBUTING.md
  16. CONTRIBUTORS
  17. ISSUE_TEMPLATE.md
  18. LICENSE
  19. README.md
  20. 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 only rebuilds 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 system. 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

Bazel is released in ‘Beta’. See the product roadmap to learn about the path toward a stable 1.0 release.