commit | 034220a24599f6a41b7032e39c10f246011f5c0e | [log] [tgz] |
---|---|---|
author | adonovan <adonovan@google.com> | Tue Mar 24 10:11:26 2020 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Mar 24 10:13:00 2020 -0700 |
tree | e95d893fd485c7cc236eb392df0495ee4027498e | |
parent | d5012a7ed19c1e75e413373fa22c5f1b08a9ee29 [diff] |
bazel syntax: add FileOptions FileOptions is a set of per-file options that control the front-end ("static") processing of a single Starlark file: scanning, parsing, validation, and, eventually, compilation. FileOptions determine language dialect and "code generation", like the options to a compiler. Different files may have different options, as in the case of BUILD and .bzl files, for example. By contrast, a StarlarkSemantics affects only dynamic behavior, and is carried down the thread, possibly through many files that vary in their FileOptions. FileOptions are specified at the construction of a StarlarkFile (parsing) and are retained by it thereafter. This reduces the burden of ensuring that consistent options are provided to the operations of parsing and validation when these steps are widely separated in the source, as is often the case in Bazel. This change allows Copybara do validation on all its files. It was previously unable because it could not select validation options "a la carte". This will soon allow us to assume that all files are resolved before execution. The API for creating a Starlark thread is getting more verbose. This is temporary; to "refactor" a term in an equation one must first expand it out. Details: - Add FileOptions parameters to scanner, parser, and their wrappers. - Remove the StarlarkSemantics parameter from getUndeclaredNameError. It was only used for an assertion. - Move StarlakSemantics into the evaluator package. ValidationTest no longer depends on semantics or lib.packages. - Decompose the validator's previous isBuildFile parameter into separate features: top-level rebinding, whether to call setScope, etc. - Simplify the "restrict string escapes" feature by pushing it from the validator to the scanner. - Simplify the "load disregards privacy" feature by pushing it from the syntax tree into the validator. Delete parseVirtualBuildFile. - Add a placeholder for a "load binds globally" feature, for load in the REPL and for upcoming changes to the implementation of the prelude. Its implementation will come later. - Move the "load of private symbol" check from Eval to Validator. This is a breaking API change for Copybara. PiperOrigin-RevId: 302691302
{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