File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (189 lines) | stat: -rw-r--r-- 5,058 bytes parent folder | download | duplicates (3)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# 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("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/preprocess_if_expr.gni")
import("//tools/polymer/css_to_wrapper.gni")
import("//tools/polymer/html_to_wrapper.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

assert(is_chromeos, "Only available in ChromeOS.")

###################
#### RESOURCES ####
###################

grit("resources") {
  defines = chrome_grit_defines

  # This is necessary since the GRD is generated during build time.
  enable_input_discovery_for_gn_analyze = false

  source = "$target_gen_dir/assistant_optin_resources.grd"
  deps = [ ":build_grd" ]
  outputs = [
    "grit/assistant_optin_resources.h",
    "grit/assistant_optin_resources_map.h",
    "grit/assistant_optin_resources_map.cc",
    "assistant_optin_resources.pak",
  ]
  output_dir = "$root_gen_dir/chrome"
}

########################
#### GRD GENERATION ####
########################

existing_files_manifest = "existing_files_manifest.json"
web_components_manifest = "web_components_manifest.json"
preprocessed_folder = "assistant_optin_preprocessed"

generate_grd("build_grd") {
  grd_prefix = "assistant_optin"
  out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
  deps = [
    ":preprocess",
    ":preprocess_gen_js_files",
  ]
  manifest_files = [
    "$target_gen_dir/$existing_files_manifest",
    "$target_gen_dir/$web_components_manifest",
  ]

  input_files_base_dir = rebase_path(".", "//")
  input_files = [
    "voice_laptop.json",
    "voice_tablet.json",
  ]
  resource_path_prefix = "assistant_optin"
}

# Preprocess existing files.
preprocess_if_expr("preprocess") {
  out_folder = "$target_gen_dir/$preprocessed_folder"
  out_manifest = "$target_gen_dir/$existing_files_manifest"
  in_files = [
    "assistant_optin.html",
    "assistant_optin.js",
    "browser_proxy.js",
    "utils.js",
  ]
}

# Preprocess autogenerated files
preprocess_if_expr("preprocess_gen_js_files") {
  defines = chrome_grit_defines
  deps = [
    ":copy_js",
    ":css_wrapper_files",
    ":html_wrapper_files",
  ]
  in_folder = target_gen_dir
  out_folder = "$target_gen_dir/$preprocessed_folder"
  out_manifest = "$target_gen_dir/$web_components_manifest"

  in_files = [
    "assistant_common_styles.css.js",
    "assistant_icons.html.js",
    "assistant_loading.html.js",
    "assistant_optin_flow.html.js",
    "assistant_related_info.html.js",
    "assistant_value_prop.html.js",
    "assistant_voice_match.html.js",
    "setting_zippy.html.js",
    "voice_match_entry.html.js",
    "assistant_loading.js",
    "assistant_optin_flow.js",
    "assistant_related_info.js",
    "assistant_value_prop.js",
    "assistant_voice_match.js",
    "setting_zippy.js",
    "voice_match_entry.js",
  ]
}

copy("copy_js") {
  sources = [
    "assistant_loading.js",
    "assistant_optin_flow.js",
    "assistant_related_info.js",
    "assistant_value_prop.js",
    "assistant_voice_match.js",
    "setting_zippy.js",
    "voice_match_entry.js",
  ]
  outputs = [ "$target_gen_dir/{{source_file_part}}" ]
}

#############################
#### CLOSURE COMPILATION ####
#############################

js_type_check("closure_compile") {
  is_polymer3 = true
  closure_flags = default_closure_args
  deps = [
    ":assistant_common_styles.css",
    ":assistant_icons.html",
    ":browser_proxy",
    ":voice_match_entry",
  ]
}

js_library("assistant_common_styles.css") {
  sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/assistant_optin/assistant_common_styles.css.js" ]
  deps = [
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
  extra_deps = [ ":css_wrapper_files" ]
}

js_library("assistant_icons.html") {
  sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/assistant_optin/assistant_icons.html.js" ]
  deps = [
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
  extra_deps = [ ":html_wrapper_files" ]
}

js_library("voice_match_entry") {
  sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/assistant_optin/voice_match_entry.js" ]
  deps = [
    "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
  ]
  extra_deps = [
    ":copy_js",
    ":html_wrapper_files",
  ]
}

js_library("browser_proxy") {
  externs_list = [ "$externs_path/chrome_send.js" ]
}

##########################
#### POLYMER3 MODULES ####
##########################

css_to_wrapper("css_wrapper_files") {
  in_files = [ "assistant_common_styles.css" ]
  use_js = true
}

html_to_wrapper("html_wrapper_files") {
  in_files = [
    "assistant_icons.html",
    "assistant_loading.html",
    "assistant_optin_flow.html",
    "assistant_related_info.html",
    "assistant_value_prop.html",
    "assistant_voice_match.html",
    "setting_zippy.html",
    "voice_match_entry.html",
  ]
  template = "polymer"
  use_js = true
}