Chromium Code Reviews| 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 | |
| 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', | |
| 12 # 'sources': [ | |
| 13 # 'foo.proto', | |
| 14 # 'bar.proto', | |
| 15 # ], | |
| 16 # 'variables': { | |
| 17 # 'proto_in_dir': '.' | |
| 18 # 'proto_out_dir': 'dir/for/my_proto_lib' | |
| 19 # 'output_java_files': [ | |
| 20 # 'org/chromium/package/Foo.java', | |
| 21 # 'org/chromium/package/Bar.java' | |
| 22 # ], | |
| 23 # }, | |
| 24 # 'includes': ['path/to/this/gypi/file'], | |
| 25 # } | |
| 26 # | |
| 27 # The 'proto_in_dir' variable must be the relative path to the | |
| 28 # directory containing the .proto files. If left out, it defaults to '.'. | |
| 29 # | |
| 30 # The 'proto_out_dir' variable specifies the path suffix that output | |
| 31 # files are generated under. | |
| 32 # | |
| 33 # The 'output_java_files' variable specifies a list of output files that will | |
|
cjhopman
2012/10/15 22:14:24
Maybe mention here how the output files should be
| |
| 34 # be generated. It is based on the package and java_outer_classname fields in | |
| 35 # the proto. | |
| 36 # | |
| 37 # Implementation notes: | |
| 38 # A 'proto_out_dir' of foo/bar and proto-specified 'package' java.package.path | |
| 39 # produces: | |
| 40 # <(PRODUCT_DIR)/javaproto/foo/bar/{java/package/path/}{Foo,Bar}.java | |
| 41 # where Foo and Bar are taken from 'java_outer_classname' of the protos. | |
| 42 | |
| 43 { | |
| 44 'variables': { | |
| 45 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', | |
| 46 'java_dir': '<(PRODUCT_DIR)/javaproto/<(proto_out_dir)', | |
| 47 'proto_in_dir%': '.', | |
| 48 }, | |
| 49 'actions': [ | |
| 50 { | |
| 51 'action_name': 'genproto_java_output_dirs', | |
| 52 'inputs' : [], | |
| 53 'outputs': [ | |
| 54 '<(java_dir)' | |
| 55 ], | |
| 56 'action': [ 'mkdir', '-p', '<(java_dir)' ], | |
| 57 }, | |
| 58 { | |
| 59 'action_name': 'genproto_java', | |
| 60 'inputs': [ | |
| 61 '<(protoc)', | |
| 62 '<@(_sources)', | |
| 63 ], | |
| 64 'outputs': [ | |
| 65 '<@(output_java_files)', | |
| 66 ], | |
| 67 'action': [ | |
| 68 '<(protoc)', | |
| 69 '--proto_path','<(proto_in_dir)', | |
| 70 '<@(_sources)', | |
| 71 '--java_out', '<(java_dir)', | |
| 72 ], | |
| 73 'message': 'Generating Java code from <(RULE_INPUT_PATH)', | |
|
cjhopman
2012/10/15 22:14:24
Update this message to use something other than RU
cjhopman
2012/10/15 22:15:10
Done.
| |
| 74 }, | |
| 75 ], | |
| 76 'dependencies': [ | |
| 77 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', | |
| 78 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', | |
| 79 ], | |
| 80 'include_dirs': [ | |
| 81 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', | |
| 82 '<(DEPTH)', | |
| 83 ], | |
| 84 'direct_dependent_settings': { | |
| 85 'variables': { | |
| 86 'generated_src_dirs': ['<(java_dir)'], | |
| 87 'additional_input_paths': ['<@(_sources)'], | |
| 88 }, | |
| 89 }, | |
| 90 } | |
| OLD | NEW |