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

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: Removed documentation about proto_out_dir Created 8 years, 2 months 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
Index: build/protoc_java.gypi
diff --git a/build/protoc_java.gypi b/build/protoc_java.gypi
new file mode 100644
index 0000000000000000000000000000000000000000..4cda2878df7f1cae27abe78a52143d194e23b251
--- /dev/null
+++ b/build/protoc_java.gypi
@@ -0,0 +1,86 @@
+# 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
Ryan Sleevi 2012/10/29 08:36:36 We generate Python and C++ files using the single
nyquist 2012/10/30 00:30:32 Done.
+# 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',
Ryan Sleevi 2012/10/29 08:36:36 This is not correct, is it? Can you generate a sta
nyquist 2012/10/30 00:30:32 Change to 'none'.
+# 'sources': [
+# 'foo.proto',
+# 'bar.proto',
+# ],
+# 'variables': {
+# 'proto_in_dir': '.'
+# 'output_java_files': [
+# '>(java_out_dir)/org/chromium/package/Foo.java',
+# '>(java_out_dir)/org/chromium/package/Bar.java'
Ryan Sleevi 2012/10/29 08:36:36 Is there ever a situation where you have .proto fi
nyquist 2012/10/30 00:30:32 Removed the shole notion of specifying the .java-f
+# ],
+# },
+# '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)/javaproto/foo/{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_out_dir': '<(PRODUCT_DIR)/javaproto/<(_target_name)/src',
+ 'proto_in_dir%': '.',
+ },
+ 'actions': [
+ {
+ 'action_name': 'genproto_java_output_dirs',
+ 'inputs' : [],
+ 'outputs': [
+ '<(java_out_dir)'
+ ],
+ 'action': [ 'mkdir', '-p', '<(java_out_dir)' ],
Ryan Sleevi 2012/10/29 08:36:36 NACK on this. I strongly dislike embedding platfor
nyquist 2012/10/30 00:30:32 Changed to use .sh file. This is also used for tim
+ },
+ {
+ 'action_name': 'genproto_java',
+ 'inputs': [
+ '<(protoc)',
+ '<@(_sources)',
+ ],
+ 'outputs': [
+ '<@(output_java_files)',
+ ],
+ 'action': [
+ '<(protoc)',
+ '--proto_path','<(proto_in_dir)',
+ '<@(_sources)',
+ '--java_out', '<(java_out_dir)',
+ ],
+ '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',
+ ],
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
Ryan Sleevi 2012/10/29 08:36:36 Why are either of these necessary at all? You're g
nyquist 2012/10/30 00:30:32 Done.
+ '<(DEPTH)',
+ ],
+ 'direct_dependent_settings': {
+ 'variables': {
+ 'generated_src_dirs': ['<(java_out_dir)'],
+ 'additional_input_paths': ['<@(_sources)'],
+ },
+ },
+}

Powered by Google App Engine
This is Rietveld 408576698