BuildEngine.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // BuildEngine.cs: Class that can be accessed by task.
  3. //
  4. // Author:
  5. // Marek Sieradzki ([email protected])
  6. //
  7. // (C) 2005 Marek Sieradzki
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining
  10. // a copy of this software and associated documentation files (the
  11. // "Software"), to deal in the Software without restriction, including
  12. // without limitation the rights to use, copy, modify, merge, publish,
  13. // distribute, sublicense, and/or sell copies of the Software, and to
  14. // permit persons to whom the Software is furnished to do so, subject to
  15. // the following conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  24. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  25. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. #if NET_2_0
  28. using System;
  29. using System.Collections;
  30. using Microsoft.Build.Framework;
  31. namespace Microsoft.Build.BuildEngine {
  32. internal class BuildEngine : IBuildEngine {
  33. Engine engine;
  34. int columnNumberOfTaskNode;
  35. bool continueOnError;
  36. int lineNumberOfTaskNode;
  37. string projectFileOfTaskNode;
  38. public BuildEngine (Engine engine, int column, int line,
  39. bool continueOnError, string projectFile)
  40. {
  41. this.engine = engine;
  42. this.columnNumberOfTaskNode = column;
  43. this.continueOnError = continueOnError;
  44. this.lineNumberOfTaskNode = line;
  45. this.projectFileOfTaskNode = projectFile;
  46. }
  47. // Initiates a build of a project file. If the build is
  48. // successful, the outputs (if any) of the specified targets
  49. // are returned.
  50. public bool BuildProjectFile (string projectFileName,
  51. string[] targetNames,
  52. IDictionary globalProperties,
  53. IDictionary targetOutputs)
  54. {
  55. BuildPropertyGroup bpg = new BuildPropertyGroup ();
  56. foreach (DictionaryEntry de in globalProperties)
  57. bpg.AddNewProperty ((string) de.Key, (string) de.Value);
  58. return engine.BuildProjectFile (projectFileName,
  59. targetNames, bpg, targetOutputs);
  60. }
  61. // Raises a custom event to all registered loggers.
  62. public void LogCustomEvent (CustomBuildEventArgs e)
  63. {
  64. engine.EventSource.FireCustomEventRaised (this, e);
  65. }
  66. // Raises an error to all registered loggers.
  67. public void LogErrorEvent (BuildErrorEventArgs e)
  68. {
  69. engine.EventSource.FireErrorRaised (this, e);
  70. }
  71. // Raises a message event to all registered loggers.
  72. public void LogMessageEvent (BuildMessageEventArgs e)
  73. {
  74. engine.EventSource.FireMessageRaised (this, e);
  75. }
  76. // Raises a warning to all registered loggers.
  77. public void LogWarningEvent (BuildWarningEventArgs e)
  78. {
  79. engine.EventSource.FireWarningRaised (this, e);
  80. }
  81. public int ColumnNumberOfTaskNode {
  82. get { return columnNumberOfTaskNode; }
  83. }
  84. public bool ContinueOnError {
  85. get { return continueOnError; }
  86. }
  87. public int LineNumberOfTaskNode {
  88. get { return lineNumberOfTaskNode; }
  89. }
  90. public string ProjectFileOfTaskNode {
  91. get { return projectFileOfTaskNode; }
  92. }
  93. }
  94. }
  95. #endif