blob: cdc9755ca6c6641d62aed3c611ca8c339a85ee6a [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.
common_namespace_rewrites_polymer = [
"cr.ui.FocusOutlineManager|FocusOutlineManager",
"cr.ui.focusWithoutInk|focusWithoutInk",
"Polymer.IronA11yAnnouncer|IronA11yAnnouncer",
"Polymer.PaperRippleBehavior|PaperRippleBehavior",
"Polymer.RenderStatus.afterNextRender|afterNextRender",
# TODO(dpapad): Add more such rewrites as they get discovered.
]
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/html/cr/ui/focus_outline_manager.html|FocusOutlineManager",
"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/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_polymer
if (defined(invoker.namespace_rewrites)) {
args += invoker.namespace_rewrites
}
args += [ "--auto_imports" ] + common_auto_imports
if (defined(invoker.auto_imports)) {
args += invoker.auto_imports
}
}
}