Example #1
0
 public static IPCBuildResult Read(Stream stream)
 {
     using (var reader = new BinaryReader(stream))
     {
         var buildResult = new IPCBuildResult
         {
             Skipped     = reader.ReadBoolean(),
             ServerError = reader.ReadString(),
             ExitCode    = reader.ReadInt32()
         };
         var messages = new Message[reader.ReadInt32()];
         for (int m = 0; m < messages.Length; ++m)
         {
             messages[m] = new Message
             {
                 Kind       = (MessageKind)reader.ReadInt32(),
                 Text       = reader.ReadString(),
                 SourceFile = reader.ReadString(),
                 Line       = reader.ReadInt32(),
                 Column     = reader.ReadInt32()
             }
         }
         ;
         buildResult.ErrorMessages = messages;
         return(buildResult);
     }
 }
Example #2
0
        public IPCBuildResult Build()
        {
            _pipe.Connect(_pipeConnectionTimeout);
            var result = IPCBuildResult.Read(_pipe);

            _pipe.Close();
            return(result);
        }
        private bool CheckBuildResult(IPCBuildResult result)
        {
            if (result.Skipped)
            {
                Log.LogMessage(MessageImportance.High, "Build skipped (executable is not set)");
                return(true);
            }
            if (!string.IsNullOrEmpty(result.ServerError))
            {
                Log.LogError(ServerErrorPrefix + result.ServerError);
                return(false);
            }

            foreach (var message in result.ErrorMessages)
            {
                switch (message.Kind)
                {
                case IPCBuildResult.MessageKind.Error:
                    Log.LogError(
                        subcategory: null, errorCode: null, helpKeyword: null,
                        message: message.Text, file: message.SourceFile,
                        lineNumber: message.Line, columnNumber: message.Column,
                        endLineNumber: 0, endColumnNumber: 0);
                    break;

                case IPCBuildResult.MessageKind.Warning:
                    Log.LogWarning(
                        subcategory: null, warningCode: null, helpKeyword: null,
                        message: message.Text, file: message.SourceFile,
                        lineNumber: message.Line, columnNumber: message.Column,
                        endLineNumber: 0, endColumnNumber: 0);
                    break;

                case IPCBuildResult.MessageKind.Note:
                    Log.LogWarning(
                        subcategory: null, warningCode: null, helpKeyword: null,
                        message: "note: " + message.Text, file: message.SourceFile,
                        lineNumber: message.Line, columnNumber: message.Column,
                        endLineNumber: 0, endColumnNumber: 0);
                    break;
                }
            }

            Log.LogMessage(MessageImportance.High, $"Build finished with exit code {result.ExitCode}");
            return(result.ExitCode == 0 && result.ErrorMessages.Length == 0);
        }
Example #4
0
 public IPCBridge(string project)
 {
     _pipe = new NamedPipeClientStream(".", IPCBuildResult.GetIPCPipeName(project), PipeDirection.In, PipeOptions.Asynchronous);
 }