diff options
author | nyquist <nyquist@chromium.org> | 2014-09-02 11:38:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-02 18:51:26 +0000 |
commit | a076bf3d5a204c2e2db473a687b34c17830866bc (patch) | |
tree | 94756db7550a8e2152f44dec190e5abacc4abba6 /build/protoc_java.gypi | |
parent | 311130968db3796b9dbd42329ddd7323ba427e3f (diff) | |
download | chromium_src-a076bf3d5a204c2e2db473a687b34c17830866bc.zip chromium_src-a076bf3d5a204c2e2db473a687b34c17830866bc.tar.gz chromium_src-a076bf3d5a204c2e2db473a687b34c17830866bc.tar.bz2 |
Add support for Java nano protocol buffers for Android.
This CL adds a new dependency on the protocol buffer compiler
from the android source tree, since this compiler supports
generating Java files using the nano runtime.
The initial version of this dependency is 2.2.0a, but checked
out as what the Android 4.4.4 Release 2.0.1 tag points to.
This CL adds a new protoc binary (for compiling protos) that supports
this, and also adds a Java library with the runtime.
To simplify use of this, it also updates build/protoc_java.gypi to
support generating nano protos by specifying an optional
proto_runtime argument. The argument defaults to 'lite' which does
the same thing as before this change, and setting it to 'nano'
generates the new style Java files.
The plan is to quickly deprecate the 'lite' runtime for Java, since
it is too big and uses too many methods.
BUG=377891
Review URL: https://codereview.chromium.org/511283003
Cr-Commit-Position: refs/heads/master@{#292965}
Diffstat (limited to 'build/protoc_java.gypi')
-rw-r--r-- | build/protoc_java.gypi | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/build/protoc_java.gypi b/build/protoc_java.gypi index a99ec6a..853760c 100644 --- a/build/protoc_java.gypi +++ b/build/protoc_java.gypi @@ -23,6 +23,9 @@ # The 'proto_in_dir' variable must be the relative path to the # directory containing the .proto files. If left out, it defaults to '.'. # +# You can optionally set a variable 'proto_runtime' to either 'lite' or 'nano'. +# The default runtime is 'lite'. +# # The 'output_java_files' variable specifies a list of output files that will # be generated. It is based on the package and java_outer_classname fields in # the proto. All the values must be prefixed with >(java_out_dir), since that @@ -38,7 +41,7 @@ { 'variables': { - 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', + 'proto_runtime%': 'lite', 'java_out_dir': '<(PRODUCT_DIR)/java_proto/<(_target_name)/src', 'proto_in_dir%': '.', 'stamp_file': '<(java_out_dir).stamp', @@ -68,15 +71,32 @@ '<(protoc)', '<(proto_in_dir)', '<(java_out_dir)', + '<(proto_runtime)', '<(stamp_file)', '<@(_sources)', ], - 'message': 'Generating Java code from <(proto_in_dir)', + 'message': 'Generating <(proto_runtime) Java code from protobuf files in <(proto_in_dir)', }, ], - 'dependencies': [ - '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', - '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite_javalib', + 'conditions': [ + ['proto_runtime=="lite"', { + 'variables': { + 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', + }, + 'dependencies': [ + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite_javalib', + ], + }], + ['proto_runtime=="nano"', { + 'variables': { + 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)android_protoc<(EXECUTABLE_SUFFIX)', + }, + 'dependencies': [ + '<(DEPTH)/third_party/android_protobuf/android_protobuf.gyp:android_protoc#host', + '<(DEPTH)/third_party/android_protobuf/android_protobuf.gyp:protobuf_nano_javalib', + ], + }], ], 'includes': [ 'java.gypi' ], } |