Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Unified Diff: build/protoc_java.gypi

Issue 11146005: Add support for generating jars from protos and add cacheinvalidation_java. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use javalib target name consistently. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/protoc.gypi ('k') | build/protoc_java.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/protoc_java.gypi
diff --git a/build/protoc_java.gypi b/build/protoc_java.gypi
new file mode 100644
index 0000000000000000000000000000000000000000..1d2d697e9dc8d3fad97df60bcde1a93c5c207087
--- /dev/null
+++ b/build/protoc_java.gypi
@@ -0,0 +1,79 @@
+# 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. This is only to be included
+# for Java targets. When including this file, a .jar-file will be generated.
+# For other targets, see protoc.gypi.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'my_proto_lib',
+# 'sources': [
+# 'foo.proto',
+# 'bar.proto',
+# ],
+# 'variables': {
+# 'proto_in_dir': '.'
+# },
+# '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 '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
+# is the root directory of all the output.
+#
+# Implementation notes:
+# A target_name of foo and proto-specified 'package' java.package.path produces:
+# <(PRODUCT_DIR)/java_proto/foo/{java/package/path/}{Foo,Bar}.java
+# where Foo and Bar are taken from 'java_outer_classname' of the protos.
+#
+# How the .jar-file is created is different than how protoc is used for other
+# targets, and as such, this lives in its own file.
+
+{
+ 'variables': {
+ 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
+ 'java_out_dir': '<(PRODUCT_DIR)/java_proto/<(_target_name)/src',
+ 'proto_in_dir%': '.',
+ 'stamp_file': '<(java_out_dir).stamp',
+ # Variables needed by java.gypi below.
+ 'package_name': '<(_target_name)',
+ 'java_in_dir': '<(DEPTH)/build/android/empty',
+ 'script': '<(DEPTH)/build/protoc_java.py',
+ 'generated_src_dirs': ['<(java_out_dir)'],
+ },
+ 'actions': [
+ {
+ 'action_name': 'genproto_java',
+ 'inputs': [
+ '<(script)',
+ '<(protoc)',
+ '<@(_sources)',
+ ],
+ # We do not know the names of the generated files, so we use a stamp.
+ 'outputs': [
+ '<(stamp_file)',
+ ],
+ 'action': [
+ '<(script)',
+ '<(protoc)',
+ '<(proto_in_dir)',
+ '<(java_out_dir)',
+ '<(stamp_file)',
+ '<@(_sources)',
+ ],
+ 'message': 'Generating Java code from <(proto_in_dir)',
+ },
+ ],
+ 'dependencies': [
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
+ '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite_javalib',
+ ],
+ 'includes': [ 'java.gypi' ],
+}
« no previous file with comments | « build/protoc.gypi ('k') | build/protoc_java.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698