From fd6c129298e1302c4a96c4d4b56b83f2dcc1838c Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Tue, 22 Apr 2014 16:27:32 +0100 Subject: [PATCH] Munge protoc's error format into a VS-C#-compatible output format. Fixes issue 86. --- src/ProtoGen/ProgramPreprocess.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ProtoGen/ProgramPreprocess.cs b/src/ProtoGen/ProgramPreprocess.cs index 110bdff034..343e1f2a28 100644 --- a/src/ProtoGen/ProgramPreprocess.cs +++ b/src/ProtoGen/ProgramPreprocess.cs @@ -215,6 +215,11 @@ namespace Google.ProtocolBuffers.ProtoGen tmp = process.StandardError.ReadToEnd(); if (tmp.Trim().Length > 0) { + // Replace protoc output with something more amenable to Visual Studio. + var regexMsvs = new Regex(@"(.*)\((\d+)\).* column=(\d+)\s*:\s*(.*)"); + tmp = regexMsvs.Replace(tmp, "$1($2,$3): error CS9999: $4"); + var regexGcc = new Regex(@"(.*):(\d+):(\d+):\s*(.*)"); + tmp = regexGcc.Replace(tmp, "$1($2,$3): error CS9999: $4"); Console.Error.WriteLine(tmp); } return process.ExitCode;