Skip to content

Commit

Permalink
[3.2] C#: Re-work solution build output panel
Browse files Browse the repository at this point in the history
- Removed item list that displayed multiple build
  configurations launched. Now we only display
  the last build that was launched.
- Display build output next to the issues list.
  Its visibility can be toggled off/on.
  This build output is obtained from the MSBuild
  process rather than the MSBuild logger. As such
  it displays some MSBuild fatal errors that
  previously couldn't be displayed.
- Added a context menu to the issues list with
  the option to copy the issue text.
- Replaced the 'Build Project' button in the panel
  with a popup menu with the options:
  - Build Solution
  - Rebuild Solution
  - Clean Solution
- The bottom panel button was renamed from 'Mono'
  to '.NET' and now display an error/warning icon
  if the last build had issues.
  • Loading branch information
neikeq committed Oct 11, 2020
1 parent 738f6ea commit fdfba05
Show file tree
Hide file tree
Showing 11 changed files with 508 additions and 533 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public class GodotBuildLogger : ILogger
public void Initialize(IEventSource eventSource)
{
if (null == Parameters)
throw new LoggerException("Log directory was not set.");
throw new LoggerException("Log directory parameter not specified.");

var parameters = Parameters.Split(new[] {';'});

string logDir = parameters[0];

if (string.IsNullOrEmpty(logDir))
throw new LoggerException("Log directory was not set.");
throw new LoggerException("Log directory parameter is empty.");

if (parameters.Length > 1)
throw new LoggerException("Too many parameters passed.");
Expand Down Expand Up @@ -51,22 +51,31 @@ public void Initialize(IEventSource eventSource)
{
throw new LoggerException("Failed to create log file: " + ex.Message);
}
else
{
// Unexpected failure
throw;
}

// Unexpected failure
throw;
}

eventSource.ProjectStarted += eventSource_ProjectStarted;
eventSource.TaskStarted += eventSource_TaskStarted;
eventSource.ProjectFinished += eventSource_ProjectFinished;
eventSource.MessageRaised += eventSource_MessageRaised;
eventSource.WarningRaised += eventSource_WarningRaised;
eventSource.ErrorRaised += eventSource_ErrorRaised;
eventSource.ProjectFinished += eventSource_ProjectFinished;
}

void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
{
WriteLine(e.Message);
indent++;
}

private void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
{
indent--;
WriteLine(e.Message);
}

private void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
{
string line = $"{e.File}({e.LineNumber},{e.ColumnNumber}): error {e.Code}: {e.Message}";

Expand All @@ -81,7 +90,7 @@ void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
issuesStreamWriter.WriteLine(errorLine);
}

void eventSource_WarningRaised(object sender, BuildWarningEventArgs e)
private void eventSource_WarningRaised(object sender, BuildWarningEventArgs e)
{
string line = $"{e.File}({e.LineNumber},{e.ColumnNumber}): warning {e.Code}: {e.Message}";

Expand All @@ -108,40 +117,6 @@ private void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
}
}

private void eventSource_TaskStarted(object sender, TaskStartedEventArgs e)
{
// TaskStartedEventArgs adds ProjectFile, TaskFile, TaskName
// To keep this log clean, this logger will ignore these events.
}

private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e)
{
WriteLine(e.Message);
indent++;
}

private void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
{
indent--;
WriteLine(e.Message);
}

/// <summary>
/// Write a line to the log, adding the SenderName
/// </summary>
private void WriteLineWithSender(string line, BuildEventArgs e)
{
if (0 == string.Compare(e.SenderName, "MSBuild", StringComparison.OrdinalIgnoreCase))
{
// Well, if the sender name is MSBuild, let's leave it out for prettiness
WriteLine(line);
}
else
{
WriteLine(e.SenderName + ": " + line);
}
}

/// <summary>
/// Write a line to the log, adding the SenderName and Message
/// (these parameters are on all MSBuild event argument objects)
Expand Down
Loading

0 comments on commit fdfba05

Please sign in to comment.