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 (113 lines) | stat: -rw-r--r-- 3,287 bytes parent folder | download | duplicates (5)
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
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//remoting/remoting_locales.gni")
import("//tools/grit/grit_rule.gni")

group("resources") {
  public_deps = [
    ":copy_locales",
    ":strings",
    ":verify_resources",
  ]
}

action("verify_resources") {
  script = "//remoting/tools/verify_resources.py"

  sources_to_verify = [
    "../host/continue_window_mac.mm",
    "../host/disconnect_window_mac.mm",
    "../host/installer/mac/uninstaller/remoting_uninstaller-InfoPlist.strings.jinja2",
    "../host/win/core.rc.jinja2",
    "../host/win/host_messages.mc.jinja2",
    "../host/win/version.rc.jinja2",
  ]

  inputs = [ "remoting_strings.grd" ] + sources_to_verify

  stampfile = "$root_out_dir/remoting_resources_verified_stamp"
  outputs = [ stampfile ]

  args = [
           "-t",
           rebase_path(stampfile, root_build_dir),
           "-r",
           rebase_path("remoting_strings.grd", root_build_dir),
         ] + rebase_path(sources_to_verify, root_build_dir)
}

grit_strings("strings") {
  source = "remoting_strings.grd"
  output_name = "remoting_strings"

  # The grd file encodes "remoting/..." in the name, so root everything in the
  # generated file root.
  output_dir = root_gen_dir

  outputs =
      [ "remoting/base/string_resources.h" ] + remoting_resources_locale_files

  # The grd produces a *.pak file and a messages.json file (this one uses
  # underscores instead of hyphens) for each locale.
  locales = remoting_locales_with_pseudolocales
  output_prefix = "remoting/resources/"

  if (is_official_build) {
    defines = [ "_official_build" ]
  }
}

action("copy_locales") {
  script = "../tools/build/remoting_copy_locales.py"

  # The gyp build calls out to Python, but the Python just computes a simple
  # replacement over the locales. Here, we can do this in GN script by
  # pretending the locale list is a list of files. The {{source_name_part}}
  # will just expand to the locale name.
  inputs = []
  foreach(locale, remoting_locales) {
    foreach(_gender_suffix, gender_suffixes) {
      inputs +=
          [ "$root_gen_dir/remoting/resources/${locale}${_gender_suffix}.pak" ]
    }
  }

  # Likewise, process the outputs in the same way as the inputs.
  outputs = []
  if (is_apple) {
    # On mac, use underscores instead of hyphens and put the files in a
    # different place.
    foreach(locale, remoting_locales_with_underscores) {
      foreach(_gender_suffix, gender_suffixes) {
        outputs += [ "$root_out_dir/remoting/resources/${locale}${_gender_suffix}.lproj/locale.pak" ]
      }
    }
  } else {
    foreach(locale, remoting_locales) {
      foreach(_gender_suffix, gender_suffixes) {
        outputs +=
            [ "$root_out_dir/remoting_locales/${locale}${_gender_suffix}.pak" ]
      }
    }
  }

  _locales = []
  foreach(_locale, remoting_locales) {
    foreach(_gender_suffix, gender_suffixes) {
      _locales += [ "${_locale}${_gender_suffix}" ]
    }
  }

  args = [
           "-p",
           current_os,
           "-g",
           rebase_path(root_gen_dir, root_build_dir),
           "-x",
           rebase_path(root_out_dir, root_build_dir),
         ] + _locales

  deps = [ ":strings" ]
}