chromium/chrome/browser/resources/chromeos/multidevice_internals/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("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/polymer/css_to_wrapper.gni")
import("//tools/polymer/html_to_wrapper.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

resources_grd_file = "$target_gen_dir/resources.grd"
generated_grdp_file = "$target_gen_dir/gen_resources.grdp"

generate_grd("build_grd") {
  grd_prefix = "multidevice_internals"
  out_grd = resources_grd_file
  input_files = [
    "browser_tabs_metadata_form.js",
    "browser_tabs_model_form.js",
    "camera_roll_manager_form.js",
    "i18n_setup.js",
    "index.html",
    "logging_tab.js",
    "log_object.js",
    "multidevice_internals.js",
    "multidevice_logs_browser_proxy.js",
    "multidevice_phonehub_browser_proxy.js",
    "notification_form.js",
    "notification_manager.js",
    "phonehub_tab.js",
    "phone_name_form.js",
    "phone_status_model_form.js",
    "quick_action_controller_form.js",
    "types.js",
  ]
  input_files_base_dir = rebase_path(".", "//")

  grdp_files = [ generated_grdp_file ]

  deps = [ ":build_grdp" ]
}

generate_grd("build_grdp") {
  grd_prefix = "multidevice_internals"
  out_grd = generated_grdp_file
  input_files_base_dir = rebase_path(target_gen_dir, root_build_dir)
  input_files = [
    "browser_tabs_metadata_form.html.js",
    "browser_tabs_model_form.html.js",
    "camera_roll_manager_form.html.js",
    "logging_tab.html.js",
    "log_object.html.js",
    "multidevice_internals.html.js",
    "notification_form.html.js",
    "notification_manager.html.js",
    "phonehub_tab.html.js",
    "phone_name_form.html.js",
    "phone_status_model_form.html.js",
    "quick_action_controller_form.html.js",
    "shared_style.css.js",
  ]
  deps = [
    ":css_wrapper_files",
    ":html_wrapper_files",
  ]
}

grit("resources") {
  enable_input_discovery_for_gn_analyze = false
  source = resources_grd_file
  deps = [ ":build_grd" ]
  outputs = [
    "grit/multidevice_internals_resources.h",
    "grit/multidevice_internals_resources_map.cc",
    "grit/multidevice_internals_resources_map.h",
    "multidevice_internals_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}

js_type_check("closure_compile") {
  is_polymer3 = true
  deps = [
    ":browser_tabs_metadata_form",
    ":camera_roll_manager_form",
    ":log_object",
    ":logging_tab",
    ":multidevice_internals",
    ":multidevice_logs_browser_proxy",
    ":multidevice_phonehub_browser_proxy",
    ":multidevice_phonehub_browser_proxy",
    ":notification_form",
    ":notification_manager",
    ":phone_name_form",
    ":phone_status_model_form",
    ":phonehub_tab",
    ":quick_action_controller_form",
    ":types",
  ]
}

js_library("notification_manager") {
  deps = [
    ":notification_form",
    ":types",
  ]
}

js_library("notification_form") {
  deps = [
    ":multidevice_phonehub_browser_proxy",
    ":types",
    "//ash/webui/common/resources:web_ui_listener_behavior",
  ]
}

js_library("browser_tabs_model_form") {
  deps = [
    ":multidevice_phonehub_browser_proxy",
    ":types",
  ]
}

js_library("browser_tabs_metadata_form") {
  deps = [ ":types" ]
}

js_library("camera_roll_manager_form") {
  deps = [
    ":multidevice_phonehub_browser_proxy",
    ":types",
  ]
}

js_library("i18n_setup") {
  deps = [ "//ash/webui/common/resources:load_time_data.m" ]
}

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

js_library("logging_tab") {
  deps = [
    ":log_object",
    ":multidevice_logs_browser_proxy",
    ":types",
    "//ash/webui/common/resources:cr.m",
    "//ash/webui/common/resources:web_ui_listener_behavior",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
}

js_library("log_object") {
  deps = [
    ":multidevice_logs_browser_proxy",
    ":types",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
}

js_library("multidevice_internals") {
  deps = [
    ":log_object",
    ":logging_tab",
    ":phonehub_tab",
    "//ash/webui/common/resources:cr.m",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
}

js_library("multidevice_logs_browser_proxy") {
  deps = [
    ":types",
    "//ash/webui/common/resources:cr.m",
    "//ash/webui/common/resources:cr_deprecated",
  ]
}

js_library("phone_name_form") {
  deps = [ ":multidevice_phonehub_browser_proxy" ]
}

js_library("phone_status_model_form") {
  deps = [
    ":multidevice_phonehub_browser_proxy",
    ":types",
  ]
}

js_library("quick_action_controller_form") {
  deps = [
    ":multidevice_phonehub_browser_proxy",
    ":types",
    "//ash/webui/common/resources:web_ui_listener_behavior",
  ]
}

js_library("phonehub_tab") {
  deps = [
    ":browser_tabs_model_form",
    ":camera_roll_manager_form",
    ":i18n_setup",
    ":multidevice_phonehub_browser_proxy",
    ":notification_manager",
    ":phone_status_model_form",
    ":quick_action_controller_form",
    ":types",
    "//ash/webui/common/resources:load_time_data.m",
    "//ash/webui/common/resources:web_ui_listener_behavior",
  ]
}

js_library("types") {
}

html_to_wrapper("html_wrapper_files") {
  in_files = [
    "log_object.html",
    "logging_tab.html",
    "multidevice_internals.html",
    "phonehub_tab.html",
    "phone_name_form.html",
    "quick_action_controller_form.html",
    "phone_status_model_form.html",
    "browser_tabs_metadata_form.html",
    "browser_tabs_model_form.html",
    "notification_form.html",
    "notification_manager.html",
    "camera_roll_manager_form.html",
  ]
  use_js = true
}

css_to_wrapper("css_wrapper_files") {
  in_files = [ "shared_style.css" ]
  use_js = true
}