File: BUILD.gn

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,122,156 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 (106 lines) | stat: -rw-r--r-- 3,011 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
# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//third_party/protobuf/proto_library.gni")

# TODO(nparker): reduce the duplication between these two, somehow.

# Generate the binary proto form of "file_types" from the ascii proto.
action("make_file_types_protobuf") {
  script = "gen_file_type_proto.py"

  # The output goes in $target_gen_dir since that's where
  # components/resources/safe_browsing_resources.grdp will look for it.

  input_filename = "download_file_types.asciipb"
  output_dir = target_gen_dir
  output_basename = "download_file_types.pb"
  python_path_safe_browsing =
      "$proto_python_root/components/safe_browsing/content/common/proto"

  # Pick an architecture to generate for. These string match those
  # in the python script.
  if (is_android) {
    target_arch = "android"
  } else if (is_chromeos) {
    target_arch = "chromeos"
  } else if (is_win) {
    target_arch = "win"
  } else if (is_mac) {
    target_arch = "mac"
  } else if (is_linux) {
    target_arch = "linux"
  } else {
    # This will cause the script to fail.
    target_arch = "unknown_target_arch"
  }

  inputs = [ input_filename ]

  deps = [
    "//components/safe_browsing/content/common/proto:download_file_types_proto",
    "//third_party/protobuf:py_proto",
  ]

  outputs = [ "$output_dir/$output_basename" ]

  args = [
    "-w",
    "-t",
    target_arch,
    "-i",
    rebase_path(input_filename, root_build_dir),
    "-d",
    rebase_path(output_dir, root_build_dir),
    "-o",
    output_basename,
    "-p",
    rebase_path(proto_python_root, root_build_dir),
    "-p",
    rebase_path(python_path_safe_browsing, root_build_dir),
  ]
}

# Generate the binary proto for ALL platforms.  This is only run manually
# when pushing the files to GCS for the component-updater to pick up.
action("make_all_file_types_protobuf") {
  script = "gen_file_type_proto.py"

  input_filename = "download_file_types.asciipb"
  output_dir = "$target_gen_dir/all"
  outputs = [
    # LINT.IfChange(PlatformTypes)
    "$output_dir/android/download_file_types.pb",
    "$output_dir/chromeos/download_file_types.pb",
    "$output_dir/linux/download_file_types.pb",
    "$output_dir/mac/download_file_types.pb",
    "$output_dir/win/download_file_types.pb",

    # LINT.ThenChange(gen_file_type_proto.py:PlatformTypes)
  ]
  python_path_safe_browsing =
      "$proto_python_root/components/safe_browsing/content/common/proto"

  inputs = [ input_filename ]

  deps = [
    "//components/safe_browsing/content/common/proto:download_file_types_proto",
    "//third_party/protobuf:py_proto",
  ]

  args = [
    "-w",
    "-a",
    "-i",
    rebase_path(input_filename, root_build_dir),
    "-d",
    rebase_path(output_dir, root_build_dir),
    "-o",
    "download_file_types.pb",
    "-p",
    rebase_path(proto_python_root, root_build_dir),
    "-p",
    rebase_path(python_path_safe_browsing, root_build_dir),
  ]
}