Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-protobuf into sivasankariit-master

# Conflicts:
#	src/protobuf/compiler/PbCompiler.java
  • Loading branch information
travismorton committed Feb 16, 2016
2 parents 52af39b + d4fa489 commit 7cb0a22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/protobuf/compiler/PbCompiler.java
Expand Up @@ -58,6 +58,7 @@ public class PbCompiler implements SourceGeneratingCompiler {
private static final String PROTOC_LINUX = "protoc";
private static final String PROTOC_MAC = "protoc";

private static final String DEFAULT_PROTO_SOURCE_ROOT = "src/main/proto";

private static final Matcher ERROR_IN_LINE_MATCHER = Pattern.compile("[^:]*:[0-9]*:[0-9]*:.*").matcher("");
private static final Matcher ERROR_IN_FILE_MATCHER = Pattern.compile("[^:]*:[^:]*").matcher("");
Expand Down Expand Up @@ -150,13 +151,22 @@ public void run(final Result<PsiDirectory> result) {
for (String addtionalProtoPath : getModuleAdditionalProtoPaths(item)) {
compilerCommand.append(" --proto_path=").append(addtionalProtoPath);
}
// Add the default proto source root for the module if the directory exists.
VirtualFile moduleFile = item.getModule().getModuleFile();
if (moduleFile != null) {
VirtualFile protoSourceRoot = moduleFile.getParent().findFileByRelativePath(DEFAULT_PROTO_SOURCE_ROOT);
if ((protoSourceRoot != null) && protoSourceRoot.isDirectory()) {
compilerCommand.append(" --proto_path=").append(protoSourceRoot.getPath());
}
}

if (item.getFacet().getConfiguration().isGenerateNanoProto()) {
compilerCommand.append(" --javanano_out=");
} else {
compilerCommand.append(" --java_out=");
}
compilerCommand.append(outputPath);
compilerCommand.append(" ").append(item.getPath());
compilerCommand.append(" ").append(item.getPath());
LOG.info("Invoking protoc: " + compilerCommand.toString());
proc = Runtime.getRuntime().exec(compilerCommand.toString());
processStreams(compileContext, proc.getInputStream(), proc.getErrorStream(), item);
Expand Down
2 changes: 1 addition & 1 deletion src/protobuf/settings/facet/ProtobufFacetEditor.java
Expand Up @@ -83,7 +83,7 @@ private String toSystemIndependentPaths(String paths) {
for (int i = 0; i < splitPaths.length; i++) {
splitPaths[i] = FileUtil.toSystemIndependentName(splitPaths[i]);
}
return StringUtil.join(splitPaths);
return StringUtil.join(splitPaths, ";");
}

@Override
Expand Down

0 comments on commit 7cb0a22

Please sign in to comment.