commit | a0c6f81f4603a18d4d4791b5762fdf4e078e34b3 | [log] [tgz] |
---|---|---|
author | brandjon <brandjon@google.com> | Sat Jun 06 14:13:19 2020 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Sat Jun 06 14:14:54 2020 -0700 |
tree | b04f1e85322fb0f9d6136f033a7ae716733eca4c | |
parent | 841ac61469ed61325acbcb134b6d372316f46540 [diff] |
Move management of .bzl builtin symbols to StarlarkBuiltinsFunction This change centralizes knowledge of the set of predeclared symbols for .bzl files (and in a future change, perhaps BUILD/WORKSPACE files) in StarlarkBuiltinsFunction. For WORKSPACE- and @builtins-loaded .bzls, where the set of predeclareds does not change, it is computed once at Skyframe initialization time. For BUILD-loaded .bzls, the original set of predeclareds is also computed and saved at init time, but in the future we'll request the injected symbols from exports.bzl and save a modified environment in the returned StarlarkBuiltinsValue. ConfiguredRuleClassProvider and PackageFactory now provide a way to distinguish "rule logic" symbols (e.g. `CcInfo`) from generic symbols (e.g., `rule()`). This will be used in a future CL to prohibit injecting new values for generic symbols. Work toward #11437. Other changes: StarlarkBuiltinsValue: - Store the desired environment, rather than the delta between the original environment and the desired one. This makes it so we won't have to reapply the delta (and validation) on every load. BzlLoadFunction: - Move Module creation out of executeModule(), and rename the latter to executeBzlFile(). - Simplify comment at call to executeBzlFile(), pass in a listener instead of whole Environment. StarlarkBuiltinsFunctionTest: - Use mock symbols in the test RuleClassProvider. Update tests to use mock symbols instead of non-existent names, since those will break going forward. - Add tests of getNativeRuleLogicBindings(). (This seemed a better home for them than PackageFactoryTest, particularly because there's no generic RuleClassProviderTest.) - Add tests of exports.bzl files that perform loads. AbstractPackageLoader: - Let it know about StarlarkBuiltinsFunction, apparently it's needed for tests (in a follow-up CL). Added a comment to SkyframeExecutor. WorkspaceFactory: - inline a helper method RELNOTES: None PiperOrigin-RevId: 315101101
{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