Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 1 | # Copyright 2020 The Pigweed Authors |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
| 15 | import("$dir_pw_build/python_script.gni") |
| 16 | |
| 17 | # Python script that invokes protoc. |
| 18 | _gen_script_path = |
| 19 | "$dir_pw_protobuf_compiler/py/pw_protobuf_compiler/generate_protos.py" |
| 20 | |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 21 | _forwarded_vars = [ |
| 22 | "testonly", |
| 23 | "visibility", |
| 24 | ] |
| 25 | |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 26 | # Generates pw_protobuf C++ code for proto files, creating a source_set of the |
| 27 | # generated files. This is internal and should not be used outside of this file. |
| 28 | # Use pw_proto_library instead. |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 29 | # |
| 30 | # Args: |
| 31 | # protos: List of input .proto files. |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 32 | template("_pw_pwpb_proto_library") { |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 33 | _proto_gen_dir = "$root_gen_dir/protos" |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 34 | _module_path = get_path_info(".", "abspath") |
| 35 | _relative_proto_paths = rebase_path(invoker.protos, _module_path) |
| 36 | |
| 37 | _outputs = [] |
| 38 | foreach(_proto, _relative_proto_paths) { |
| 39 | _output = string_replace(_proto, ".proto", ".pwpb.h") |
| 40 | _outputs += [ "$_proto_gen_dir/$_output" ] |
| 41 | } |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 42 | |
| 43 | _gen_target = "${target_name}_gen" |
| 44 | pw_python_script(_gen_target) { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 45 | forward_variables_from(invoker, _forwarded_vars) |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 46 | script = _gen_script_path |
| 47 | args = [ |
| 48 | "--language", |
| 49 | "cc", |
| 50 | "--module-path", |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 51 | _module_path, |
| 52 | "--include-file", |
| 53 | invoker.include_file, |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 54 | "--out-dir", |
| 55 | _proto_gen_dir, |
| 56 | ] + get_path_info(invoker.protos, "abspath") |
| 57 | inputs = invoker.protos |
| 58 | outputs = _outputs |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 59 | deps = invoker.deps |
Alexei Frolov | bbf164c | 2019-12-16 12:51:59 -0800 | [diff] [blame] | 60 | if (defined(invoker.protoc_deps)) { |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 61 | deps += invoker.protoc_deps |
Alexei Frolov | bbf164c | 2019-12-16 12:51:59 -0800 | [diff] [blame] | 62 | } |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | # For C++ proto files, the generated proto directory is added as an include |
| 66 | # path for the code. This requires using "all_dependent_configs" to force the |
| 67 | # include on any code that transitively depends on the generated protos. |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 68 | _include_config_target = "${target_name}_includes" |
| 69 | config(_include_config_target) { |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 70 | include_dirs = [ "$_proto_gen_dir" ] |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | # Create a library with the generated source files. |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 74 | source_set(target_name) { |
| 75 | all_dependent_configs = [ ":$_include_config_target" ] |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 76 | deps = [ ":$_gen_target" ] |
| 77 | public_deps = [ dir_pw_protobuf ] + invoker.gen_deps |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 78 | sources = get_target_outputs(":$_gen_target") |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 79 | public = filter_include(sources, [ "*.pwpb.h" ]) |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | # Generates nanopb code for proto files, creating a source_set of the generated |
| 84 | # files. This is internal and should not be used outside of this file. Use |
| 85 | # pw_proto_library instead. |
| 86 | # |
| 87 | # Args: |
| 88 | # protos: List of input .proto files. |
| 89 | template("_pw_nanopb_proto_library") { |
| 90 | assert(defined(dir_third_party_nanopb) && dir_third_party_nanopb != "", |
| 91 | "\$dir_third_party_nanopb must be set to compile nanopb protobufs") |
| 92 | |
| 93 | _proto_gen_dir = "$root_gen_dir/protos" |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 94 | _module_path = get_path_info(".", "abspath") |
| 95 | _relative_proto_paths = rebase_path(invoker.protos, _module_path) |
| 96 | |
| 97 | _outputs = [] |
| 98 | foreach(_proto, _relative_proto_paths) { |
| 99 | _output_h = string_replace(_proto, ".proto", ".pb.h") |
| 100 | _output_c = string_replace(_proto, ".proto", ".pb.c") |
| 101 | _outputs += [ |
| 102 | "$_proto_gen_dir/$_output_h", |
| 103 | "$_proto_gen_dir/$_output_c", |
| 104 | ] |
| 105 | } |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 106 | |
| 107 | _nanopb_plugin = "$dir_third_party_nanopb/generator/protoc-gen-nanopb" |
| 108 | if (host_os == "win") { |
| 109 | _nanopb_plugin += ".bat" |
| 110 | } |
| 111 | |
| 112 | # Create a target which runs protoc configured with the nanopb plugin to |
| 113 | # generate the C proto sources. |
| 114 | _gen_target = "${target_name}_gen" |
| 115 | pw_python_script(_gen_target) { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 116 | forward_variables_from(invoker, _forwarded_vars) |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 117 | script = _gen_script_path |
| 118 | args = [ |
| 119 | "--language", |
| 120 | "nanopb", |
| 121 | "--module-path", |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 122 | _module_path, |
Alexei Frolov | ac5b674 | 2020-05-01 13:28:14 -0700 | [diff] [blame] | 123 | "--include-paths", |
| 124 | "$dir_third_party_nanopb/generator/proto", |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 125 | "--include-file", |
| 126 | invoker.include_file, |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 127 | "--out-dir", |
| 128 | _proto_gen_dir, |
| 129 | "--custom-plugin", |
| 130 | get_path_info(_nanopb_plugin, "abspath"), |
| 131 | ] + get_path_info(invoker.protos, "abspath") |
| 132 | inputs = invoker.protos |
| 133 | outputs = _outputs |
| 134 | |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 135 | deps = invoker.deps |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 136 | if (defined(invoker.protoc_deps)) { |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 137 | deps += invoker.protoc_deps |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 138 | } |
| 139 | } |
| 140 | |
| 141 | # For C++ proto files, the generated proto directory is added as an include |
| 142 | # path for the code. This requires using "all_dependent_configs" to force the |
| 143 | # include on any code that transitively depends on the generated protos. |
| 144 | _include_root = rebase_path(get_path_info(".", "abspath"), "//") |
| 145 | _include_config_target = "${target_name}_includes" |
| 146 | config(_include_config_target) { |
| 147 | include_dirs = [ |
| 148 | "$_proto_gen_dir", |
| 149 | "$_proto_gen_dir/$_include_root", |
| 150 | ] |
| 151 | } |
| 152 | |
| 153 | # Create a library with the generated source files. |
| 154 | source_set(target_name) { |
| 155 | all_dependent_configs = [ ":$_include_config_target" ] |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 156 | deps = [ ":$_gen_target" ] |
| 157 | public_deps = [ dir_third_party_nanopb ] + invoker.gen_deps |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 158 | sources = get_target_outputs(":$_gen_target") |
| 159 | public = filter_include(sources, [ "*.pb.h" ]) |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 160 | } |
| 161 | } |
| 162 | |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 163 | # Generates Go code for proto files, listing the proto output directory in the |
| 164 | # metadata variable GOPATH. Internal use only. |
| 165 | # |
| 166 | # Args: |
| 167 | # protos: List of input .proto files. |
| 168 | template("_pw_go_proto_library") { |
| 169 | _proto_gopath = "$root_gen_dir/go" |
| 170 | _proto_gen_dir = "$_proto_gopath/src" |
| 171 | _rebased_gopath = rebase_path(_proto_gopath) |
| 172 | |
| 173 | pw_python_script(target_name) { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 174 | forward_variables_from(invoker, _forwarded_vars) |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 175 | metadata = { |
| 176 | gopath = [ "GOPATH+=$_rebased_gopath" ] |
Alexei Frolov | c15a988 | 2019-12-23 14:29:02 -0800 | [diff] [blame] | 177 | external_deps = [ |
| 178 | "github.com/golang/protobuf/proto", |
| 179 | "google.golang.org/grpc", |
| 180 | ] |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 181 | } |
| 182 | script = _gen_script_path |
| 183 | args = [ |
| 184 | "--language", |
| 185 | "go", |
| 186 | "--module-path", |
| 187 | "//", |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 188 | "--include-file", |
| 189 | invoker.include_file, |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 190 | "--out-dir", |
| 191 | _proto_gen_dir, |
| 192 | ] + get_path_info(invoker.protos, "abspath") |
| 193 | inputs = invoker.protos |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 194 | deps = invoker.deps + invoker.gen_deps |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 195 | stamp = true |
| 196 | } |
| 197 | } |
| 198 | |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 199 | # Generates protobuf code from .proto definitions for various languages. |
| 200 | # |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 201 | # The generators to use are defined in the pw_protobuf_generators build |
| 202 | # variable. Each listed generator creates a generated code target called |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 203 | # |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 204 | # <target_name>_<generator> |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 205 | # |
| 206 | # For example, with the following definitions: |
| 207 | # |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 208 | # pw_protobuf_generators = [ "pwpb", "py" ] |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 209 | # |
| 210 | # pw_proto_library("my_protos") { |
| 211 | # sources = [ "foo.proto" ] |
| 212 | # } |
| 213 | # |
| 214 | # Two build targets will be created for the declared "my_protos" target. |
| 215 | # |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 216 | # "my_protos_pwpb" <-- C++ source_set containing generated proto code |
| 217 | # "my_protos_py" <-- Python module containing generated proto code |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 218 | # |
| 219 | # Args: |
| 220 | # sources: List of input .proto files. |
| 221 | # deps: List of other pw_proto_library dependencies. |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 222 | template("pw_proto_library") { |
| 223 | assert(defined(invoker.sources) && invoker.sources != [], |
Wyatt Hepler | b4b73a6 | 2020-05-27 15:17:27 -0700 | [diff] [blame] | 224 | "pw_proto_library requires .proto source files") |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 225 | |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 226 | # For each proto target, create a file which collects the base directories of |
| 227 | # all of its dependencies to list as include paths to protoc. |
| 228 | _include_metadata_target = "${target_name}_include_paths" |
| 229 | _include_metadata_file = "${target_gen_dir}/${target_name}_includes.txt" |
| 230 | generated_file(_include_metadata_target) { |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 231 | if (defined(invoker.deps)) { |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 232 | # Collect metadata from the include path files of each dependency. |
| 233 | deps = process_file_template(invoker.deps, "{{source}}_include_paths") |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 234 | } else { |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 235 | deps = [] |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 236 | } |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 237 | data_keys = [ "protoc_includes" ] |
| 238 | outputs = [ _include_metadata_file ] |
| 239 | |
| 240 | # Indicate this library's base directory for its dependents. |
| 241 | metadata = { |
| 242 | protoc_includes = [ rebase_path(".", root_out_dir) ] |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | foreach(_gen, pw_protobuf_generators) { |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 247 | _lang_target = "${target_name}_${_gen}" |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 248 | |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 249 | if (_gen == "pwpb") { |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 250 | _gen_deps = [] |
| 251 | if (defined(invoker.deps)) { |
| 252 | _gen_deps = process_file_template(invoker.deps, "{{source}}_${_gen}") |
| 253 | } |
| 254 | |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 255 | _pw_pwpb_proto_library(_lang_target) { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 256 | forward_variables_from(invoker, _forwarded_vars) |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 257 | protos = invoker.sources |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 258 | deps = [ ":$_include_metadata_target" ] |
| 259 | include_file = _include_metadata_file |
| 260 | gen_deps = _gen_deps |
Alexei Frolov | bbf164c | 2019-12-16 12:51:59 -0800 | [diff] [blame] | 261 | |
| 262 | # List the pw_protobuf plugin's files as a dependency to recompile |
| 263 | # generated code if they are modified. |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 264 | protoc_deps = [ "$dir_pw_protobuf:codegen_protoc_plugin" ] |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 265 | } |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 266 | } else if (_gen == "nanopb") { |
| 267 | _pw_nanopb_proto_library(_lang_target) { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 268 | forward_variables_from(invoker, _forwarded_vars) |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 269 | protos = invoker.sources |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 270 | deps = [ ":$_include_metadata_target" ] |
| 271 | include_file = _include_metadata_file |
| 272 | gen_deps = _gen_deps |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 273 | } |
| 274 | } else if (_gen == "go") { |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 275 | _pw_go_proto_library(_lang_target) { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 276 | forward_variables_from(invoker, _forwarded_vars) |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 277 | protos = invoker.sources |
Alexei Frolov | e19ebb8 | 2020-05-14 17:21:20 -0700 | [diff] [blame] | 278 | deps = [ ":$_include_metadata_target" ] |
| 279 | include_file = _include_metadata_file |
| 280 | gen_deps = _gen_deps |
Alexei Frolov | def1471 | 2019-12-23 13:03:32 -0800 | [diff] [blame] | 281 | } |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 282 | } else { |
| 283 | assert(false, |
| 284 | string_join( |
| 285 | " ", |
| 286 | [ |
Wyatt Hepler | b4b73a6 | 2020-05-27 15:17:27 -0700 | [diff] [blame] | 287 | "pw_proto_library doesn't know how to generate code for", |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 288 | "generator '$_gen'. Please add support if you require it.", |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 289 | ])) |
| 290 | } |
| 291 | } |
| 292 | |
Wyatt Hepler | b4b73a6 | 2020-05-27 15:17:27 -0700 | [diff] [blame] | 293 | # All supported pw_protobuf generators. |
| 294 | _protobuf_generators = [ |
| 295 | "pwpb", |
| 296 | "nanopb", |
| 297 | "go", |
| 298 | ] |
| 299 | |
| 300 | # Create stub versions of the proto library for other protobuf generators. |
| 301 | foreach(_gen, _protobuf_generators - pw_protobuf_generators) { |
| 302 | pw_python_script("${target_name}_${_gen}") { |
Wyatt Hepler | e0c4fdc | 2020-05-29 17:26:19 -0700 | [diff] [blame^] | 303 | forward_variables_from(invoker, _forwarded_vars) |
Wyatt Hepler | b4b73a6 | 2020-05-27 15:17:27 -0700 | [diff] [blame] | 304 | script = string_join("/", |
| 305 | [ |
| 306 | dir_pw_protobuf_compiler, |
| 307 | "py", |
| 308 | "pw_protobuf_compiler", |
| 309 | "generator_not_selected.py", |
| 310 | ]) |
| 311 | args = [ |
| 312 | "--library", |
| 313 | "${target_name}_${_gen}", |
| 314 | "--generator", |
| 315 | _gen, |
| 316 | ] |
| 317 | inputs = invoker.sources |
| 318 | stamp = true |
| 319 | } |
| 320 | } |
| 321 | |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 322 | # If the user attempts to use the target directly instead of one of the |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 323 | # generator targets, run a script which prints a nice error message. |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 324 | pw_python_script(target_name) { |
| 325 | script = string_join("/", |
| 326 | [ |
| 327 | dir_pw_protobuf_compiler, |
| 328 | "py", |
| 329 | "pw_protobuf_compiler", |
| 330 | "proto_target_invalid.py", |
| 331 | ]) |
| 332 | args = [ |
| 333 | "--target", |
| 334 | target_name, |
| 335 | "--dir", |
| 336 | get_path_info(".", "abspath"), |
| 337 | "--root", |
| 338 | "//", |
Alexei Frolov | f39cd8b | 2020-04-13 17:59:20 -0700 | [diff] [blame] | 339 | ] + pw_protobuf_generators |
Alexei Frolov | 942adf0 | 2019-12-11 17:07:28 -0800 | [diff] [blame] | 340 | stamp = true |
| 341 | } |
| 342 | } |