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. This is only to be included |
| 7 # for Java targets. When including this file, a .jar-file will be generated. |
| 8 # For other targets, see protoc.gypi. |
| 9 # |
| 10 # To use this, create a gyp target with the following form: |
| 11 # { |
| 12 # 'target_name': 'my_proto_lib', |
| 13 # 'sources': [ |
| 14 # 'foo.proto', |
| 15 # 'bar.proto', |
| 16 # ], |
| 17 # 'variables': { |
| 18 # 'proto_in_dir': '.' |
| 19 # }, |
| 20 # 'includes': ['path/to/this/gypi/file'], |
| 21 # } |
| 22 # |
| 23 # The 'proto_in_dir' variable must be the relative path to the |
| 24 # directory containing the .proto files. If left out, it defaults to '.'. |
| 25 # |
| 26 # The 'output_java_files' variable specifies a list of output files that will |
| 27 # be generated. It is based on the package and java_outer_classname fields in |
| 28 # the proto. All the values must be prefixed with >(java_out_dir), since that |
| 29 # is the root directory of all the output. |
| 30 # |
| 31 # Implementation notes: |
| 32 # A target_name of foo and proto-specified 'package' java.package.path produces: |
| 33 # <(PRODUCT_DIR)/java_proto/foo/{java/package/path/}{Foo,Bar}.java |
| 34 # where Foo and Bar are taken from 'java_outer_classname' of the protos. |
| 35 # |
| 36 # How the .jar-file is created is different than how protoc is used for other |
| 37 # targets, and as such, this lives in its own file. |
| 38 |
| 39 { |
| 40 'variables': { |
| 41 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', |
| 42 'java_out_dir': '<(PRODUCT_DIR)/java_proto/<(_target_name)/src', |
| 43 'proto_in_dir%': '.', |
| 44 'stamp_file': '<(java_out_dir).stamp', |
| 45 # Variables needed by java.gypi below. |
| 46 'package_name': '<(_target_name)', |
| 47 'java_in_dir': '<(DEPTH)/build/android/empty', |
| 48 'script': '<(DEPTH)/build/protoc_java.py', |
| 49 'generated_src_dirs': ['<(java_out_dir)'], |
| 50 }, |
| 51 'actions': [ |
| 52 { |
| 53 'action_name': 'genproto_java', |
| 54 'inputs': [ |
| 55 '<(script)', |
| 56 '<(protoc)', |
| 57 '<@(_sources)', |
| 58 ], |
| 59 # We do not know the names of the generated files, so we use a stamp. |
| 60 'outputs': [ |
| 61 '<(stamp_file)', |
| 62 ], |
| 63 'action': [ |
| 64 '<(script)', |
| 65 '<(protoc)', |
| 66 '<(proto_in_dir)', |
| 67 '<(java_out_dir)', |
| 68 '<(stamp_file)', |
| 69 '<@(_sources)', |
| 70 ], |
| 71 'message': 'Generating Java code from <(proto_in_dir)', |
| 72 }, |
| 73 ], |
| 74 'dependencies': [ |
| 75 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', |
| 76 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite_javalib', |
| 77 ], |
| 78 'includes': [ 'java.gypi' ], |
| 79 } |
OLD | NEW |