From 8a20ec988b05b9fe6312bf3d39098a00c6b46ef1 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 28 Aug 2018 17:14:27 -0400 Subject: Support warning suppression. --- src/WixToolset.BuildTasks/DoIt.cs | 1 + .../WixToolsetTest.BuildTasks/MsbuildFixture.cs | 30 +++++++++++++++++++++- .../SimpleMsiPackage/MsiPackage/Package.wxs | 4 +++ .../MsiPackage/PackageComponents.wxs | 2 +- 4 files changed, 35 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/WixToolset.BuildTasks/DoIt.cs b/src/WixToolset.BuildTasks/DoIt.cs index 01938ed6..0c8d261c 100644 --- a/src/WixToolset.BuildTasks/DoIt.cs +++ b/src/WixToolset.BuildTasks/DoIt.cs @@ -145,6 +145,7 @@ namespace WixToolset.BuildTasks commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths); commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces); + commandLineBuilder.AppendArrayIfNotNull("-sw ", this.SuppressSpecificWarnings); commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory); diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs index 95b727ad..119c3ba5 100644 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs +++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs @@ -31,7 +31,7 @@ namespace WixToolsetTest.BuildTasks var binFolder = Path.Combine(baseFolder, @"bin\"); var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - var result = this.MsbuildRunner.Execute(projectPath, new[] + var result = this.MsbuildRunner.Execute(projectPath, new[] { $"-p:WixTargetsPath={WixTargetsPath}", $"-p:IntermediateOutputPath={intermediateFolder}", @@ -39,6 +39,9 @@ namespace WixToolsetTest.BuildTasks }); result.AssertSuccess(); + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Equal(4, warnings.Count()); + var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) .Select(s => s.Substring(baseFolder.Length + 1)) .OrderBy(s => s) @@ -52,6 +55,31 @@ namespace WixToolsetTest.BuildTasks } } + [Fact] + public void CanBuildSimpleMsiPackageWithWarningSuppressions() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = this.MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + "-p:SuppressSpecificWarnings=\"1118;1102\"" + }); + result.AssertSuccess(); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Empty(warnings); + } + } + [Fact] public void CanBuildAndCleanSimpleMsiPackage() { diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs index d5a5a40d..a02b766a 100644 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs +++ b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs @@ -1,4 +1,8 @@ + + + + diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs index e26c4509..ddb95faf 100644 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs +++ b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs @@ -3,7 +3,7 @@ - + -- cgit v1.2.3-55-g6feb