Skip to content

Commit

Permalink
Closure: more v2-specific changes, typo and rendering fixes
Browse files Browse the repository at this point in the history
R=dpapad@chromium.org
BUG=585553
NOTRY=true

Review URL: https://codereview.chromium.org/1780873002

Cr-Commit-Position: refs/heads/master@{#380437}
  • Loading branch information
danbeam authored and Commit bot committed Mar 10, 2016
1 parent 1884200 commit 1ff3458
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions docs/closure_compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ On Mac or Windows, visit:
We use GYP and ninja as our build system. To generate the ninja files from GYP:

```shell
# notice the 2 in compiled_resources.gyp
# notice the 2 in compiled_resources2.gyp
GYP_GENERATORS=ninja tools/gyp/gyp --depth . third_party/closure_compiler/compiled_resources2.gyp
```

Expand Down Expand Up @@ -99,29 +99,23 @@ alert(mensa); // '100 IQ50' instead of 150
In order to check that our code acts as we'd expect, we can create a
my_project/compiled_resources.gyp
my_project/compiled_resources2.gyp
with the contents:
```
# Copyright 2015 The Chromium Authors. All rights reserved.
# 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_name': 'my_file', # file name without ".js"

'variables': { # Only use if necessary (no need to specify empty lists).
'depends': [
'other_file.js', # or 'other_project/compiled_resources.gyp:target',
],
'externs': [
'<(CLOSURE_DIR)/externs/any_needed_externs.js' # e.g. chrome.send(), chrome.app.window, etc.
],
},

'includes': ['../third_party/closure_compiler/compile_js.gypi'],
'dependencies': [ # No need to specify empty lists.
'../compiled_resources2.gyp:other_file',
'<(EXTERNS_GYP):any_needed_externs' # e.g. chrome.send(), chrome.app.window, etc.
],
'includes': ['../third_party/closure_compiler/compile_js2.gypi'],
},
],
}
Expand Down Expand Up @@ -154,7 +148,7 @@ like this:
'target_name': 'compile_all_resources',
'dependencies': [
# ... other projects ...
++ '../my_project/compiled_resources.gyp:*',
++ '../my_project/compiled_resources2.gyp:*',
],
}
]
Expand All @@ -172,7 +166,7 @@ Compiled JavaScript is output in
map for use in debugging. In order to use the compiled JavaScript, we can create
a

my_project/my_project_resources.gpy
my_project/my_project_resources.gyp

with the contents:

Expand Down Expand Up @@ -225,6 +219,7 @@ with the contents:
```

In your C++, the resource can be retrieved like this:

```
base::string16 my_script =
base::UTF8ToUTF16(
Expand Down Expand Up @@ -287,6 +282,7 @@ my_project/compiled_resources.gyp
```

with contents similar to this:

```
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
Expand Down

0 comments on commit 1ff3458

Please sign in to comment.