mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-25 11:19:52 +01:00
protoc: fix included protoc search on nested wscripts
previously code was erroneously using tg.bld.path instead of tg.path so for nested wscript calls the wrong directory was used in search. added also better error handling with error message if an included directory does not exist
This commit is contained in:
parent
4fd4de389c
commit
ba1947b113
15
playground/protoc/increcurse/increc/message.proto
Normal file
15
playground/protoc/increcurse/increc/message.proto
Normal 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;
|
||||
}
|
14
playground/protoc/increcurse/increc/message_inc.proto
Normal file
14
playground/protoc/increcurse/increc/message_inc.proto
Normal 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;
|
||||
}
|
9
playground/protoc/increcurse/wscript
Normal file
9
playground/protoc/increcurse/wscript
Normal file
@ -0,0 +1,9 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
|
||||
def build(bld):
|
||||
bld(
|
||||
features = 'py',
|
||||
name = 'pbpyrec',
|
||||
source = ['increc/message.proto'],
|
||||
protoc_includes = ['increc'])
|
@ -53,3 +53,5 @@ def build(bld):
|
||||
source = ['inc/message_inc.proto', 'inc/message.proto'],
|
||||
use = 'PROTOBUF',
|
||||
protoc_includes = ['inc'])
|
||||
|
||||
bld.recurse('increcurse')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user