commit | 859c9acc895d7e1add7e52b9b2a4c43718b4c352 | [log] [tgz] |
---|---|---|
author | mschaller <mschaller@google.com> | Fri Sep 25 16:09:19 2020 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Fri Sep 25 16:10:25 2020 -0700 |
tree | e92caa806130f87b88e2c29b7eecbb338b57cf2e | |
parent | 11102e367790f07810d9a69bdae081fb106a4147 [diff] |
Encode ViewCreation failures with FailureDetails Bazel's analysis phase can fail with a ViewCreationFailedException, encompassing a variety of loading, analysis, and post-analysis evaluation problems. This change equips that exception with FailureDetails and eliminates the final use of (non-success) DetailedExitCode without FailureDetails. Before this change, a ViewCreationFailedException (VCFE) always led to a numerical exit code of 1. To ensure backwards compatibility, this change uses the DetailedExitCode factory method which overrides the numerical exit code metadata from failure_detail.proto. Most of the detailed failure subcategories that can end up in a VCFE do have metadata specifying 1 as their numerical exit code, but not all; e.g., post-analysis query evaluation failures can cause a VCFE and, as query failures, have 2 or 7 for their metadata. Ensuring the propagation of failure details from analysis to the VCFE required the following work. SkyframeBuildView translated analysis exceptions, designated via the marker interface SaneAnalysisException, into VCFEs. Likewise, it translated the loading-phase exceptions NoSuch{Package,Target}Exception into VCFEs. By making SaneAnalysisException extend DetailedException, that conversion now propagates any detailed failures described by those three exception types. SaneAnalysisException has six implementations. This change implements DetailedException across them. Doing so with AspectCreationException and ConfiguredValueCreationException involved moderately complex work. In AspectFunction and ConfiguredTargetFunction, these two exception types get instantiated when a nested set of "Cause"s is non-empty (and also in several other more straightforward contexts). "Cause" had already been equipped with a DetailedExitCode property, but AnalysisFailedCause didn't support it (Cause's other implementations did). This change implements the property for AnalysisFailedCause. The nested set traversal in ConfiguredTargetFunction.getPrioritizedDetailedExitCode does not involve any deep traversals, though that's not obvious. If the nested set builder ever gets another nested set added to it via addTransitive, then it does so while handling a dependency's exception, which results in a DependencyEvaluationException, whose handling avoids the call to getPrioritizedDetailedExitCode. This change does *not* detail analysis failures in maximum resolution. To do so, a future change would need to enhance the error-event-sensitive failure detection in AspectFunction and ConfiguredTargetFunction, using e.g. the events-with-properties strategy used by ErrorSensingEventHandler. It would also need to replace the non-detailed AspectCreationException and ConfiguredValueCreationException constructors. RELNOTES: None. PiperOrigin-RevId: 333827282
{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