blob: ae2318840f2dd1f764c456608f7005305a4947d5 [file] [log] [blame]
# Copyright 2019 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("//ui/webui/resources/tools/js_modulizer.gni")
common_auto_imports = [
"third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/iron-a11y-announcer.html|IronA11yAnnouncer",
"third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-ripple-behavior.html|PaperRippleBehavior",
"ui/webui/resources/cr_elements/cr_radio_button/cr_radio_button_behavior.html|CrRadioButtonBehavior",
"ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.html|CrPolicyPrefBehavior",
"ui/webui/resources/html/cr/ui/focus_outline_manager.html|FocusOutlineManager",
"ui/webui/resources/html/cr/ui/focus_row_behavior.html|FocusRowBehavior",
"ui/webui/resources/html/cr/ui/focus_without_ink.html|focusWithoutInk",
"ui/webui/resources/html/i18n_behavior.html|I18nBehavior",
"ui/webui/resources/html/load_time_data.html|loadTimeData",
"ui/webui/resources/html/parse_html_subset.html|parseHtmlSubset",
"ui/webui/resources/html/polymer.html|Polymer,html",
"ui/webui/resources/html/web_ui_listener_behavior.html|WebUIListenerBehavior",
# TODO(dpapad): Add more auto-imports here, as needed.
]
template("polymer_modulizer") {
action(target_name + "_module") {
script = "//tools/polymer/polymer.py"
inputs = [ invoker.html_file ]
if (invoker.html_type == "dom-module" || invoker.html_type == "v3-ready") {
inputs += [ invoker.js_file ]
}
output_js_file = invoker.js_file
if (invoker.html_type == "dom-module") {
output_js_file = get_path_info(invoker.js_file, "name") + ".m.js"
}
outputs = [ "$target_gen_dir/" + output_js_file ]
args = [
"--js_file",
invoker.js_file,
"--html_file",
invoker.html_file,
"--html_type",
invoker.html_type,
"--in_folder",
rebase_path(".", root_build_dir),
"--out_folder",
rebase_path(target_gen_dir, root_build_dir),
]
args += [ "--namespace_rewrites" ] + common_namespace_rewrites
if (defined(invoker.namespace_rewrites)) {
args += invoker.namespace_rewrites
}
args += [ "--auto_imports" ] + common_auto_imports
if (defined(invoker.auto_imports)) {
args += invoker.auto_imports
}
}
}