Chromium Code Reviews| Index: build/protoc.gypi |
| diff --git a/build/protoc.gypi b/build/protoc.gypi |
| index fafdf9df7ab5c5e49a7825750f900de20d20ea7c..287a679aaa7a6cea1091303e1e1ea1333e852833 100644 |
| --- a/build/protoc.gypi |
| +++ b/build/protoc.gypi |
| @@ -52,6 +52,10 @@ |
| 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)', |
| 'py_dir': '<(PRODUCT_DIR)/pyproto/<(proto_out_dir)', |
| 'cc_generator_options%': '', |
| + 'generate_python%': 1, |
| + 'generate_cc%': 1, |
| + 'generator_plugin%': '', # generator_plugin_suffix is required if set. |
|
Primiano Tucci (use gerrit)
2016/06/21 14:15:09
you want to add a comment here explaining that thi
|
| + 'generator_plugin_options%': '', |
| 'cc_include%': '', |
| 'proto_in_dir%': '.', |
| 'conditions': [ |
| @@ -71,13 +75,12 @@ |
| '<(protoc)', |
| ], |
| 'outputs': [ |
|
Primiano Tucci (use gerrit)
2016/06/21 14:15:09
IIRC in gyp, conversely to gn, the list doesn't ne
|
| - '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py', |
| - '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc', |
| - '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', |
| + # To be populated. |
| ], |
| 'action': [ |
| 'python', |
| '<(protoc_wrapper)', |
| + # If no cc_include specified --protobuf option will be ignored. |
| '--include', |
| '<(cc_include)', |
| '--protobuf', |
| @@ -91,16 +94,47 @@ |
| '--use-system-protobuf=<(use_system_protobuf)', |
| '--', |
| '<(protoc)', |
| - '--cpp_out', '<(cc_generator_options)<(cc_dir)', |
| - '--python_out', '<(py_dir)', |
| ], |
| 'message': 'Generating C++ and Python code from <(RULE_INPUT_PATH)', |
| 'process_outputs_as_sources': 1, |
| + |
| + 'conditions': [ |
| + ['generate_python==1', { |
| + 'outputs+': [ |
|
Primiano Tucci (use gerrit)
2016/06/21 14:15:09
Looks like in gyp name+ means "prepend" which is N
|
| + '<(py_dir)/<(RULE_INPUT_ROOT)_pb2.py', |
| + ], |
| + 'action+': [ |
| + '--python_out', |
| + '<(py_dir)', |
| + ], |
| + }], |
| + ['generate_cc==1', { |
| + 'outputs+': [ |
| + '<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc', |
| + '<(cc_dir)/<(RULE_INPUT_ROOT).pb.h', |
| + ], |
| + 'action+': [ |
| + '--cpp_out', |
| + '<(cc_generator_options)<(cc_dir)', |
| + ], |
| + }], |
| + ['generator_plugin!=""', { |
| + 'outputs+': [ |
| + '<(cc_dir)/<(RULE_INPUT_ROOT)<(generator_plugin_suffix).cc', |
|
Primiano Tucci (use gerrit)
2016/06/21 14:15:09
I think you want this initialized in the variables
|
| + '<(cc_dir)/<(RULE_INPUT_ROOT)<(generator_plugin_suffix).h', |
| + ], |
| + 'action+': [ |
| + '--plugin', |
| + 'protoc-gen-plugin=<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)<(generator_plugin)<(EXECUTABLE_SUFFIX)', |
|
Primiano Tucci (use gerrit)
2016/06/21 14:15:09
I think here you should add a dependencies: <(gene
kraynov
2016/06/21 14:50:12
As discussed in offline chat, target name is not s
|
| + '--plugin_out', |
| + '<(generator_plugin_options)<(cc_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', |
| @@ -112,12 +146,19 @@ |
| '<(DEPTH)', |
| ] |
| }, |
| - 'export_dependent_settings': [ |
| - # The generated headers reference headers within protobuf_lite, |
| - # so dependencies must be able to find those headers too. |
| - '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
| + |
| + # If using built-in cc generator the resulting headers reference headers |
| + # within protobuf_lite, hence dependencies require those headers too. |
| + # In case of generator plugin such issues should be resolved by invoker. |
| + 'conditions': [ |
| + ['generate_cc==1', { |
| + 'hard_dependency': 1, |
| + 'dependencies+': [ |
| + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
| + ], |
| + 'export_dependent_settings': [ |
| + '<(DEPTH)/third_party/protobuf/protobuf.gyp:protobuf_lite', |
| + ], |
| + }], |
| ], |
| - # This target exports a hard dependency because it generates header |
| - # files. |
| - 'hard_dependency': 1, |
|
Primiano Tucci (use gerrit)
2016/06/21 14:15:09
why are you moving this and removing its comment?
|
| } |