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

Side by Side Diff: build/protoc.gypi

Issue 9480022: Revert 123894 - Remove hand-rolled protobufs generation; enable rel paths in protoc.gypi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/cacheinvalidation/cacheinvalidation.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 an target to provide a rule 5 # This file is meant to be included into an target to provide a rule
6 # to invoke protoc in a consistent manner. 6 # to invoke protoc in a consistent manner.
7 # 7 #
8 # To use this, create a gyp target with the following form: 8 # To use this, create a gyp target with the following form:
9 # { 9 # {
10 # 'target_name': 'my_proto_lib', 10 # 'target_name': 'my_proto_lib',
11 # 'type': 'static_library', 11 # 'type': 'static_library',
(...skipping 13 matching lines...) Expand all
25 # 25 #
26 # The 'proto_in_dir' variable must be the relative path to the 26 # The 'proto_in_dir' variable must be the relative path to the
27 # directory containing the .proto files. If left out, it defaults to '.'. 27 # directory containing the .proto files. If left out, it defaults to '.'.
28 # 28 #
29 # The 'proto_out_dir' variable specifies the path suffix that output 29 # The 'proto_out_dir' variable specifies the path suffix that output
30 # files are generated under. Targets that gyp-depend on my_proto_lib 30 # files are generated under. Targets that gyp-depend on my_proto_lib
31 # will be able to include the resulting proto headers with an include 31 # will be able to include the resulting proto headers with an include
32 # like: 32 # like:
33 # #include "dir/for/my_proto_lib/foo.pb.h" 33 # #include "dir/for/my_proto_lib/foo.pb.h"
34 # 34 #
35 # The 'proto_relpath' variable specifies another way to provide the path
36 # suffix that files are generated under. 'proto_relpath' exists because there
37 # are some protos which import using qualified paths, rather than the more
38 # common relative import.
39 #
40 # By using 'proto_relpath', projects can continue to use qualified imports
41 # instead of enforcing an import style through this gypi. If provided,
42 # 'proto_relpath' must have a trailing slash.
43 #
44 # Implementation notes: 35 # Implementation notes:
45 # A 'proto_out_dir' of 'foo/bar', with no 'proto_relpath' provided, produces: 36 # A proto_out_dir of foo/bar produces
46 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
47 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
48 #
49 # By setting 'proto_relpath' to 'foo/bar', with a 'proto_out_dir' of '', the
50 # protos can use qualified imports instead of relative imports,
51 # e.g. #import "foo/bar/file2.proto"; instead of #import "file2.proto";
52 # A 'proto_out_dir' of '', with a 'proto_relpath' of 'foo/bar/' produces:
53 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h} 37 # <(SHARED_INTERMEDIATE_DIR)/protoc_out/foo/bar/{file1,file2}.pb.{cc,h}
54 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py 38 # <(SHARED_INTERMEDIATE_DIR)/pyproto/foo/bar/{file1,file2}_pb2.py
55 39
56 { 40 {
57 'variables': { 41 'variables': {
58 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)', 42 'protoc': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)protoc<(EXECUTABLE_SUFFIX)',
59 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)', 43 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)',
60 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)', 44 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)',
61 'proto_in_dir%': '.', 45 'proto_in_dir%': '.',
62 'proto_relpath%': '',
63 }, 46 },
64 'rules': [ 47 'rules': [
65 { 48 {
66 'rule_name': 'genproto', 49 'rule_name': 'genproto',
67 'extension': 'proto', 50 'extension': 'proto',
68 'inputs': [ 51 'inputs': [
69 '<(protoc)', 52 '<(protoc)',
70 ], 53 ],
71 'outputs': [ 54 'outputs': [
72 '<(py_dir)/<(proto_relpath)<(RULE_INPUT_ROOT)_pb2.py', 55 '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py',
73 '<(cc_dir)/<(proto_relpath)<(RULE_INPUT_ROOT).pb.cc', 56 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
74 '<(cc_dir)/<(proto_relpath)<(RULE_INPUT_ROOT).pb.h', 57 '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
75 ], 58 ],
76 'action': [ 59 'action': [
77 '<(protoc)', 60 '<(protoc)',
78 '--proto_path=<(proto_in_dir)', 61 '--proto_path=<(proto_in_dir)',
79 # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires 62 # Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires
80 # --proto_path is a strict prefix of the path given as an argument. 63 # --proto_path is a strict prefix of the path given as an argument.
81 '<(proto_in_dir)/<(proto_relpath)<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)', 64 '<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
82 '--cpp_out=<(cc_dir)', 65 '--cpp_out=<(cc_dir)',
83 '--python_out=<(py_dir)', 66 '--python_out=<(py_dir)',
84 ], 67 ],
85 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)', 68 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)',
86 'process_outputs_as_sources': 1, 69 'process_outputs_as_sources': 1,
87 }, 70 },
88 ], 71 ],
89 'dependencies': [ 72 'dependencies': [
90 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host', 73 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protoc#host',
91 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', 74 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
92 ], 75 ],
93 'include_dirs': [ 76 'include_dirs': [
94 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', 77 '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
95 ], 78 ],
96 'direct_dependent_settings': { 79 'direct_dependent_settings': {
97 'include_dirs': [ 80 'include_dirs': [
98 '<(SHARED_INTERMEDIATE_DIR)/protoc_out', 81 '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
99 ] 82 ]
100 }, 83 },
101 'export_dependent_settings': [ 84 'export_dependent_settings': [
102 # The generated headers reference headers within protobuf_lite, 85 # The generated headers reference headers within protobuf_lite,
103 # so dependencies must be able to find those headers too. 86 # so dependencies must be able to find those headers too.
104 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', 87 '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite',
105 ], 88 ],
106 # This target exports a hard dependency because it generates header 89 # This target exports a hard dependency because it generates header
107 # files. 90 # files.
108 'hard_dependency': 1, 91 'hard_dependency': 1,
109 } 92 }
OLDNEW
« no previous file with comments | « no previous file | third_party/cacheinvalidation/cacheinvalidation.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698