1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90

ash / webui / file_manager / resources / BUILD.gn [blame]

# 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("//build/config/chromeos/ui_mode.gni")
import("//chrome/common/features.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/preprocess_if_expr.gni")
import("//tools/typescript/webui_ts_library.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
import("//ui/webui/resources/tools/optimize_webui.gni")
import("//ui/webui/webui_features.gni")

assert(is_chromeos_ash)

# Only build Labs for debug (non-optimize-webui).
if (!optimize_webui) {
  ts_files = [ "labs/main.ts" ]

  copy("copy_labs") {
    sources = [ "labs/labs.html" ] + ts_files
    outputs = [ "$target_gen_dir/{{source_target_relative}}" ]
  }

  webui_ts_library("labs_build_ts") {
    tsconfig_base = "tsconfig_base.json"
    root_dir = target_gen_dir
    out_dir = "$target_gen_dir/tsc"
    enable_source_maps = true
    extra_deps = [ ":copy_labs" ]

    in_files = ts_files

    deps = [ "//ui/webui/resources/js:build_ts" ]
  }
}

generated_static_grdp = "$target_gen_dir/static_resources.grdp"

generate_grd("build_static_grdp") {
  out_grd = generated_static_grdp
  grd_prefix = "file_manager_swa"

  input_files_base_dir = rebase_path(".", "//")

  input_files = [ "images/icon192.png" ]
}

grd_prefix = "file_manager_swa"
generated_grd = "$target_gen_dir/${grd_prefix}_resources.grd"

generate_grd("build_grd") {
  out_grd = generated_grd

  grdp_files = [ generated_static_grdp ]

  deps = [ ":build_static_grdp" ]
  input_files_base_dir = rebase_path(target_gen_dir, root_build_dir)
  input_files = []
  manifest_files = []

  if (!optimize_webui) {
    # Labs:
    manifest_files += filter_include(get_target_outputs(":labs_build_ts"),
                                     [ "*_manifest.json" ])
    input_files += [ "labs/labs.html" ]
    deps += [
      ":copy_labs",
      ":labs_build_ts",
    ]
  }
}

grit("file_manager_swa_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 = generated_grd
  deps = [ ":build_grd" ]

  outputs = [
    "grit/file_manager_swa_resources.h",
    "grit/file_manager_swa_resources_map.cc",
    "grit/file_manager_swa_resources_map.h",
    "file_manager_swa_resources.pak",
  ]
  output_dir = target_gen_dir
}