commit | 841ac61469ed61325acbcb134b6d372316f46540 | [log] [tgz] |
---|---|---|
author | adonovan <adonovan@google.com> | Sat Jun 06 07:18:58 2020 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Sat Jun 06 07:20:22 2020 -0700 |
tree | a0dcf2aa8f9238e559c435b54704139da1a1f906 | |
parent | e47341da50264f35687c57ebbd426ed76dbdcb30 [diff] |
bazel: encapsulate the representation of NestedSet Before, NestedSet exposed its representation far and wide in ways obvious (getChildrenUnsafe) and subtle (downcasting NestedSetView.identity()). This change encapsulates the representation of NestedSet, allowing it to be improved in future. It also documents the data type's conceptual model. The API has changed as follows: - NestedSetView is deleted. Its split, getDirect, and getTransitive methods have been moved to NestedSet itself, since they have always been well defined by the core abstraction. getDirect is now getLeaves and getTransitive is getNonLeaves. - NestedSetView.identifier is gone. Instead, NestedSet.Node is a truly opaque identifier for a node in the graph's internal representation. It provides only the hash and equals operations. (It might seem more logical for getLeaves/NonLeaves to be defined over Nodes, returning Nodes, but in practice no client seems to need that.) - NestedSet.getChildrenUnsafe is replaced by forEachElement, which provides the pruned traversal needed by [redacted; see b/157992832]. Unfortunately it still exposes the internal node to the 'prune' callback, violating encapsulation, though it is much less invasive than before. Functionally, this method could be completely replaced by NestedSetVisitor or by use of Node, but performance may be a concern. Will address in a follow-up. - Delete childrenToString. - The public API no longer mentions "children". Also, delete rawChildren() and expose NestedSet.children to the package. This is a preparatory cleanup for CL 310551947, which will represent the depth of the graph in the graph, obviating the problem of set flattening throwing unchecked exceptions at surprising times, the catching of which creates a bad dependency from the Starlark interpreter to NestedSet. PiperOrigin-RevId: 315079199
{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