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

# Copyright 2018 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("//ui/webui/resources/tools/build_webui.gni")

build_webui("build") {
  static_files = [ "network.html" ]

  # Files holding a Polymer element definition AND have an equivalent .html file.
  web_component_files = [
    "network_logs_ui.ts",
    "network_metrics_ui.ts",
    "network_state_ui.ts",
    "network_ui.ts",
  ]

  non_web_component_files = [ "network_ui_browser_proxy.ts" ]

  ts_definitions = [
    "//chrome/browser/resources/chromeos/network_ui/third_party/uPlot.iife.min.d.ts",
    "//tools/typescript/definitions/chrome_event.d.ts",
    "//tools/typescript/definitions/chrome_send.d.ts",
    "//tools/typescript/definitions/networking_private.d.ts",
    "//tools/typescript/definitions/runtime.d.ts",
    "//tools/typescript/definitions/tabs.d.ts",
  ]

  ts_deps = [
    "//ash/webui/common/resources:build_ts",
    "//ash/webui/common/resources/cr_elements:build_ts",
    "//third_party/polymer/v3_0:library",
    "//ui/webui/resources/cr_components/color_change_listener:build_ts",
    "//ui/webui/resources/js:build_ts",
    "//ui/webui/resources/mojo:build_ts",
  ]

  ts_extra_deps = [
    ":copy_uplot",
    ":copy_uplot_dts",
  ]

  grd_prefix = "network_ui"
  webui_context_type = "trusted"

  extra_grdp_deps = [ ":build_uplot_grdp" ]
  extra_grdp_files = [ "$target_gen_dir/uplot_resources.grdp" ]
}

generate_grd("build_uplot_grdp") {
  grd_prefix = "network_ui"
  out_grd = "$target_gen_dir/uplot_resources.grdp"
  input_files = [
    "third_party/uPlot.iife.min.js",
    "third_party/uPlot.min.css",
  ]
  input_files_base_dir =
      rebase_path("$target_gen_dir/preprocessed", root_build_dir)
  deps = [ ":copy_uplot" ]
}

copy("copy_uplot") {
  sources = [
    "//chrome/browser/resources/chromeos/network_ui/third_party/uPlot.iife.min.js",
    "//chrome/browser/resources/chromeos/network_ui/third_party/uPlot.min.css",
  ]
  outputs = [ "$target_gen_dir/preprocessed/third_party/{{source_file_part}}" ]
}

copy("copy_uplot_dts") {
  sources = [ "//chrome/browser/resources/chromeos/network_ui/third_party/uPlot.iife.min.d.ts" ]
  outputs = [ "$target_gen_dir/preprocessed/third_party/{{source_file_part}}" ]
}