commit | 71d2f2fb3c99e9fd38d7884991fc677cdf505003 | [log] [tgz] |
---|---|---|
author | Mathieu Boespflug <mboes@tweag.net> | Thu Feb 22 14:54:47 2018 +0100 |
committer | Laurent Le Brun <laurentlb@gmail.com> | Thu Feb 22 14:54:47 2018 +0100 |
tree | 243b23b2e799ffbbc90b1eec4053aea4fe11fb1b | |
parent | 4cc51480f36eac2e4a1df07a1cab2f7f14c47dee [diff] |
Use a single evaluation enviroment for rules. (#84) The rule extractor interprets Skylark code as Python, in an environment with most Skylark globals and primitives stubbed out. It was doing so in two environments, one for globals and one for locals. But the Python documentation has this to say: > If two separate objects are passed as globals and locals, the code > will be executed as if it were embedded in a class definition. This means that using two environments can have suprising results. One of which is that calling recursive functions don't work, whereas it works in Skylark or at the Python top-level. This also means that calling a function `foo()` that itself depends on a function `bar()` in the same Skylark file doesn't work. So we instead `exec ...` in a single environment. We infer new definitions contained in the input file by diffing the hold state and the new state of the environment.
Skydoc is a documentation generator for Bazel build rules written in Skylark.
Skydoc provides a Skylark rule (skylark_doc
) that can be used to build documentation for Skylark rules in either Markdown or HTML. Skydoc generates one documentation page per .bzl
file.
NOTE: skylark_library
's implementation has moved to Skylib.