Merge branch 'protoc-eh-1' into 'master'

protoc: fix included protoc search on nested wscripts

See merge request ita1024/waf!2202
This commit is contained in:
ita1024 2018-12-19 17:44:23 +00:00
commit fe873242bc
5 changed files with 47 additions and 2 deletions

View File

@ -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;
}

View File

@ -0,0 +1,14 @@
package udp.tc.tests;
option java_package = "com.udp.tc.tests";
option java_outer_classname = "MessageInc";
option cc_generic_services = false;
option java_generic_services = false;
option py_generic_services = false;
message IncludeMe {
required int32 test = 1;
optional uint32 blah = 2;
optional uint32 justinc = 3;
}

View File

@ -0,0 +1,9 @@
#! /usr/bin/env python
def build(bld):
bld(
features = 'py',
name = 'pbpyrec',
source = ['increc/message.proto'],
protoc_includes = ['increc'])

View File

@ -53,3 +53,5 @@ def build(bld):
source = ['inc/message_inc.proto', 'inc/message.proto'],
use = 'PROTOBUF',
protoc_includes = ['inc'])
bld.recurse('increcurse')

View File

@ -104,7 +104,7 @@ class protoc(Task):
if 'py' in self.generator.features or 'javac' in self.generator.features:
for incpath in getattr(self.generator, 'protoc_includes', []):
search_nodes.append(self.generator.bld.path.find_node(incpath))
search_nodes.append(self.generator.path.find_node(incpath))
def parse_node(node):
if node in seen:
@ -219,7 +219,12 @@ def process_protoc(self, node):
# For C++ standard include files dirs are used,
# but this doesn't apply to Python for example
for incpath in getattr(self, 'protoc_includes', []):
incdirs.append(self.path.find_node(incpath).bldpath())
incpath_node = self.path.find_node(incpath)
if incpath_node:
incdirs.append(incpath_node.bldpath())
else:
raise Errors.WafError('protoc: include path %r does not exist' % incpath)
tsk.env.PROTOC_INCPATHS = incdirs
# PR2115: protoc generates output of .proto files in nested