Chromium Code Reviews| Index: build/protoc_java.gypi |
| diff --git a/build/protoc_java.gypi b/build/protoc_java.gypi |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c7b18e63ee80c7aafe472d883289c48c8557f0c2 |
| --- /dev/null |
| +++ b/build/protoc_java.gypi |
| @@ -0,0 +1,90 @@ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# This file is meant to be included into a target to provide a rule |
| +# to invoke protoc in a consistent manner. |
| +# |
| +# To use this, create a gyp target with the following form: |
| +# { |
| +# 'target_name': 'my_proto_lib', |
| +# 'type': 'static_library', |
| +# 'sources': [ |
| +# 'foo.proto', |
| +# 'bar.proto', |
| +# ], |
| +# 'variables': { |
| +# 'proto_in_dir': '.' |
| +# 'proto_out_dir': 'dir/for/my_proto_lib' |
| +# 'output_java_files': [ |
| +# 'org/chromium/package/Foo.java', |
| +# 'org/chromium/package/Bar.java' |
| +# ], |
| +# }, |
| +# 'includes': ['path/to/this/gypi/file'], |
| +# } |
| +# |
| +# The 'proto_in_dir' variable must be the relative path to the |
| +# directory containing the .proto files. If left out, it defaults to '.'. |
| +# |
| +# The 'proto_out_dir' variable specifies the path suffix that output |
| +# files are generated under. |
| +# |
| +# 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
|
| +# be generated. It is based on the package and java_outer_classname fields in |
| +# the proto. |
| +# |
| +# Implementation notes: |
| +# A 'proto_out_dir' of foo/bar and proto-specified 'package' java.package.path |
| +# produces: |
| +# <(PRODUCT_DIR)/javaproto/foo/bar/{java/package/path/}{Foo,Bar}.java |
| +# where Foo and Bar are taken from 'java_outer_classname' of the protos. |
| + |
| +{ |
| + 'variables': { |
| + 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', |
| + 'java_dir': '<(PRODUCT_DIR)/javaproto/<(proto_out_dir)', |
| + 'proto_in_dir%': '.', |
| + }, |
| + 'actions': [ |
| + { |
| + 'action_name': 'genproto_java_output_dirs', |
| + 'inputs' : [], |
| + 'outputs': [ |
| + '<(java_dir)' |
| + ], |
| + 'action': [ 'mkdir', '-p', '<(java_dir)' ], |
| + }, |
| + { |
| + 'action_name': 'genproto_java', |
| + 'inputs': [ |
| + '<(protoc)', |
| + '<@(_sources)', |
| + ], |
| + 'outputs': [ |
| + '<@(output_java_files)', |
| + ], |
| + 'action': [ |
| + '<(protoc)', |
| + '--proto_path','<(proto_in_dir)', |
| + '<@(_sources)', |
| + '--java_out', '<(java_dir)', |
| + ], |
| + '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.
|
| + }, |
| + ], |
| + 'dependencies': [ |
| + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', |
| + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
| + ], |
| + 'include_dirs': [ |
| + '<(SHARED_INTERMEDIATE_DIR)/protoc_out', |
| + '<(DEPTH)', |
| + ], |
| + 'direct_dependent_settings': { |
| + 'variables': { |
| + 'generated_src_dirs': ['<(java_dir)'], |
| + 'additional_input_paths': ['<@(_sources)'], |
| + }, |
| + }, |
| +} |