summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/commander/BUILD.gn
blob: 7bbedeed930159ee60048b7ce98bfcba06a2cd21 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Copyright 2020 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("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/preprocess_grit.gni")
import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

preprocess_folder = "preprocessed"
preprocess_manifest = "preprocessed_manifest.json"
preprocess_gen_manifest = "preprocessed_gen_manifest.json"

generate_grd("build_grd") {
  grd_prefix = "commander"
  out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
  input_files = [ "commander.html" ]
  input_files_base_dir = rebase_path(".", "//")

  deps = [
    ":preprocess",
    ":preprocess_generated",
  ]
  manifest_files = [
    "$target_gen_dir/$preprocess_manifest",
    "$target_gen_dir/$preprocess_gen_manifest",
  ]
}

preprocess_grit("preprocess") {
  in_folder = "./"
  out_folder = "$target_gen_dir/$preprocess_folder"
  out_manifest = "$target_gen_dir/$preprocess_manifest"
  in_files = [
    "browser_proxy.js",
    "types.js",
  ]
}

preprocess_grit("preprocess_generated") {
  deps = [ ":web_components" ]
  in_folder = target_gen_dir
  out_folder = "$target_gen_dir/$preprocess_folder"
  out_manifest = "$target_gen_dir/$preprocess_gen_manifest"
  in_files = [
    "app.js",
    "icons.js",
    "option.js",
  ]
}

grit("commander_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/commander_resources.grd"
  deps = [ ":build_grd" ]
  outputs = [
    "grit/commander_resources.h",
    "grit/commander_resources_map.cc",
    "grit/commander_resources_map.h",
    "commander_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}

js_type_check("closure_compile") {
  is_polymer3 = true
  deps = [
    ":app",
    ":browser_proxy",
    ":option",
    ":types",
  ]
}

js_library("app") {
  deps = [
    ":browser_proxy",
    ":option",
    ":types",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
    "//ui/webui/resources/js:cr.m",
  ]
}

js_library("browser_proxy") {
  deps = [ "//ui/webui/resources/js:cr.m" ]
}

js_library("option") {
  deps = [
    ":icons",
    ":types",
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
}

js_library("icons") {
}

js_library("types") {
}

html_to_js("web_components") {
  js_files = [
    "app.js",
    "option.js",
    "icons.js",
  ]
}