summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/browser_switch/BUILD.gn
blob: ecc70a689a1584faa3962d3da008e5d79e4ba1f1 (plain)
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
# Copyright 2019 The Chromium Authors. All rights reserved.
# 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("//tools/grit/grit_rule.gni")
import("//tools/polymer/html_to_wrapper.gni")
import("//tools/typescript/ts_library.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

assert(is_win || is_mac || is_linux || is_chromeos_lacros || is_fuchsia)

grit("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 = "$target_gen_dir/resources.grd"
  deps = [ ":build_grd" ]

  outputs = [
    "grit/browser_switch_resources.h",
    "grit/browser_switch_resources_map.cc",
    "grit/browser_switch_resources_map.h",
    "browser_switch_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}

ts_library("build_ts") {
  root_dir = target_gen_dir
  out_dir = "$target_gen_dir/tsc"
  tsconfig_base = "tsconfig_base.json"
  in_files = [
    "app.ts",
    "app.html.ts",
    "browser_switch_proxy.ts",
    "internals/browser_switch_internals_proxy.ts",
    "internals/app.ts",
    "internals/app.html.ts",
  ]
  definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
  deps = [
    "//third_party/polymer/v3_0:library",
    "//ui/webui/resources:library",
  ]
  extra_deps = [
    ":copy_internals",
    ":copy_main",
    ":html_wrapper_files",
  ]
}

generate_grd("build_grd") {
  grd_prefix = "browser_switch"
  out_grd = "$target_gen_dir/resources.grd"
  input_files = [
    "browser_switch.html",
    "internals/browser_switch_internals.html",
  ]
  input_files_base_dir = rebase_path(".", "//")

  deps = [ ":build_ts" ]
  manifest_files =
      filter_include(get_target_outputs(":build_ts"), [ "*.manifest" ])
}

copy("copy_main") {
  sources = [
    "app.ts",
    "browser_switch_proxy.ts",
  ]
  outputs = [ "$target_gen_dir/{{source_file_part}}" ]
}

copy("copy_internals") {
  sources = [
    "internals/app.ts",
    "internals/browser_switch_internals_proxy.ts",
  ]
  outputs = [ "$target_gen_dir/internals/{{source_file_part}}" ]
}

html_to_wrapper("html_wrapper_files") {
  in_files = [
    "app.html",
    "internals/app.html",
  ]
}