| Index: docs/closure_compilation.md
|
| diff --git a/docs/closure_compilation.md b/docs/closure_compilation.md
|
| index 5ba5e05e293cff7c2b97332da13f173b3fb1d34c..d258d49a93cf4029b62d7e0c9b8c32707f5d2bb9 100644
|
| --- a/docs/closure_compilation.md
|
| +++ b/docs/closure_compilation.md
|
| @@ -82,33 +82,46 @@ alert(mensa); // '100 IQ50' instead of 150
|
| Closure compiler can notify us if we're using `string`s and `number`s in
|
| dangerous ways.
|
|
|
| -To do this, we can create:
|
| +To do this, we can create (or add to):
|
|
|
| - + ui/compiled_resources2.gyp
|
| + + ui/BUILD.gn
|
|
|
| With these contents:
|
|
|
| ```
|
| +
|
| # Copyright 2016 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
| -{
|
| - 'targets': [
|
| - {
|
| - # Target names is typically just without ".js"
|
| - 'target_name': 'makes_things_pretty',
|
| -
|
| - 'dependencies': [
|
| - '../lib/compiled_resources2.gyp:does_the_hard_stuff',
|
| -
|
| - # Teaches closure about non-standard environments/APIs, e.g.
|
| - # chrome.send(), chrome.app.window, etc.
|
| - '<(EXTERNS_GYP):extern_name_goes_here'
|
| - ],
|
| -
|
| - 'includes': ['../path/to/third_party/closure_compiler/compile_js2.gypi'],
|
| - },
|
| - ],
|
| +import("//third_party/closure_compiler/compile_js2.gni")
|
| +
|
| +# Target name is typically compile_<root file name> but can be anything
|
| +compile_js("compile_make_things_pretty") {
|
| + source_files = ["make_things_pretty.js"]
|
| + deps = ["../lib:compile_does_the_hard_stuff"]
|
| + externs = "extern_name_goes_here"
|
| +}
|
| +...
|
| +
|
| +# Create a group to include all compilations in this GN file
|
| +group("compile_js") {
|
| + deps = [
|
| + :compile_make_things_pretty,
|
| + ...
|
| + ]
|
| +}
|
| +
|
| +```
|
| +
|
| +To include this in builds add your new target to the `'deps'` list in
|
| +`src/third_party/closure_compiler/BUILD.gn`:
|
| +
|
| +```
|
| +group("compile_js_all") {
|
| + deps = [
|
| + # ... other projects ...
|
| +++ "//my_project:compile_js",
|
| + ]
|
| }
|
| ```
|
|
|
| @@ -174,24 +187,6 @@ CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation
|
| Working in common resource directories in Chrome automatically adds this line
|
| for you.
|
|
|
| -## Integrating with the continuous build
|
| -
|
| -To compile your code on every commit, add your file to the `'dependencies'` list
|
| -in `src/third_party/closure_compiler/compiled_resources2.gyp`:
|
| -
|
| -```
|
| -{
|
| - 'targets': [
|
| - {
|
| - 'target_name': 'compile_all_resources',
|
| - 'dependencies': [
|
| - # ... other projects ...
|
| -++ '../my_project/compiled_resources2.gyp:*',
|
| - ],
|
| - }
|
| - ]
|
| -}
|
| -```
|
|
|
| This file is used by the
|
| [Closure compiler bot](http://build.chromium.org/p/chromium.fyi/builders/Closure%20Compilation%20Linux)
|
|
|