Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Migrating off Closure Python Scripts

Kelvin Jin edited this page May 6, 2021 · 4 revisions

We are planning to deprecate and remove the Python helper scripts closure/bin/**/*.py from the Closure Library GitHub repository. These are old scripts that have obsoleted by other, actively maintained solutions:

  • closure/bin/build/closurebuilder.py: A convenience wrapper around Closure Compiler itself; users are encouraged to move to directly invoking Closure Compiler (this is mentioned in a warning emitted by the Python script).
  • closure/bin/build/depswriter.py: A tool to write deps.js files; users are encouraged to use google-closure-deps (a re-implementation in JavaScript) instead.
  • closure/bin/build/*.py (remaining files): These are helpers for the other scripts in the same directory. If you have scripts that depend on these files, please fork them into your own repository.
  • closure/bin/calcdeps.py: Obsoleted by closure/bin/build/closurebuilder.py, which is listed above.

For anyone who is using any of these files, please move to the suggested alternatives as soon as possible. If you find that your usage is not covered by the suggested alternatives, please let us know by filing a GitHub issue.

We will keep this GitHub Wiki article up-to-date with details on migration as they come up.

closurebuilder.py

This table shows mappings between arguments to the old and new commands.

$(CLOSURE_LIBRARY)/bin/build/closurebuilder.py -c ${closure-compiler.jar} java --jar ${closure-compiler.jar} (direct invocation)
-i/--input="x" --entry_point="x" or --js="x"
-n/--namespace="x" --entry_point="goog:x"(?)
--root="x" --entry_point="x" or --js="x"
-e/--exclude="x" --js="!x"
-o/--output_mode="x" If x = "compiled", no extra flag is needed. Otherwise, unknown (TODO)
-f/--compiler_flags="x" Pass x directly to closure-compiler.jar invocation.
-j/--jvm_flags="x" Pass x directly to java command.
--output_file="x" --js_output_file="x"

Examples:

depswriter.py

This table shows mappings between arguments to the old and new commands.

$(CLOSURE_LIBRARY)/bin/build/depswriter.py $(npm bin)/closure-make-deps \
--closure-path="node_modules/google-closure-library/closure/goog" \
--file="node_modules/google-closure-library/closure/goog/deps.js"
--output_file="x" closure-make-deps outputs to stdout; pipe stdout to x.
--root="x" --root="x"
--root_with_prefix="x y" --root="x"
root_with_prefix is commonly used to compute a path relative to Closure; this is done automatically by closure-make-deps.
--path_with_depspath TODO

Examples: