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

Side by Side Diff: build/protoc_java.gypi

Issue 532303003: Add support for Java nano protocol buffers for Android (take 2). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to use chromium mirror Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # This file is meant to be included into a target to provide a rule 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 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. 7 # for Java targets. When including this file, a .jar-file will be generated.
8 # For other targets, see protoc.gypi. 8 # For other targets, see protoc.gypi.
9 # 9 #
10 # To use this, create a gyp target with the following form: 10 # To use this, create a gyp target with the following form:
11 # { 11 # {
12 # 'target_name': 'my_proto_lib', 12 # 'target_name': 'my_proto_lib',
13 # 'sources': [ 13 # 'sources': [
14 # 'foo.proto', 14 # 'foo.proto',
15 # 'bar.proto', 15 # 'bar.proto',
16 # ], 16 # ],
17 # 'variables': { 17 # 'variables': {
18 # 'proto_in_dir': '.' 18 # 'proto_in_dir': '.'
19 # }, 19 # },
20 # 'includes': ['path/to/this/gypi/file'], 20 # 'includes': ['path/to/this/gypi/file'],
21 # } 21 # }
22 # 22 #
23 # The 'proto_in_dir' variable must be the relative path to the 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 '.'. 24 # directory containing the .proto files. If left out, it defaults to '.'.
25 # 25 #
26 # You can optionally set a variable 'proto_runtime' to either 'lite' or 'nano'.
27 # The default runtime is 'lite'.
28 #
26 # The 'output_java_files' variable specifies a list of output files that will 29 # 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 30 # 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 31 # the proto. All the values must be prefixed with >(java_out_dir), since that
29 # is the root directory of all the output. 32 # is the root directory of all the output.
30 # 33 #
31 # Implementation notes: 34 # Implementation notes:
32 # A target_name of foo and proto-specified 'package' java.package.path produces: 35 # 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 36 # <(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. 37 # where Foo and Bar are taken from 'java_outer_classname' of the protos.
35 # 38 #
36 # How the .jar-file is created is different than how protoc is used for other 39 # 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. 40 # targets, and as such, this lives in its own file.
38 41
39 { 42 {
40 'variables': { 43 'variables': {
41 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', 44 'proto_runtime%': 'lite',
42 'java_out_dir': '<(PRODUCT_DIR)/java_proto/<(_target_name)/src', 45 'java_out_dir': '<(PRODUCT_DIR)/java_proto/<(_target_name)/src',
43 'proto_in_dir%': '.', 46 'proto_in_dir%': '.',
44 'stamp_file': '<(java_out_dir).stamp', 47 'stamp_file': '<(java_out_dir).stamp',
45 'script': '<(DEPTH)/build/protoc_java.py', 48 'script': '<(DEPTH)/build/protoc_java.py',
46 49
47 # The rest of the variables here are for the java.gypi include. 50 # The rest of the variables here are for the java.gypi include.
48 'java_in_dir': '<(DEPTH)/build/android/empty', 51 'java_in_dir': '<(DEPTH)/build/android/empty',
49 'generated_src_dirs': ['<(java_out_dir)'], 52 'generated_src_dirs': ['<(java_out_dir)'],
50 # Adding the |stamp_file| to |additional_input_paths| makes the actions in 53 # Adding the |stamp_file| to |additional_input_paths| makes the actions in
51 # the include of java.gypi depend on the genproto_java action. 54 # the include of java.gypi depend on the genproto_java action.
52 'additional_input_paths': ['<(stamp_file)'], 55 'additional_input_paths': ['<(stamp_file)'],
53 }, 56 },
54 'actions': [ 57 'actions': [
55 { 58 {
56 'action_name': 'genproto_java', 59 'action_name': 'genproto_java',
57 'inputs': [ 60 'inputs': [
58 '<(script)', 61 '<(script)',
59 '<(protoc)', 62 '<(protoc)',
60 '<@(_sources)', 63 '<@(_sources)',
61 ], 64 ],
62 # We do not know the names of the generated files, so we use a stamp. 65 # We do not know the names of the generated files, so we use a stamp.
63 'outputs': [ 66 'outputs': [
64 '<(stamp_file)', 67 '<(stamp_file)',
65 ], 68 ],
66 'action': [ 69 'action': [
67 '<(script)', 70 '<(script)',
68 '<(protoc)', 71 '<(protoc)',
69 '<(proto_in_dir)', 72 '<(proto_in_dir)',
70 '<(java_out_dir)', 73 '<(java_out_dir)',
74 '<(proto_runtime)',
71 '<(stamp_file)', 75 '<(stamp_file)',
72 '<@(_sources)', 76 '<@(_sources)',
73 ], 77 ],
74 'message': 'Generating Java code from <(proto_in_dir)', 78 'message': 'Generating <(proto_runtime) Java code from protobuf files in < (proto_in_dir)',
75 }, 79 },
76 ], 80 ],
77 'dependencies': [ 81 'conditions': [
78 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', 82 ['proto_runtime=="lite"', {
79 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite_javalib', 83 'variables': {
84 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX) ',
85 },
86 'dependencies': [
87 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
88 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite_javalib',
89 ],
90 }],
91 ['proto_runtime=="nano"', {
92 'variables': {
93 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)android_protoc<(EXECUTABLE _SUFFIX)',
94 },
95 'dependencies': [
96 '<(DEPTH)/third_party/android_protobuf/android_protobuf.gyp:android_prot oc#host',
97 '<(DEPTH)/third_party/android_protobuf/android_protobuf.gyp:protobuf_nan o_javalib',
98 ],
99 }],
80 ], 100 ],
81 'includes': [ 'java.gypi' ], 101 'includes': [ 'java.gypi' ],
82 } 102 }
OLDNEW
« no previous file with comments | « DEPS ('k') | build/protoc_java.py » ('j') | third_party/android_protobuf/README.chromium » ('J')

Powered by Google App Engine
This is Rietveld 408576698