File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-1~deb13u1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,096 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 (145 lines) | stat: -rw-r--r-- 4,010 bytes parent folder | download | duplicates (7)
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
# Copyright 2021 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("//build/config/features.gni")
import(
    "//chrome/browser/resources/chromeos/accessibility/tools/run_jsbundler.gni")
import("//chrome/common/features.gni")
import("//chrome/test/base/ash/js2gtest.gni")
import("//tools/typescript/ts_library.gni")
import("//ui/webui/resources/tools/bundle_js.gni")
import("//ui/webui/resources/tools/minify_js.gni")

assert(is_chromeos)

group("build") {
  deps = [
    ":copy_background",
    ":minify_js",
  ]
}

enhanced_network_tts_dir =
    "$root_out_dir/resources/chromeos/accessibility/enhanced_network_tts"

# Directory where typescript build will occur.
ts_build_staging_dir = "$target_gen_dir/ts_build_staging"

tsc_out_dir = "$target_gen_dir/tsc"

common_tsc_dir =
    "$root_gen_dir/chrome/browser/resources/chromeos/accessibility/common/tsc"

# TS files to compile.
ts_modules = [
  "background.ts",
  "enhanced_network_tts.ts",
]

# Root dir must be parent directory to access common/.
ts_library("ts_build") {
  root_dir = "$ts_build_staging_dir"
  out_dir = tsc_out_dir

  deps = [ "../common:ts_build" ]

  extra_deps = [ ":stage_ts_build" ]

  path_mappings =
      [ "/common/*|" + rebase_path("$common_tsc_dir/*", target_gen_dir) ]

  definitions = [
    "mojo_bindings_externs.d.ts",
    "../definitions/extensions.d.ts",
    "../definitions/extension_types.d.ts",
    "../definitions/runtime.d.ts",
    "../definitions/tabs.d.ts",
    "../definitions/tts.d.ts",
    "../definitions/tts_engine.d.ts",
    "../definitions/windows.d.ts",
    "//tools/typescript/definitions/chrome_event.d.ts",
  ]

  in_files = ts_modules

  tsconfig_base = "../tsconfig.base.json"
}

bundle_js("bundle_js") {
  visibility = [ ":minify_js" ]

  host = "_ignored_"
  input = rebase_path("$tsc_out_dir", root_build_dir)
  js_module_in_files = [ "background.js" ]
  out_folder = "$target_gen_dir/bundle"

  deps = [
    ":ts_build",
    "../common:copied_files",
  ]
}

minify_js("minify_js") {
  visibility = [ ":build" ]

  deps = [ ":bundle_js" ]
  in_folder = "$target_gen_dir/bundle"
  in_files = [ "background.rollup.js" ]
  out_folder = "$enhanced_network_tts_dir"
}

copy("copy_background") {
  sources = [ "background.html" ]
  outputs = [ "$enhanced_network_tts_dir/background.html" ]
}

# Copy all JS and TS sources to a staging folder. All generated TS/JS files
# will also be copied into this folder, which will allow us to support a TS
# build that uses both checked-in and generated files.
copy("stage_ts_build") {
  sources = ts_modules
  outputs = [ "$ts_build_staging_dir/{{source_target_relative}}" ]
}

source_set("browser_tests") {
  testonly = true
  assert(enable_extensions)

  deps = [ ":enhanced_network_tts_extjs_tests" ]

  data = [
    "$root_out_dir/resources/chromeos/accessibility/enhanced_network_tts/background.html",
    "$root_out_dir/resources/chromeos/accessibility/enhanced_network_tts/background.js",
    "$root_out_dir/resources/chromeos/accessibility/enhanced_network_tts/enhanced_network_tts.js",
    "//chrome/browser/resources/chromeos/accessibility/common/",
    "//chrome/browser/resources/chromeos/accessibility/enhanced_network_tts/",
  ]
  data += js2gtest_js_libraries
}

js2gtest("enhanced_network_tts_extjs_tests") {
  test_type = "extension"
  sources = [
    "enhanced_network_tts_unittest.js",
    "error_handling_unittest.js",
  ]
  gen_include_files = [
    "../common/testing/accessibility_test_base.js",
    "../common/testing/e2e_test_base.js",
    "enhanced_network_tts_e2e_test_base.js",
    "mock_mojo_private.js",
  ]

  # The test base classes generate C++ code with these deps.
  deps = [
    "//ash",
    "//base",
    "//chrome/browser/ash/accessibility",
    "//chrome/browser/ash/crosapi",
    "//chrome/browser/ash/system_web_apps",
    "//chrome/common",
  ]
  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
}