Convert remaining non-CrOS Closure Compiles to GN.
See go/closure-compile-gn for details.
This CL converts ntp4 and offline_pages to GN Closure compilation. It
also deletes the webstore_widget GYP file which is no longer used.
A local closure compile can be run by setting closure_compile = true in
args.gn, and then running ninja -C out/Default webui_closure_compile.
A more localized compile may look like:
ninja -C out/Default chrome/browser/resources/ntp4:closure_compile
TBR=fukino@chromium.org
Bug: 632206
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Id6f4c248eaf19a63084e1734bc987b5f8a7c11fc
Reviewed-on: https://chromium-review.googlesource.com/1049209
Reviewed-by: calamity <calamity@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Justin DeWitt <dewittj@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559464}
diff --git a/BUILD.gn b/BUILD.gn
index 68ebae3..9546886 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1158,6 +1158,9 @@
if (is_chromeos) {
data_deps += [ "ui/file_manager:closure_compile" ]
}
+ if (is_android) {
+ data_deps += [ "components/offline_pages/resources:closure_compile" ]
+ }
}
}
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn
index 8bade170..9456958 100644
--- a/chrome/browser/resources/BUILD.gn
+++ b/chrome/browser/resources/BUILD.gn
@@ -10,29 +10,37 @@
if (closure_compile) {
group("closure_compile") {
deps = [
+ "cryptotoken:closure_compile",
"engagement:closure_compile",
]
if (is_linux || is_win || is_mac) {
deps += [
- "cryptotoken:closure_compile",
"md_bookmarks:closure_compile",
"md_downloads:closure_compile",
- "md_extensions:closure_compile",
"md_history:closure_compile",
- "md_user_manager:closure_compile",
"media_router:closure_compile",
- "offline_pages:closure_compile",
+ "ntp4:closure_compile",
"pdf:closure_compile",
"print_preview:closure_compile",
"settings:closure_compile",
+ ]
+ }
+ if (is_chromeos) {
+ deps += [
+ "md_user_manager:closure_compile",
"signin/dice_sync_confirmation:closure_compile",
- "webapks:closure_compile",
"welcome/dice_welcome:closure_compile",
]
}
-
+ if (enable_extensions) {
+ deps += [ "md_extensions:closure_compile" ]
+ }
if (is_android) {
- deps += [ "snippets_internals:closure_compile" ]
+ deps += [
+ "offline_pages:closure_compile",
+ "snippets_internals:closure_compile",
+ "webapks:closure_compile",
+ ]
}
}
}
diff --git a/chrome/browser/resources/ntp4/BUILD.gn b/chrome/browser/resources/ntp4/BUILD.gn
new file mode 100644
index 0000000..7bd9966
--- /dev/null
+++ b/chrome/browser/resources/ntp4/BUILD.gn
@@ -0,0 +1,56 @@
+# Copyright 2018 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.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":apps_page",
+ ]
+}
+
+js_library("apps_page") {
+ sources = [
+ "//third_party/jstemplate/jsevalcontext.js",
+ "//third_party/jstemplate/jstemplate.js",
+ "//third_party/jstemplate/util.js",
+ "//ui/webui/resources/js/action_link.js",
+ "//ui/webui/resources/js/assert.js",
+ "//ui/webui/resources/js/cr.js",
+ "//ui/webui/resources/js/cr/event_target.js",
+ "//ui/webui/resources/js/cr/ui.js",
+ "//ui/webui/resources/js/cr/ui/bubble.js",
+ "//ui/webui/resources/js/cr/ui/card_slider.js",
+ "//ui/webui/resources/js/cr/ui/command.js",
+ "//ui/webui/resources/js/cr/ui/context_menu_button.js",
+ "//ui/webui/resources/js/cr/ui/context_menu_handler.js",
+ "//ui/webui/resources/js/cr/ui/drag_wrapper.js",
+ "//ui/webui/resources/js/cr/ui/expandable_bubble.js",
+ "//ui/webui/resources/js/cr/ui/focus_manager.js",
+ "//ui/webui/resources/js/cr/ui/menu.js",
+ "//ui/webui/resources/js/cr/ui/menu_button.js",
+ "//ui/webui/resources/js/cr/ui/menu_item.js",
+ "//ui/webui/resources/js/cr/ui/position_util.js",
+ "//ui/webui/resources/js/cr/ui/touch_handler.js",
+ "//ui/webui/resources/js/event_tracker.js",
+ "//ui/webui/resources/js/load_time_data.js",
+ "//ui/webui/resources/js/parse_html_subset.js",
+ "//ui/webui/resources/js/promise_resolver.js",
+ "//ui/webui/resources/js/util.js",
+ "apps_page.js",
+ "dot_list.js",
+ "logging.js",
+ "nav_dot.js",
+ "new_tab.js",
+ "page_list_view.js",
+ "page_switcher.js",
+ "tile_page.js",
+ "trash.js",
+ ]
+
+ externs_list = [
+ "$externs_path/chrome.js",
+ "$externs_path/chrome_send.js",
+ ]
+}
diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js
index 713c4f37..0cfe938 100644
--- a/chrome/browser/resources/ntp4/apps_page.js
+++ b/chrome/browser/resources/ntp4/apps_page.js
@@ -569,7 +569,7 @@
/**
* Creates a new AppsPage object.
* @constructor
- * @extends {TilePage}
+ * @extends {ntp.TilePage}
*/
function AppsPage() {
var el = new TilePage(appsPageGridValues);
diff --git a/chrome/browser/resources/ntp4/compiled_resources2.gyp b/chrome/browser/resources/ntp4/compiled_resources2.gyp
deleted file mode 100644
index ce88ce2..0000000
--- a/chrome/browser/resources/ntp4/compiled_resources2.gyp
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2017 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': 'apps_page',
- 'variables': {
- 'script_args': ['--custom_sources'],
- 'source_files': [
- '<(DEPTH)/third_party/closure_compiler/externs/chrome.js',
- '<(DEPTH)/third_party/closure_compiler/externs/chrome_send.js',
- '<(DEPTH)/third_party/jstemplate/util.js',
- '<(DEPTH)/third_party/jstemplate/jsevalcontext.js',
- '<(DEPTH)/third_party/jstemplate/jstemplate.js',
- '<(DEPTH)/ui/webui/resources/js/action_link.js',
- '<(DEPTH)/ui/webui/resources/js/assert.js',
- '<(DEPTH)/ui/webui/resources/js/cr.js',
- '<(DEPTH)/ui/webui/resources/js/event_tracker.js',
- '<(DEPTH)/ui/webui/resources/js/load_time_data.js',
- '<(DEPTH)/ui/webui/resources/js/parse_html_subset.js',
- '<(DEPTH)/ui/webui/resources/js/promise_resolver.js',
- '<(DEPTH)/ui/webui/resources/js/util.js',
- '<(DEPTH)/ui/webui/resources/js/cr/event_target.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/bubble.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/card_slider.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/command.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/context_menu_handler.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/drag_wrapper.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/expandable_bubble.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/focus_manager.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/menu.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/menu_item.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/position_util.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/menu_button.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/context_menu_button.js',
- '<(DEPTH)/ui/webui/resources/js/cr/ui/touch_handler.js',
- 'logging.js',
- 'tile_page.js',
- 'dot_list.js',
- 'trash.js',
- 'page_switcher.js',
- 'page_list_view.js',
- 'nav_dot.js',
- 'new_tab.js',
- 'apps_page.js',
- ],
- },
- 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
- },
- ],
-}
diff --git a/components/chrome_apps/webstore_widget/externs/compiled_resources2.gyp b/components/chrome_apps/webstore_widget/externs/compiled_resources2.gyp
deleted file mode 100644
index 2b2347cd..0000000
--- a/components/chrome_apps/webstore_widget/externs/compiled_resources2.gyp
+++ /dev/null
@@ -1,15 +0,0 @@
-# copyright 2017 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': 'webview_tag',
- 'dependencies': [
- '<(EXTERNS_GYP):chrome_extensions',
- ],
- 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
- }
- ]
-}
diff --git a/components/offline_pages/resources/BUILD.gn b/components/offline_pages/resources/BUILD.gn
new file mode 100644
index 0000000..6f9c5ec
--- /dev/null
+++ b/components/offline_pages/resources/BUILD.gn
@@ -0,0 +1,14 @@
+# Copyright 2018 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.
+
+import("//third_party/closure_compiler/compile_js.gni")
+
+js_type_check("closure_compile") {
+ deps = [
+ ":renovations",
+ ]
+}
+
+js_library("renovations") {
+}
diff --git a/components/offline_pages/resources/compiled_resources2.gyp b/components/offline_pages/resources/compiled_resources2.gyp
deleted file mode 100644
index 191a74a..0000000
--- a/components/offline_pages/resources/compiled_resources2.gyp
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright 2017 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': 'renovations',
- 'includes': ['../../../third_party/closure_compiler/compile_js2.gypi'],
- },
- ],
-}
diff --git a/components/offline_pages/resources/renovations.js b/components/offline_pages/resources/renovations.js
index 80d3881d..5bb14785 100644
--- a/components/offline_pages/resources/renovations.js
+++ b/components/offline_pages/resources/renovations.js
@@ -4,12 +4,12 @@
function renovation_wikipedia() {
// Get list of elements to expand.
- elems = document.querySelectorAll(
- "div.collapsible-block,h2.collapsible-heading");
+ let elems =
+ document.querySelectorAll('div.collapsible-block,h2.collapsible-heading');
// Apply 'open-block' class to elements. This makes the sections'
// content visible.
- for (i = 0; i < elems.length; ++i) {
+ for (let i = 0; i < elems.length; ++i) {
// If a block was already expanded, re-adding the 'open-block'
// class will do nothing; no need to check if it's there already.
elems.item(i).className += " open-block";
@@ -21,18 +21,18 @@
// disabled). We get the list of these elements in order. For every
// lazy image placeholder, there is always a corresponding noscript
// element.
- placeholders = document.querySelectorAll(
- ".image > span.lazy-image-placeholder, \
- .mwe-math-element > span.lazy-image-placeholder");
- noscripts = document.querySelectorAll(
- ".image > noscript, .mwe-math-element > noscript");
+ let placeholders = document.querySelectorAll(
+ '.image > span.lazy-image-placeholder, ' +
+ '.mwe-math-element > span.lazy-image-placeholder');
+ let noscripts = document.querySelectorAll(
+ '.image > noscript, .mwe-math-element > noscript');
// Next we delete all the placeholders, then move the img elements
// out of the noscripts, deleting the noscript element in the
// process.
- for (i = 0; i < placeholders.length; ++i) {
+ for (let i = 0; i < placeholders.length; ++i) {
placeholders.item(i).remove();
- innerText = noscripts.item(i).innerText;
+ let innerText = noscripts.item(i).innerText;
noscripts.item(i).outerHTML = innerText;
}
}
diff --git a/third_party/closure_compiler/compiled_resources2.gyp b/third_party/closure_compiler/compiled_resources2.gyp
index 592e50d..1b6b8c0 100644
--- a/third_party/closure_compiler/compiled_resources2.gyp
+++ b/third_party/closure_compiler/compiled_resources2.gyp
@@ -22,7 +22,6 @@
'<(DEPTH)/chrome/browser/resources/chromeos/select_to_speak/compiled_resources2.gyp:*',
'<(DEPTH)/chrome/browser/resources/chromeos/switch_access/compiled_resources2.gyp:*',
'<(DEPTH)/chrome/browser/resources/chromeos/sys_internals/compiled_resources2.gyp:*',
- '<(DEPTH)/chrome/browser/resources/ntp4/compiled_resources2.gyp:*',
'<(DEPTH)/ui/webui/resources/cr_components/compiled_resources2.gyp:*',
'<(DEPTH)/ui/webui/resources/cr_elements/compiled_resources2.gyp:*',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:*',