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 import("//third_party/protobuf/proto_library.gni") | 5 import("//third_party/protobuf/proto_library.gni") |
6 | 6 |
7 config("dependent_config") { | |
8 include_dirs = [ "//third_party/dom_distiller_js/dist/proto_gen" ] | |
9 } | |
10 | |
11 group("proto") { | 7 group("proto") { |
12 public_deps = [ | 8 public_deps = [ |
13 ":dom_distiller_proto", | 9 ":dom_distiller_proto", |
14 ] | 10 ] |
15 public_configs = [ ":dependent_config" ] | 11 deps = [ |
| 12 ":json_values_converter_tests", |
| 13 ] |
| 14 } |
| 15 |
| 16 protoc_plugin_files = [ |
| 17 "protoc_plugins/json_values_converter.bat", |
| 18 "protoc_plugins/util/__init__.py", |
| 19 "protoc_plugins/util/plugin.py", |
| 20 "protoc_plugins/util/plugin_protos.py", |
| 21 "protoc_plugins/util/types.py", |
| 22 "protoc_plugins/util/writer.py", |
| 23 ] |
| 24 |
| 25 if (is_win) { |
| 26 json_converter = "protoc_plugins/json_values_converter.bat" |
| 27 } else { |
| 28 json_converter = "protoc_plugins/json_values_converter.py" |
16 } | 29 } |
17 | 30 |
18 proto_library("dom_distiller_proto") { | 31 proto_library("dom_distiller_proto") { |
19 visibility = [ ":*" ] | 32 visibility = [ ":*" ] |
20 sources = [ | 33 sources = [ |
21 "dist/proto/dom_distiller.proto", | 34 "dist/proto/dom_distiller.proto", |
22 ] | 35 ] |
23 proto_out_dir = "third_party/dom_distiller_js" | 36 proto_out_dir = "third_party/dom_distiller_js" |
| 37 json_converter = json_converter |
| 38 |
| 39 # Depends on protoc_plugins properly |
| 40 inputs = protoc_plugin_files |
24 } | 41 } |
| 42 |
| 43 # The purpose of json_values_converter_test_proto is to test the |
| 44 # protoc_plugins by generating the json_converter.h file. |
| 45 proto_library("json_values_converter_test_proto") { |
| 46 visibility = [ ":*" ] |
| 47 sources = [ |
| 48 "test_sample.proto", |
| 49 ] |
| 50 proto_out_dir = "third_party/dom_distiller_js" |
| 51 json_converter = json_converter |
| 52 |
| 53 # Depends on protoc_plugins properly |
| 54 inputs = protoc_plugin_files |
| 55 } |
| 56 |
| 57 action("json_values_converter_tests") { |
| 58 _stamp = "$target_gen_dir/json_values_converter_tests.stamp" |
| 59 deps = [ |
| 60 ":json_values_converter_test_proto", |
| 61 ] |
| 62 inputs = [ |
| 63 "test_sample_json_converter.h.golden", |
| 64 ] |
| 65 outputs = [ |
| 66 _stamp, |
| 67 ] |
| 68 |
| 69 script = "protoc_plugins/json_values_converter_tests.py" |
| 70 args = [ |
| 71 "--stamp", |
| 72 rebase_path(_stamp, root_build_dir), |
| 73 rebase_path("$target_gen_dir/test_sample_json_converter.h", root_build_dir), |
| 74 rebase_path("test_sample_json_converter.h.golden", root_build_dir), |
| 75 ] |
| 76 } |
OLD | NEW |