From bb458769ee9564d7365d21bbb6940e74abe90a0f Mon Sep 17 00:00:00 2001 From: fedepell Date: Thu, 22 Mar 2018 09:26:30 +0100 Subject: [PATCH] protoc: add .proto dependencies also in include path otherwise protoc will fail if dependency is in another directory --- playground/protoc/incseparate/depinotherdir.proto | 15 +++++++++++++++ playground/protoc/wscript | 10 +++++++++- waflib/extras/protoc.py | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 playground/protoc/incseparate/depinotherdir.proto diff --git a/playground/protoc/incseparate/depinotherdir.proto b/playground/protoc/incseparate/depinotherdir.proto new file mode 100644 index 00000000..4dbfd1a2 --- /dev/null +++ b/playground/protoc/incseparate/depinotherdir.proto @@ -0,0 +1,15 @@ +package udp.tc.tests; + +import "message_inc.proto"; + +option java_package ="com.udp.tc.tests"; +option java_outer_classname= "MessageProtos"; +option cc_generic_services = false; +option java_generic_services = false; +option py_generic_services = false; + +message Message { + required int32 test = 1; + optional uint32 blah = 2; + required IncludeMe custom = 3; +} diff --git a/playground/protoc/wscript b/playground/protoc/wscript index 67eaa212..a21e4f95 100644 --- a/playground/protoc/wscript +++ b/playground/protoc/wscript @@ -16,8 +16,10 @@ def build(bld): bld( features = 'cxx cxxshlib', source = ['inc/message_inc.proto','inc/message.proto'], + name = 'somelib', target = 'somelib', - includes = ['inc']) + includes = ['inc'], + export_includes = ['inc']) bld( features = 'cxx cxxshlib', @@ -25,6 +27,12 @@ def build(bld): target = 'somedeeplib', includes = ['incdeep']) + bld( + features = 'cxx cxxshlib', + source = ['incseparate/depinotherdir.proto'], + target = 'crossdirlib', + includes = ['incseparate'], + use = ['somelib']) bld( features = 'py', diff --git a/waflib/extras/protoc.py b/waflib/extras/protoc.py index b3554586..f3cb4d86 100644 --- a/waflib/extras/protoc.py +++ b/waflib/extras/protoc.py @@ -124,6 +124,9 @@ class protoc(Task): names.append(dep) parse_node(node) + # Add also dependencies path to INCPATHS so protoc will find the included file + for deppath in nodes: + self.env.append_value('INCPATHS', deppath.parent.bldpath()) return (nodes, names) @extension('.proto')