chromium/ash/webui/color_internals/resources/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("//ui/webui/resources/tools/build_webui.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

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

build_webui("build") {
  grd_prefix = "ash_color_internals"

  # When adding a new file to color internals, add it to one of the lists
  # below. `non_web_component_files` are plain ts files, `web_component_files` are
  # polymer based ts files, `css_files` are Polymer css files,
  # `static_files` are non-js files, e.g. image, html, plain css.

  static_files = [ "index.html" ]

  non_web_component_files = [
    "index.ts",
    "utils.ts",
    "wallpaper_colors.ts",
  ]

  mojo_files_deps = [ "../mojom:mojom_ts__generator" ]
  mojo_files = [ "$root_gen_dir/ash/webui/color_internals/mojom/color_internals.mojom-webui.ts" ]

  ts_deps = [
    "//ui/webui/resources/cr_components/color_change_listener:build_ts",
    "//ui/webui/resources/js:build_ts",
    "//ui/webui/resources/mojo:build_ts",
  ]

  webui_context_type = "trusted"
  extra_grdp_files = [ "$target_gen_dir/webui_cros_styles_resources.grdp" ]
  extra_grdp_deps = [ ":build_cros_styles_grdp" ]
  grit_output_dir = "$root_gen_dir/ash/webui"
}

generate_grd("build_cros_styles_grdp") {
  grd_prefix = "webui"
  out_grd = "$target_gen_dir/${grd_prefix}_cros_styles_resources.grdp"
  public_deps = [ "//ui/chromeos/styles:color_internals_tokens_json" ]
  input_files_base_dir = rebase_path("$root_gen_dir/", root_build_dir)
  input_files = [ "ui/chromeos/styles/color_internals_tokens.json" ]
  resource_path_rewrites = [ "ui/chromeos/styles/color_internals_tokens.json|chromeos/colors/color_internals_tokens.json" ]
}