OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 # This file is meant to be included into a target to provide a rule | |
Ryan Sleevi
2012/10/29 08:36:36
We generate Python and C++ files using the single
nyquist
2012/10/30 00:30:32
Done.
| |
6 # to invoke protoc in a consistent manner. | |
7 # | |
8 # To use this, create a gyp target with the following form: | |
9 # { | |
10 # 'target_name': 'my_proto_lib', | |
11 # 'type': 'static_library', | |
Ryan Sleevi
2012/10/29 08:36:36
This is not correct, is it? Can you generate a sta
nyquist
2012/10/30 00:30:32
Change to 'none'.
| |
12 # 'sources': [ | |
13 # 'foo.proto', | |
14 # 'bar.proto', | |
15 # ], | |
16 # 'variables': { | |
17 # 'proto_in_dir': '.' | |
18 # 'output_java_files': [ | |
19 # '>(java_out_dir)/org/chromium/package/Foo.java', | |
20 # '>(java_out_dir)/org/chromium/package/Bar.java' | |
Ryan Sleevi
2012/10/29 08:36:36
Is there ever a situation where you have .proto fi
nyquist
2012/10/30 00:30:32
Removed the shole notion of specifying the .java-f
| |
21 # ], | |
22 # }, | |
23 # 'includes': ['path/to/this/gypi/file'], | |
24 # } | |
25 # | |
26 # The 'proto_in_dir' variable must be the relative path to the | |
27 # directory containing the .proto files. If left out, it defaults to '.'. | |
28 # | |
29 # The 'output_java_files' variable specifies a list of output files that will | |
30 # be generated. It is based on the package and java_outer_classname fields in | |
31 # the proto. All the values must be prefixed with >(java_out_dir), since that | |
32 # is the root directory of all the output. | |
33 # | |
34 # Implementation notes: | |
35 # A target_name of foo and proto-specified 'package' java.package.path produces: | |
36 # <(PRODUCT_DIR)/javaproto/foo/{java/package/path/}{Foo,Bar}.java | |
37 # where Foo and Bar are taken from 'java_outer_classname' of the protos. | |
38 | |
39 { | |
40 'variables': { | |
41 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', | |
42 'java_out_dir': '<(PRODUCT_DIR)/javaproto/<(_target_name)/src', | |
43 'proto_in_dir%': '.', | |
44 }, | |
45 'actions': [ | |
46 { | |
47 'action_name': 'genproto_java_output_dirs', | |
48 'inputs' : [], | |
49 'outputs': [ | |
50 '<(java_out_dir)' | |
51 ], | |
52 'action': [ 'mkdir', '-p', '<(java_out_dir)' ], | |
Ryan Sleevi
2012/10/29 08:36:36
NACK on this. I strongly dislike embedding platfor
nyquist
2012/10/30 00:30:32
Changed to use .sh file. This is also used for tim
| |
53 }, | |
54 { | |
55 'action_name': 'genproto_java', | |
56 'inputs': [ | |
57 '<(protoc)', | |
58 '<@(_sources)', | |
59 ], | |
60 'outputs': [ | |
61 '<@(output_java_files)', | |
62 ], | |
63 'action': [ | |
64 '<(protoc)', | |
65 '--proto_path','<(proto_in_dir)', | |
66 '<@(_sources)', | |
67 '--java_out', '<(java_out_dir)', | |
68 ], | |
69 'message': 'Generating Java code from <(proto_in_dir)', | |
70 }, | |
71 ], | |
72 'dependencies': [ | |
73 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', | |
74 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', | |
75 ], | |
76 'include_dirs': [ | |
77 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', | |
Ryan Sleevi
2012/10/29 08:36:36
Why are either of these necessary at all? You're g
nyquist
2012/10/30 00:30:32
Done.
| |
78 '<(DEPTH)', | |
79 ], | |
80 'direct_dependent_settings': { | |
81 'variables': { | |
82 'generated_src_dirs': ['<(java_out_dir)'], | |
83 'additional_input_paths': ['<@(_sources)'], | |
84 }, | |
85 }, | |
86 } | |
OLD | NEW |