commit | fa05a104a1767c327b23c01ccd6197713b646502 | [log] [tgz] |
---|---|---|
author | Googler <mschaller@google.com> | Thu Sep 15 05:53:13 2022 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Sep 15 05:54:19 2022 -0700 |
tree | 890545f232b84670fd6c7d11dcf8263b4c3033aa | |
parent | 09978b6ce93f379509a68141254438e4138677b4 [diff] |
Implement alternate genquery scope collection The pre-existing GenQuery implementation relied on Skyframe's evaluation of TransitiveTarget values, as deps of a given genquery rule's ConfiguredTarget evaluation, to load the transitive closure of the targets referred to by that genquery rule's `scope` attribute value. TransitiveTarget nodes are one-to-one with build targets and the Skyframe dependencies between them correspond with their target-space dependencies (which may be either due to rules' attribute values, or due to those rules' applicable aspects as determined by their providers). Embedding genquery rules' scopes' target-space dependency graphs into Skyframe as part of those rules' ConfiguredTarget Skyframe evaluations causes problems when those dependency graphs have cycles. Skyframe evaluations unconditionally fail when *they* have cycles. However, `blaze query` semantics allow for a query expression to evaluate to a non-failure value when the target-space dependency graph involved in that evaluation contains cycles. Knowing nothing about genquery's implementation, a Blaze user ought to expect genquery's semantics to be similar to `blaze query`'s, modulo the constraint explicitly imposed by genquery's `scope` mechanism. Because of genquery's reliance on TransitiveTarget Skyframe evaluations, this expectation is not satisfied. This CL introduces a flag, `--experimental_skip_ttvs_for_genquery`, which causes genquery to use a different strategy when it is set to true. The new strategy does not use TransitiveTarget values. Instead, genquery's ConfiguredTarget Skyframe evaluation gathers necessary package data by requesting a Skyframe node, GenQueryDirectPackageProviderFactory.Key, which computes the transitive closure of the genquery rule's scope, depending on Package values (and Package-related values like ContainingPackageLookup, as necessary for incremental correctness). The flag's default value is false, meaning, genquery's strategy remains the same as before, vulnerable to cycles. Switching this default may come in a future CL. Comments in GenQueryDirectPackageProviderFactory.java document the new strategy. PiperOrigin-RevId: 474540264 Change-Id: I96092de4281f40d2f91aa4c152349dc6e16de30c
{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:
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md