chromium/ash/webui/files_internals/BUILD.gn

# Copyright 2022 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")
import("//third_party/closure_compiler/compile_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

assert(is_chromeos_ash, "Files Internals is ash-chrome only")

static_library("files_internals") {
  sources = [
    "files_internals_page_handler.cc",
    "files_internals_page_handler.h",
    "files_internals_ui.cc",
    "files_internals_ui.h",
    "files_internals_ui_delegate.h",
    "url_constants.cc",
    "url_constants.h",
  ]

  deps = [
    "//ash/webui/common:chrome_os_webui_config",
    "//ash/webui/files_internals/mojom",
    "//ash/webui/resources:files_internals_resources",
    "//content/public/browser",
    "//ui/webui",
  ]
}

js_type_check("closure_compile") {
  deps = [ ":js" ]
  closure_flags = default_closure_args + mojom_js_args
}

js_library("js") {
  sources = [ "resources/index.js" ]
  deps = [ "//ash/webui/files_internals/mojom:mojom_webui_js" ]
}

grd_prefix = "ash_files_internals"

mojo_grdp = "$target_gen_dir/files_internals_mojo_resources.grdp"

generate_grd("build_mojo_grdp") {
  grd_prefix = grd_prefix
  out_grd = mojo_grdp

  deps = [ "//ash/webui/files_internals/mojom:mojom_webui_js" ]

  # Flatten out the dependency tree of your mojom and add generated bindings
  # file here.
  input_files =
      [ "ash/webui/files_internals/mojom/files_internals.mojom-webui.js" ]

  input_files_base_dir =
      rebase_path("$root_gen_dir/mojom-webui", "$root_build_dir")
}

generate_grd("build_grd") {
  input_files_base_dir = rebase_path("resources", "//")
  input_files = [
    "index.html",
    "index.js",
  ]

  grd_prefix = grd_prefix
  out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
  deps = [ ":build_mojo_grdp" ]
  grdp_files = [ mojo_grdp ]
}