| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Compile a protocol buffer. | 5 # Compile a protocol buffer. |
| 6 # | 6 # |
| 7 # Protobuf parameters: | 7 # Protobuf parameters: |
| 8 # | 8 # |
| 9 # proto_out_dir (optional) | 9 # proto_out_dir (optional) |
| 10 # Specifies the path suffix that output files are generated under. This | 10 # Specifies the path suffix that output files are generated under. This |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 outputs = [ | 79 outputs = [ |
| 80 "$out_dir/{{source_name_part}}_pb2.py", | 80 "$out_dir/{{source_name_part}}_pb2.py", |
| 81 "$out_dir/{{source_name_part}}.pb.cc", | 81 "$out_dir/{{source_name_part}}.pb.cc", |
| 82 "$out_dir/{{source_name_part}}.pb.h", | 82 "$out_dir/{{source_name_part}}.pb.h", |
| 83 ] | 83 ] |
| 84 | 84 |
| 85 args = [] | 85 args = [] |
| 86 if (defined(invoker.cc_include)) { | 86 if (defined(invoker.cc_include)) { |
| 87 args += [ "--include", invoker.cc_include ] | 87 args += [ |
| 88 "--include", |
| 89 invoker.cc_include, |
| 90 ] |
| 88 } | 91 } |
| 89 | 92 |
| 90 args += [ | 93 args += [ |
| 91 "--protobuf", "$rel_out_dir/{{source_name_part}}.pb.h", | 94 "--protobuf", |
| 92 "--proto-in-dir", "{{source_dir}}", | 95 "$rel_out_dir/{{source_name_part}}.pb.h", |
| 93 "--proto-in-file", "{{source_file_part}}", | 96 "--proto-in-dir", |
| 97 "{{source_dir}}", |
| 98 "--proto-in-file", |
| 99 "{{source_file_part}}", |
| 100 |
| 94 # TODO(brettw) support system protobuf compiler. | 101 # TODO(brettw) support system protobuf compiler. |
| 95 "--use-system-protobuf=0", | 102 "--use-system-protobuf=0", |
| 96 ] | 103 ] |
| 97 | 104 |
| 98 protoc_label = "//third_party/protobuf:protoc($host_toolchain)" | 105 protoc_label = "//third_party/protobuf:protoc($host_toolchain)" |
| 99 args += [ | 106 args += [ |
| 100 "--", | 107 "--", |
| 108 |
| 101 # Prepend with "./" so this will never pick up the system one (normally | 109 # Prepend with "./" so this will never pick up the system one (normally |
| 102 # when not cross-compiling, protoc's output directory will be the same | 110 # when not cross-compiling, protoc's output directory will be the same |
| 103 # as the build dir, so the relative location will be empty). | 111 # as the build dir, so the relative location will be empty). |
| 104 "./" + rebase_path(get_label_info(protoc_label, "root_out_dir") + | 112 "./" + |
| 105 "/protoc", root_build_dir), | 113 rebase_path(get_label_info(protoc_label, "root_out_dir") + "/protoc", |
| 114 root_build_dir), |
| 106 ] | 115 ] |
| 107 | 116 |
| 108 # If passed cc_generator_options should end in a colon, which will separate | 117 # If passed cc_generator_options should end in a colon, which will separate |
| 109 # it from the directory when we concatenate them. The proto compiler | 118 # it from the directory when we concatenate them. The proto compiler |
| 110 # understands this syntax. | 119 # understands this syntax. |
| 111 if (defined(invoker.cc_generator_options)) { | 120 if (defined(invoker.cc_generator_options)) { |
| 112 cc_generator_options = invoker.cc_generator_options | 121 cc_generator_options = invoker.cc_generator_options |
| 113 } else { | 122 } else { |
| 114 cc_generator_options = "" | 123 cc_generator_options = "" |
| 115 } | 124 } |
| 116 args += [ | 125 args += [ |
| 117 # cc_generator_options is supposed to end in a colon if it's nonempty. | 126 # cc_generator_options is supposed to end in a colon if it's nonempty. |
| 118 "--cpp_out", "$cc_generator_options$rel_out_dir", | 127 "--cpp_out", |
| 119 "--python_out", rel_out_dir, | 128 "$cc_generator_options$rel_out_dir", |
| 129 "--python_out", |
| 130 rel_out_dir, |
| 120 ] | 131 ] |
| 121 | 132 |
| 122 deps = [ protoc_label ] | 133 deps = [ |
| 134 protoc_label, |
| 135 ] |
| 123 | 136 |
| 124 if (defined(invoker.deps)) { | 137 if (defined(invoker.deps)) { |
| 125 deps += invoker.deps | 138 deps += invoker.deps |
| 126 } | 139 } |
| 127 } | 140 } |
| 128 | 141 |
| 129 source_set(target_name) { | 142 source_set(target_name) { |
| 130 if (defined(invoker.visibility)) { | 143 if (defined(invoker.visibility)) { |
| 131 visibility = invoker.visibility | 144 visibility = invoker.visibility |
| 132 } | 145 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 145 public_deps = [ | 158 public_deps = [ |
| 146 # The generated headers reference headers within protobuf_lite, so | 159 # The generated headers reference headers within protobuf_lite, so |
| 147 # dependencies must be able to find those headers too. | 160 # dependencies must be able to find those headers too. |
| 148 "//third_party/protobuf:protobuf_lite", | 161 "//third_party/protobuf:protobuf_lite", |
| 149 ] | 162 ] |
| 150 deps = [ | 163 deps = [ |
| 151 ":$action_name", | 164 ":$action_name", |
| 152 ] | 165 ] |
| 153 } | 166 } |
| 154 } | 167 } |
| OLD | NEW |