summaryrefslogtreecommitdiff
path: root/chromium/tools/polymer/polymer.gni
blob: a4983f544de1461023d520460c5f78b4d1fe8429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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_scrollable_behavior.html|CrScrollableBehavior",
  "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/find_shortcut_behavior.html|FindShortcutBehavior",
  "ui/webui/resources/html/i18n_behavior.html|I18nBehavior",
  "ui/webui/resources/html/list_property_update_behavior.html|ListPropertyUpdateBehavior",
  "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/promise_resolver.html|PromiseResolver",
  "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
    }

    if (defined(invoker.ignore_imports)) {
      args += [ "--ignore_imports" ] + invoker.ignore_imports
    }
  }
}