Skip to content

Commit

Permalink
Add instructions for the Closure externs generator
Browse files Browse the repository at this point in the history
Generated externs instruct maintainers to reference this doc to
regenerate them, so add the expected instructions here.

R=dbeam@chromium.org
BUG=none

Review-Url: https://codereview.chromium.org/2852143002
Cr-Commit-Position: refs/heads/master@{#468487}
  • Loading branch information
michaelpg authored and Commit bot committed May 1, 2017
1 parent 29fdc16 commit c1e2d1e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/closure_compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,21 @@ in `src/third_party/closure_compiler/compiled_resources2.gyp`:
This file is used by the
[Closure compiler bot](https://build.chromium.org/p/chromium.fyi/builders/Closure%20Compilation%20Linux)
to automatically compile your code on every commit.
## Externs
[Externs files](https://github.com/google/closure-compiler/wiki/FAQ#how-do-i-write-an-externs-file)
define APIs external to your JavaScript. They provide the compiler with the type
information needed to check usage of these APIs in your JavaScript, much like
forward declarations do in C++.
Third-party libraries like Polymer often provide externs. Chrome must also
provide externs for its extension APIs. Whenever an extension API's `idl` or
`json` schema is updated in Chrome, the corresponding externs file must be
regenerated:
```shell
./tools/json_schema_compiler/compiler.py -g externs \
extensions/common/api/your_api_here.idl \
> third_party/closure_compiler/externs/your_api_here.js
```

0 comments on commit c1e2d1e

Please sign in to comment.