diff options
Diffstat (limited to 'src/WixToolset.Core/Preprocessor.cs')
| -rw-r--r-- | src/WixToolset.Core/Preprocessor.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/WixToolset.Core/Preprocessor.cs b/src/WixToolset.Core/Preprocessor.cs index 23d3f205..ac8cefe3 100644 --- a/src/WixToolset.Core/Preprocessor.cs +++ b/src/WixToolset.Core/Preprocessor.cs | |||
| @@ -6,15 +6,16 @@ namespace WixToolset.Core | |||
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Globalization; | 7 | using System.Globalization; |
| 8 | using System.IO; | 8 | using System.IO; |
| 9 | using System.Linq; | ||
| 9 | using System.Text; | 10 | using System.Text; |
| 10 | using System.Text.RegularExpressions; | 11 | using System.Text.RegularExpressions; |
| 11 | using System.Xml; | 12 | using System.Xml; |
| 12 | using System.Xml.Linq; | 13 | using System.Xml.Linq; |
| 14 | using WixToolset.Core.Preprocess; | ||
| 13 | using WixToolset.Data; | 15 | using WixToolset.Data; |
| 14 | using WixToolset.Extensibility; | 16 | using WixToolset.Extensibility; |
| 15 | using WixToolset.Core.Preprocess; | 17 | using WixToolset.Extensibility.Data; |
| 16 | using WixToolset.Extensibility.Services; | 18 | using WixToolset.Extensibility.Services; |
| 17 | using System.Linq; | ||
| 18 | 19 | ||
| 19 | /// <summary> | 20 | /// <summary> |
| 20 | /// Preprocessor object | 21 | /// Preprocessor object |
| @@ -39,6 +40,8 @@ namespace WixToolset.Core | |||
| 39 | public Preprocessor(IServiceProvider serviceProvider) | 40 | public Preprocessor(IServiceProvider serviceProvider) |
| 40 | { | 41 | { |
| 41 | this.ServiceProvider = serviceProvider; | 42 | this.ServiceProvider = serviceProvider; |
| 43 | |||
| 44 | this.Messaging = this.ServiceProvider.GetService<IMessaging>(); | ||
| 42 | } | 45 | } |
| 43 | 46 | ||
| 44 | public IEnumerable<string> IncludeSearchPaths { get; set; } | 47 | public IEnumerable<string> IncludeSearchPaths { get; set; } |
| @@ -51,6 +54,8 @@ namespace WixToolset.Core | |||
| 51 | 54 | ||
| 52 | private IServiceProvider ServiceProvider { get; } | 55 | private IServiceProvider ServiceProvider { get; } |
| 53 | 56 | ||
| 57 | private IMessaging Messaging { get; } | ||
| 58 | |||
| 54 | private IPreprocessContext Context { get; set; } | 59 | private IPreprocessContext Context { get; set; } |
| 55 | 60 | ||
| 56 | private Stack<string> CurrentFileStack { get; } = new Stack<string>(); | 61 | private Stack<string> CurrentFileStack { get; } = new Stack<string>(); |
| @@ -169,7 +174,7 @@ namespace WixToolset.Core | |||
| 169 | throw new WixException(ErrorMessages.InvalidXml(this.Context.CurrentSourceLineNumber, "source", e.Message)); | 174 | throw new WixException(ErrorMessages.InvalidXml(this.Context.CurrentSourceLineNumber, "source", e.Message)); |
| 170 | } | 175 | } |
| 171 | 176 | ||
| 172 | return this.Context.Messaging.EncounteredError ? null : output; | 177 | return this.Messaging.EncounteredError ? null : output; |
| 173 | } | 178 | } |
| 174 | 179 | ||
| 175 | /// <summary> | 180 | /// <summary> |
| @@ -482,7 +487,7 @@ namespace WixToolset.Core | |||
| 482 | { | 487 | { |
| 483 | if ("Include" != reader.LocalName) | 488 | if ("Include" != reader.LocalName) |
| 484 | { | 489 | { |
| 485 | this.Context.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, reader.Name, "include", "Include")); | 490 | this.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, reader.Name, "include", "Include")); |
| 486 | } | 491 | } |
| 487 | 492 | ||
| 488 | this.IncludeNextStack.Pop(); | 493 | this.IncludeNextStack.Pop(); |
| @@ -570,7 +575,7 @@ namespace WixToolset.Core | |||
| 570 | // Resolve other variables in the warning message. | 575 | // Resolve other variables in the warning message. |
| 571 | warningMessage = this.Helper.PreprocessString(this.Context, warningMessage); | 576 | warningMessage = this.Helper.PreprocessString(this.Context, warningMessage); |
| 572 | 577 | ||
| 573 | this.Context.Messaging.Write(WarningMessages.PreprocessorWarning(this.Context.CurrentSourceLineNumber, warningMessage)); | 578 | this.Messaging.Write(WarningMessages.PreprocessorWarning(this.Context.CurrentSourceLineNumber, warningMessage)); |
| 574 | } | 579 | } |
| 575 | 580 | ||
| 576 | /// <summary> | 581 | /// <summary> |
| @@ -1431,7 +1436,6 @@ namespace WixToolset.Core | |||
| 1431 | private IPreprocessContext CreateContext() | 1436 | private IPreprocessContext CreateContext() |
| 1432 | { | 1437 | { |
| 1433 | var context = this.ServiceProvider.GetService<IPreprocessContext>(); | 1438 | var context = this.ServiceProvider.GetService<IPreprocessContext>(); |
| 1434 | context.Messaging = this.ServiceProvider.GetService<IMessaging>(); | ||
| 1435 | context.Extensions = this.ServiceProvider.GetService<IExtensionManager>().Create<IPreprocessorExtension>(); | 1439 | context.Extensions = this.ServiceProvider.GetService<IExtensionManager>().Create<IPreprocessorExtension>(); |
| 1436 | context.CurrentSourceLineNumber = new SourceLineNumber(this.SourcePath); | 1440 | context.CurrentSourceLineNumber = new SourceLineNumber(this.SourcePath); |
| 1437 | context.Platform = this.Platform; | 1441 | context.Platform = this.Platform; |
| @@ -1456,7 +1460,7 @@ namespace WixToolset.Core | |||
| 1456 | } | 1460 | } |
| 1457 | else | 1461 | else |
| 1458 | { | 1462 | { |
| 1459 | this.Context.Messaging.Write(ErrorMessages.DuplicateExtensionPreprocessorType(extension.GetType().ToString(), prefix, collidingExtension.GetType().ToString())); | 1463 | this.Messaging.Write(ErrorMessages.DuplicateExtensionPreprocessorType(extension.GetType().ToString(), prefix, collidingExtension.GetType().ToString())); |
| 1460 | } | 1464 | } |
| 1461 | } | 1465 | } |
| 1462 | } | 1466 | } |
