chromium/tools/polymer/html_to_js.gni

# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")

# Note: Don't use html_to_js() in new code. Instead see html_to_wrapper()
assert(is_chromeos_ash)

template("html_to_js") {
  action(target_name) {
    script = "//tools/polymer/html_to_js.py"
    forward_variables_from(invoker, [ "visibility" ])

    inputs = []
    outputs = []

    foreach(js_file, invoker.js_files) {
      extension = get_path_info(js_file, "extension")
      assert(extension == "js" || extension == "ts")

      html_file = get_path_info(js_file, "dir") + "/" +
                  get_path_info(js_file, "name") + ".html"
      inputs += [
        js_file,
        html_file,
      ]
      outputs += [ "$target_gen_dir/" + js_file ]
    }

    args = [
             "--in_folder",
             rebase_path(".", root_build_dir),
             "--out_folder",
             rebase_path(target_gen_dir, root_build_dir),
             "--js_files",
           ] + invoker.js_files
  }
}