chromium/chrome/browser/resources/chromeos/gaia_action_buttons/BUILD.gn

# 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("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

generate_grd("build_grd") {
  grd_prefix = "gaia_action_buttons"
  resource_path_prefix = "gaia_action_buttons"
  out_grd = "$target_gen_dir/resources.grd"
  input_files_base_dir = rebase_path(
          "$root_gen_dir/chrome/browser/resources/chromeos/gaia_action_buttons/",
          root_build_dir)
  input_files = [ "gaia_action_buttons.js" ]
}

grit("resources") {
  defines = chrome_grit_defines

  # These arguments are needed since the grd is generated at build time.
  enable_input_discovery_for_gn_analyze = false
  source = "$target_gen_dir/resources.grd"
  deps = [
    ":build_grd",
    ":web_components",
  ]
  outputs = [
    "grit/gaia_action_buttons_resources.h",
    "grit/gaia_action_buttons_resources_map.cc",
    "grit/gaia_action_buttons_resources_map.h",
    "gaia_action_buttons_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}

js_type_check("closure_compile") {
  is_polymer3 = true
  closure_flags =
      default_closure_args + [
        "js_module_root=" +
            rebase_path("//chrome/browser/resources/chromeos/", root_build_dir),
        "js_module_root=./gen/chrome/browser/resources/chromeos/",
        "js_module_root=" +
            rebase_path("//chrome/browser/resources/", root_build_dir),
        "js_module_root=./gen/chrome/browser/resources/",
      ]
  deps = [ ":gaia_action_buttons" ]
}

js_library("gaia_action_buttons") {
  deps = [
    "//chrome/browser/resources/gaia_auth_host:authenticator",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
  externs_list = [
    "//ash/webui/common/resources/cr_elements/cr_button/cr_button_externs.js",
  ]
}

html_to_js("web_components") {
  js_files = [ "gaia_action_buttons.js" ]
}