chromium/chrome/browser/resources/chromeos/arc_account_picker/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")

generated_grdp_file = "$target_gen_dir/generated_resources.grdp"

grd_prefix = "arc_account_picker"
resource_path_prefix = "arc_account_picker"
generate_grd("build_grd") {
  out_grd = "$target_gen_dir/resources.grd"
  deps = [ ":build_generated_grdp" ]

  # Resources are expected to be registered with paths like:
  # arc_account_picker/resource_name.js
  input_files_base_dir = rebase_path("./", "//")
  input_files = [
    "arc_account_picker_browser_proxy.js",
    "arc_util.js",
  ]
  grdp_files = [ generated_grdp_file ]
}

generate_grd("build_generated_grdp") {
  out_grd = generated_grdp_file
  input_files_base_dir =
      rebase_path(
          "$root_gen_dir/chrome/browser/resources/chromeos/arc_account_picker/",
          root_build_dir)
  input_files = [ "arc_account_picker_app.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/arc_account_picker_resources.h",
    "grit/arc_account_picker_resources_map.cc",
    "grit/arc_account_picker_resources_map.h",
    "arc_account_picker_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}

js_type_check("closure_compile") {
  is_polymer3 = true
  deps = [
    ":arc_account_picker_app",
    ":arc_account_picker_browser_proxy",
    ":arc_util",
  ]
}

js_library("arc_account_picker_app") {
  deps = [
    ":arc_account_picker_browser_proxy",
    "//ash/webui/common/resources:load_time_data.m",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
}

js_library("arc_account_picker_browser_proxy") {
  deps = [
    "//ash/webui/common/resources:cr.m",
    "//ash/webui/common/resources:cr_deprecated",
  ]
  externs_list = [ "$externs_path/chrome_send.js" ]
}

js_library("arc_util") {
  deps = [ "//ash/webui/common/resources:assert" ]
}

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