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.
2 files changed
tree: 243b23b2e799ffbbc90b1eec4053aea4fe11fb1b
  1. site/
  2. skydoc/
  3. skylark/
  4. .gitignore
  5. AUTHORS
  6. BUILD
  7. CONTRIBUTING.md
  8. CONTRIBUTORS
  9. LICENSE
  10. README.md
  11. serve-docs.sh
  12. skydoc-screenshot.png
  13. WORKSPACE
README.md

Skydoc - Skylark Documentation Generator

Build Status

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.

A screenshot of Skydoc generated HTML documentation

Get Started

About Skydoc