Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Tools/HeuristicLab.Subversion/SvnForm/BuildLogger.cs @ 9661

Last change on this file since 9661 was 9234, checked in by ascheibe, 12 years ago

#2017 added tools that eyob worked on:

  • HL build center (HeuristicLab.Subversion)
  • a subwcrev replacement
  • 2 own HL apps for up- and downloading Hive jobs from HL files
File size: 3.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using Microsoft.Build.Execution;
7using Microsoft.Build.Framework;
8
9namespace SvnForm {
10  class BuildLogger:ILogger {
11    private IEventSource eventSource;
12    private SvnMain buildSolution;
13
14    public BuildLogger(SvnMain form) {
15      buildSolution = form;
16    }
17
18    #region ILogger Members
19    public void Initialize(Microsoft.Build.Framework.IEventSource eventSource) {
20      this.eventSource = eventSource;
21      //eventSource.MessageRaised += new Microsoft.Build.Framework.BuildMessageEventHandler(eventSource_MessageRaised);
22      //eventSource.ProjectStarted += new ProjectStartedEventHandler(eventSource_ProjectStarted);
23      //eventSource.WarningRaised += new BuildWarningEventHandler(eventSource_WarningRaised);
24      //eventSource.ProjectStarted +=new ProjectStartedEventHandler(eventSource_ProjectStarted);
25      //eventSource.ProjectFinished += new ProjectFinishedEventHandler(eventSource_ProjectFinished);
26      eventSource.ErrorRaised += new BuildErrorEventHandler(eventSource_ErrorRaised);
27      //eventSource.StatusEventRaised += new BuildStatusEventHandler();
28      //eventSource.TargetFinished += new TargetFinishedEventHandler(eventSource_TargetFinished);
29    }
30
31    void eventSource_MessageRaised(object sender, BuildMessageEventArgs e) {
32
33      buildSolution.AppendTextToBuildLog("MESSAGE: " + e.Message + Environment.NewLine);
34
35    }
36
37    void eventSource_TargetFinished(object sender, TargetFinishedEventArgs e) {
38
39      buildSolution.AppendTextToBuildLog("MESSAGE: " + e.Message + Environment.NewLine);
40    }
41
42    void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e) {
43      buildSolution.AppendTextToBuildLog("ERROR: " + e.Message + Environment.NewLine);
44    }
45    public string Parameters {
46      get {
47        throw new NotImplementedException();
48      }
49      set {
50        throw new NotImplementedException();
51      }
52    }
53
54    void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) {
55      // ProjectStartedEventArgs adds ProjectFile, TargetNames
56      // Just the regular message string is good enough here, so just display that.
57      buildSolution.AppendTextToBuildLog("WARNING: " + e.Message + Environment.NewLine);
58    }
59
60    void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) {
61      buildSolution.AppendTextToBuildLog("Project Started: " + e.ProjectFile + Environment.NewLine);
62    }
63
64    void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e) {
65      // The regular message string is good enough here too.
66      buildSolution.AppendTextToBuildLog("project Finished: " + e.ProjectFile + Environment.NewLine);
67    }
68
69    public void Shutdown() {
70      eventSource.MessageRaised -= new Microsoft.Build.Framework.BuildMessageEventHandler(eventSource_MessageRaised);
71    }
72    //public bool IsVerbosityAtLeast(LoggerVerbosity checkVerbosity);
73
74    public LoggerVerbosity Verbosity {
75      get {
76        throw new NotImplementedException();
77      }
78      set {
79        throw new NotImplementedException();
80      }
81    }
82
83    #endregion
84  }
85}
Note: See TracBrowser for help on using the repository browser.