commit | 9f3c13d209ec8ba79bd8759103aea06835e46416 | [log] [tgz] |
---|---|---|
author | adonovan <adonovan@google.com> | Tue Nov 17 12:05:14 2020 -0800 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Nov 17 12:07:28 2020 -0800 |
tree | 25ae0177455b64141c97fcdf8b816e124962e577 | |
parent | 146cd2cecae52ebad6664046fd1430c2a23b55e1 [diff] |
bazel actions: remove unchecked exceptions in command expansion CL 192288783 introduced Starlark evaluation into the execution phase, for lazily computed command lines. This created the possibility of errors, both deterministic (in evaluation) and nondeterministic (due to thread interruption) during the creation of command line arguments. Rather than handle the errors correctly by propagating them up to a point at which they could be dealt with, two hacks were used instead: (1) InterruptedExceptions were treated the same way as deterministic exceptions, leading to problems such as b/168033469 in which Ctrl-C interrupts cause errors that are cached, persisting until process restart. (2) Deterministic errors were wrapped in unchecked exceptions and tunneled through public API code. This change is an attempt to rectify the problems by bubbling up both kinds of errors---{CommandLineExpansion,Interrupted}Exception--- to a point at which they can be dealt with. In some cases (e.g. a toString method) all we can do is handle the exception, print some kind of error, and reassert the thread interrupt flag. In some cases (e.g. CommandLine.{arguments,addToFingerprint}) an interface that used to declare only 'throws CLEE' now declares both CLEE, IE, because the two kinds of errors have been separated. In other cases (e.g. ArgvFragment.{eval,addToFingerprint}) an interface now declares both exceptions where before it declared neither, because we no longer rely on unchecked exceptions to tunnel both kinds of errors. If this latter category seems too large and onerous, we could restore the use of unchecked exceptions for tunnelling across MapFn.expandToCommandLine. As the now-deleted TODO comment wryly notes, there are "numerous callers". PiperOrigin-RevId: 342915786
{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.
Follow our tutorials:
See CONTRIBUTING.md