summaryrefslogtreecommitdiffstats
path: root/components/resources
diff options
context:
space:
mode:
authortwellington <twellington@chromium.org>2015-06-23 10:37:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-23 17:37:27 +0000
commit9899f157e5d5088f9500e7c3e8365e0d9a63412c (patch)
treecd5b2fd106167989019d4cff82088b6102620547 /components/resources
parent4d126a7d7f1d0926a88f1548c4bf8291642c3ec7 (diff)
downloadchromium_src-9899f157e5d5088f9500e7c3e8365e0d9a63412c.zip
chromium_src-9899f157e5d5088f9500e7c3e8365e0d9a63412c.tar.gz
chromium_src-9899f157e5d5088f9500e7c3e8365e0d9a63412c.tar.bz2
This refactor makes third_party/closure_compiler/compile_js.gypi more versatile by allowing other gypi's that include it to define script_args and additional closure_args. remoting/ and components/resources/enhanced_bookmarks/ have been refactored to use compile_js.gypi (rather than calling compile.py directly).
BUG=496276 Review URL: https://codereview.chromium.org/1152583011 Cr-Commit-Position: refs/heads/master@{#335692}
Diffstat (limited to 'components/resources')
-rw-r--r--components/resources/enhanced_bookmarks/BUILD.gn30
-rw-r--r--components/resources/enhanced_bookmarks/enhanced_bookmarks.gypi96
2 files changed, 35 insertions, 91 deletions
diff --git a/components/resources/enhanced_bookmarks/BUILD.gn b/components/resources/enhanced_bookmarks/BUILD.gn
index 9c95b0b..1d580b5 100644
--- a/components/resources/enhanced_bookmarks/BUILD.gn
+++ b/components/resources/enhanced_bookmarks/BUILD.gn
@@ -2,12 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//third_party/closure_compiler/closure_args.gni")
+import("//third_party/document_image_extractor/document_image_extractor.gni")
import("//tools/grit/grit_rule.gni")
-closure_out_dir = "$root_gen_dir/closure/components/resources/enhanced_bookmarks"
+closure_out_dir =
+ "$root_gen_dir/closure/components/resources/enhanced_bookmarks"
# GYP version: components/resources/enhanced_bookmarks/enhanced_bookmarks_resources.gyp
-# (generate_enhanced_bookmarks_resources action)
grit("enhanced_bookmarks_resources") {
source = "enhanced_bookmarks_resources.grd"
@@ -35,10 +37,8 @@ grit("enhanced_bookmarks_resources") {
}
# GYP version: components/resources/enhanced_bookmarks/enhanced_bookmarks.gypi
-import("//third_party/document_image_extractor/document_image_extractor.gni")
-
rebased_closure_out_dir = rebase_path(root_gen_dir, "../") +
- "/closure/components/resources/enhanced_bookmarks/"
+ "/closure/components/resources/enhanced_bookmarks/"
action("document_image_extractor") {
script = "//third_party/closure_compiler/compile.py"
@@ -52,15 +52,11 @@ action("document_image_extractor") {
document_image_extractor_sources =
rebase_path(document_image_extractor_js_files, "third_party/", "../")
- args =
- [ "../../components/resources/enhanced_bookmarks/get_salient_image_url.js" ] +
- document_image_extractor_sources +
- [
- "--out_file=${rebased_closure_out_dir}/get_salient_image_url.js",
+ args = [ "../../components/resources/enhanced_bookmarks/get_salient_image_url.js" ] + document_image_extractor_sources + [
+ "--out-file=${rebased_closure_out_dir}/get_salient_image_url.js",
"--no-single-file",
- "--output_wrapper",
- "(function(){%output% return GetSalientImageUrl();})();",
- ]
+ "--closure-args",
+ ] + closure_args + default_disabled_closure_args + [ "output_wrapper='(function(){%output% return GetSalientImageUrl();})();'" ]
}
action("dom_initializer") {
@@ -79,9 +75,9 @@ action("dom_initializer") {
[ "../../components/resources/enhanced_bookmarks/dom_initializer.js" ] +
dom_controller_sources +
[
- "--out_file=${rebased_closure_out_dir}/dom_initializer.js",
+ "--out-file=${rebased_closure_out_dir}/dom_initializer.js",
"--no-single-file",
- "--output_wrapper",
- "(function(){%output%})();",
- ]
+ "--closure-args",
+ ] + closure_args + default_disabled_closure_args +
+ [ "output_wrapper='(function(){%output%})();'" ]
}
diff --git a/components/resources/enhanced_bookmarks/enhanced_bookmarks.gypi b/components/resources/enhanced_bookmarks/enhanced_bookmarks.gypi
index f9dcb67..9e0bfc7 100644
--- a/components/resources/enhanced_bookmarks/enhanced_bookmarks.gypi
+++ b/components/resources/enhanced_bookmarks/enhanced_bookmarks.gypi
@@ -2,87 +2,35 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
- 'targets' :[
+ 'targets': [
{
- 'target_name': 'document_image_extractor',
- 'type': 'none',
- 'variables': { 'CLOSURE_DIR': '<(DEPTH)/third_party/closure_compiler', },
- 'actions': [
- {
- # This action optionally takes these arguments:
- # - depends: scripts that the source file depends on being included already
- # - externs: files that describe globals used by |source|
- 'action_name': 'Compile enhanced bookmarks image extractor JavaScript',
- 'variables': {
- 'source_file': 'get_salient_image_url.js',
- 'out_file': '<(SHARED_INTERMEDIATE_DIR)/closure/<!(python <(CLOSURE_DIR)/build/outputs.py <@(source_file))',
- },
- 'inputs': [
- '<(CLOSURE_DIR)/compile.py',
- '<(CLOSURE_DIR)/processor.py',
- '<(CLOSURE_DIR)/build/inputs.py',
- '<(CLOSURE_DIR)/build/outputs.py',
- '<(CLOSURE_DIR)/compiler/compiler.jar',
- '<(CLOSURE_DIR)/runner/runner.jar',
- '<!@(python <(CLOSURE_DIR)/build/inputs.py <(source_file))',
- ],
- 'outputs': [
- '<(out_file)',
- ],
- 'action': [
- 'python',
- '<(CLOSURE_DIR)/compile.py',
- '<@(document_image_extractor_js_files)',
- '<(source_file)',
- '--out_file', '<(out_file)',
- '--no-single-file',
- '--output_wrapper', '(function(){%output% return GetSalientImageUrl();})();',
- ],
- }
- ],
+ 'target_name': 'get_salient_image_url',
+ 'variables': {
+ 'source_files': [
+ 'get_salient_image_url.js',
+ '<@(document_image_extractor_js_files)',
+ ],
+ 'script_args': ['--no-single-file'],
+ 'closure_args': ['output_wrapper=\'(function(){%output% return GetSalientImageUrl();})();\''],
+ },
'includes': [
- '../../../third_party/document_image_extractor/document_image_extractor_files.gypi'
+ '../../../third_party/document_image_extractor/document_image_extractor_files.gypi',
+ '../../../third_party/closure_compiler/compile_js.gypi',
],
},
{
'target_name': 'dom_initializer',
- 'type': 'none',
- 'variables': { 'CLOSURE_DIR': '<(DEPTH)/third_party/closure_compiler', },
- 'actions': [
- {
- # This action optionally takes these arguments:
- # - depends: scripts that the source file depends on being included already
- # - externs: files that describe globals used by |source|
- 'action_name': 'Compile enhanced bookmarks dom initializer JavaScript',
- 'variables': {
- 'source_file': 'dom_initializer.js',
- 'out_file': '<(SHARED_INTERMEDIATE_DIR)/closure/<!(python <(CLOSURE_DIR)/build/outputs.py <@(source_file))',
- },
- 'inputs': [
- '<(CLOSURE_DIR)/compile.py',
- '<(CLOSURE_DIR)/processor.py',
- '<(CLOSURE_DIR)/build/inputs.py',
- '<(CLOSURE_DIR)/build/outputs.py',
- '<(CLOSURE_DIR)/compiler/compiler.jar',
- '<(CLOSURE_DIR)/runner/runner.jar',
- '<!@(python <(CLOSURE_DIR)/build/inputs.py <(source_file))',
- ],
- 'outputs': [
- '<(out_file)',
- ],
- 'action': [
- 'python',
- '<(CLOSURE_DIR)/compile.py',
- '<@(dom_controller_js_files)',
- '<(source_file)',
- '--out_file', '<(out_file)',
- '--no-single-file',
- '--output_wrapper', '(function(){%output%})();',
- ]
- }
- ],
+ 'variables': {
+ 'source_files': [
+ 'dom_initializer.js',
+ '<@(dom_controller_js_files)',
+ ],
+ 'script_args': ['--no-single-file'],
+ 'closure_args': ['output_wrapper=\'(function(){%output%})();\''],
+ },
'includes': [
- '../../../third_party/document_image_extractor/dom_controller_files.gypi'
+ '../../../third_party/document_image_extractor/dom_controller_files.gypi',
+ '../../../third_party/closure_compiler/compile_js.gypi',
],
},
],