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