diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/wix/WixToolset.Core/HarvestFilesCommand.cs | 7 | ||||
| -rw-r--r-- | src/wix/WixToolset.Core/OptimizerVerboses.cs | 30 | ||||
| -rw-r--r-- | src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs | 29 |
3 files changed, 63 insertions, 3 deletions
diff --git a/src/wix/WixToolset.Core/HarvestFilesCommand.cs b/src/wix/WixToolset.Core/HarvestFilesCommand.cs index 9d2d0fe8..a8c716d0 100644 --- a/src/wix/WixToolset.Core/HarvestFilesCommand.cs +++ b/src/wix/WixToolset.Core/HarvestFilesCommand.cs | |||
| @@ -57,6 +57,11 @@ namespace WixToolset.Core | |||
| 57 | var included = this.GetWildcardFiles(harvestFile, inclusions); | 57 | var included = this.GetWildcardFiles(harvestFile, inclusions); |
| 58 | var excluded = this.GetWildcardFiles(harvestFile, exclusions); | 58 | var excluded = this.GetWildcardFiles(harvestFile, exclusions); |
| 59 | 59 | ||
| 60 | foreach (var excludedFile in excluded) | ||
| 61 | { | ||
| 62 | this.Messaging.Write(OptimizerVerboses.ExcludedFile(harvestFile.SourceLineNumbers, excludedFile.Path)); | ||
| 63 | } | ||
| 64 | |||
| 60 | resolvedFiles = included.Except(excluded, comparer).ToList(); | 65 | resolvedFiles = included.Except(excluded, comparer).ToList(); |
| 61 | 66 | ||
| 62 | if (!resolvedFiles.Any()) | 67 | if (!resolvedFiles.Any()) |
| @@ -90,6 +95,8 @@ namespace WixToolset.Core | |||
| 90 | 95 | ||
| 91 | var id = this.ParseHelper.CreateIdentifier("fls", directoryId, name); | 96 | var id = this.ParseHelper.CreateIdentifier("fls", directoryId, name); |
| 92 | 97 | ||
| 98 | this.Messaging.Write(OptimizerVerboses.HarvestedFile(harvestFile.SourceLineNumbers, file)); | ||
| 99 | |||
| 93 | section.AddSymbol(new FileSymbol(harvestFile.SourceLineNumbers, id) | 100 | section.AddSymbol(new FileSymbol(harvestFile.SourceLineNumbers, id) |
| 94 | { | 101 | { |
| 95 | ComponentRef = id.Id, | 102 | ComponentRef = id.Id, |
diff --git a/src/wix/WixToolset.Core/OptimizerVerboses.cs b/src/wix/WixToolset.Core/OptimizerVerboses.cs new file mode 100644 index 00000000..96f9d344 --- /dev/null +++ b/src/wix/WixToolset.Core/OptimizerVerboses.cs | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Core | ||
| 4 | { | ||
| 5 | using WixToolset.Data; | ||
| 6 | |||
| 7 | internal static class OptimizerVerboses | ||
| 8 | { | ||
| 9 | public static Message HarvestedFile(SourceLineNumber sourceLineNumbers, string harvestedFile) | ||
| 10 | { | ||
| 11 | return Message(sourceLineNumbers, Ids.HarvestedFile, "Harvested file: {0}", harvestedFile); | ||
| 12 | } | ||
| 13 | |||
| 14 | public static Message ExcludedFile(SourceLineNumber sourceLineNumbers, string excludedFile) | ||
| 15 | { | ||
| 16 | return Message(sourceLineNumbers, Ids.ExcludedFile, "File excluded from harvesting: {0}", excludedFile); | ||
| 17 | } | ||
| 18 | |||
| 19 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) | ||
| 20 | { | ||
| 21 | return new Message(sourceLineNumber, MessageLevel.Verbose, (int)id, format, args); | ||
| 22 | } | ||
| 23 | |||
| 24 | public enum Ids | ||
| 25 | { | ||
| 26 | HarvestedFile = 8700, | ||
| 27 | ExcludedFile = 8701, | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs index 821660ff..7da47f6b 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | ||
| 6 | using System.Data; | 7 | using System.Data; |
| 7 | using System.IO; | 8 | using System.IO; |
| 8 | using System.Linq; | 9 | using System.Linq; |
| @@ -291,6 +292,23 @@ namespace WixToolsetTest.CoreIntegration | |||
| 291 | Build("PackageFiveLiner.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected)); | 292 | Build("PackageFiveLiner.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected)); |
| 292 | } | 293 | } |
| 293 | 294 | ||
| 295 | [Fact] | ||
| 296 | public void CanGetVerboseHarvestingDetails() | ||
| 297 | { | ||
| 298 | Build("Feature.wxs", (_, result) => | ||
| 299 | { | ||
| 300 | var messages = result.Messages.Select(m => m.Id).Where(i => i >= 8700 && i < 8800); | ||
| 301 | Assert.Equal(new[] | ||
| 302 | { | ||
| 303 | 8701, | ||
| 304 | 8700, | ||
| 305 | 8701, | ||
| 306 | 8700, | ||
| 307 | 8700, | ||
| 308 | }, messages); | ||
| 309 | }, additionalCommandLineArguments: "-v"); | ||
| 310 | } | ||
| 311 | |||
| 294 | private static void AssertFileIdsAndTargetPaths(string msiPath, string[] expected) | 312 | private static void AssertFileIdsAndTargetPaths(string msiPath, string[] expected) |
| 295 | { | 313 | { |
| 296 | var pkg = new WixToolset.Dtf.WindowsInstaller.Package.InstallPackage(msiPath, | 314 | var pkg = new WixToolset.Dtf.WindowsInstaller.Package.InstallPackage(msiPath, |
| @@ -301,7 +319,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 301 | Assert.Equal(sortedExpected, actual); | 319 | Assert.Equal(sortedExpected, actual); |
| 302 | } | 320 | } |
| 303 | 321 | ||
| 304 | private static void Build(string file, Action<string, WixRunnerResult> tester, bool isPackage = true) | 322 | private static void Build(string file, Action<string, WixRunnerResult> tester, bool isPackage = true, params string[] additionalCommandLineArguments) |
| 305 | { | 323 | { |
| 306 | var folder = TestData.Get("TestData", "HarvestFiles"); | 324 | var folder = TestData.Get("TestData", "HarvestFiles"); |
| 307 | 325 | ||
| @@ -312,7 +330,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 312 | var binFolder = Path.Combine(baseFolder, "bin"); | 330 | var binFolder = Path.Combine(baseFolder, "bin"); |
| 313 | var msiPath = Path.Combine(binFolder, isPackage ? "test.msi" : "test.msm"); | 331 | var msiPath = Path.Combine(binFolder, isPackage ? "test.msi" : "test.msm"); |
| 314 | 332 | ||
| 315 | var arguments = new[] | 333 | var arguments = new List<string>() |
| 316 | { | 334 | { |
| 317 | "build", | 335 | "build", |
| 318 | Path.Combine(folder, file), | 336 | Path.Combine(folder, file), |
| @@ -323,7 +341,12 @@ namespace WixToolsetTest.CoreIntegration | |||
| 323 | "-o", msiPath, | 341 | "-o", msiPath, |
| 324 | }; | 342 | }; |
| 325 | 343 | ||
| 326 | var result = WixRunner.Execute(arguments); | 344 | if (additionalCommandLineArguments.Length > 0) |
| 345 | { | ||
| 346 | arguments.AddRange(additionalCommandLineArguments); | ||
| 347 | } | ||
| 348 | |||
| 349 | var result = WixRunner.Execute(arguments.ToArray()); | ||
| 327 | 350 | ||
| 328 | tester(msiPath, result); | 351 | tester(msiPath, result); |
| 329 | } | 352 | } |
