• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git chrome/browser/privacy/BUILD.gn chrome/browser/privacy/BUILD.gn
2index cd1f57e009f50..f93721e39e559 100644
3--- chrome/browser/privacy/BUILD.gn
4+++ chrome/browser/privacy/BUILD.gn
5@@ -93,11 +93,15 @@ if (is_win || is_linux) {
6     ]
7     proto_deps = [ "//components/policy:full_runtime_code_generate" ]
8     proto_out_dir = "/chrome/browser/privacy"
9+    generate_cc = false
10+    generate_library = false
11   }
12
13   proto_library("traffic_annotation_proto") {
14     sources = [ "traffic_annotation.proto" ]
15     proto_deps = [ ":chrome_settings_full_runtime" ]
16     import_dirs = [ "$root_gen_dir" + "/components/policy/proto" ]
17+    generate_cc = false
18+    generate_library = false
19   }
20 }
21diff --git third_party/protobuf/proto_library.gni third_party/protobuf/proto_library.gni
22index a6943f5896cba..1561a868ccef9 100644
23--- third_party/protobuf/proto_library.gni
24+++ third_party/protobuf/proto_library.gni
25@@ -28,6 +28,9 @@
26 #   generate_javascript (optional, default false)
27 #       Generate Javascript protobuf stubs.
28 #
29+#   generate_library (optional, default true)
30+#       Generate a "static_library" target for linking with the generated code.
31+#
32 #   cc_generator_options (optional)
33 #       List of extra flags passed to the protocol compiler.  If you need to
34 #       add an EXPORT macro to a protobuf's C++ header, set the
35@@ -266,14 +269,21 @@ template("proto_library") {
36   protogens_cc = []
37   protogens_js = []
38
39+  # Whether source code bindings should be generated.
40+  generate_sources = generate_cc || generate_python || generate_with_plugin ||
41+                     generate_javascript
42+
43   # Whether library should be generated.
44   # Library is not needed when proto_library is used to generate binary descriptor, in which case
45   # corresponding library target should be omitted entirely.
46-  generate_library = generate_cc || generate_python || generate_with_plugin ||
47-                     generate_javascript
48+  if (defined(invoker.generate_library)) {
49+    generate_library = invoker.generate_library
50+  } else {
51+    generate_library = generate_sources
52+  }
53
54   # List output files.
55-  if (generate_library) {
56+  if (generate_sources) {
57     foreach(proto, protos) {
58       proto_dir = get_path_info(proto, "dir")
59       proto_name = get_path_info(proto, "name")
60