2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-12-24 02:05:12 +01:00

protoc: fix filename generation for .java

This commit is contained in:
fedepell 2019-01-17 14:45:40 +01:00
parent 68997828c8
commit f876a7b18c
3 changed files with 19 additions and 3 deletions

View File

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

View File

@ -57,7 +57,7 @@ def build(bld):
features = 'javac protoc',
name = 'pbjava',
srcdir = 'inc/',
source = ['inc/message_inc.proto', 'inc/message.proto'],
source = ['inc/message_inc.proto', 'inc/message.proto', 'inc/msgCaseTest.proto' ],
use = 'PROTOBUF',
protoc_includes = ['inc'])

View File

@ -210,10 +210,12 @@ def process_protoc(self, node):
if javacn:
nodename += javacn + '.java'
else:
filenamebase = node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].replace('_','')
filenamebase = filenamebase[:1].upper() + filenamebase[1:]
if self.env.PROTOC_MAJOR > '2' and node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title() in messages:
nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title().replace('_','') + 'OuterClass.java'
nodename += filenamebase + 'OuterClass.java'
else:
nodename += node.abspath()[node.abspath().rfind(os.sep)+1:node.abspath().rfind('.')].title().replace('_','') + '.java'
nodename += filenamebase + '.java'
java_node = node.parent.find_or_declare(nodename)
out_nodes.append(java_node)