@joebigelow / wix-1 / commits / 8a20ec98

Support warning suppression.

Bob Arnson committed Aug 28, 2018 at 17:14 UTC 8a20ec988b05b9fe6312bf3d39098a00c6b46ef1
4 files changed +35 -2
src/WixToolset.BuildTasks/DoIt.cs
+1
@@ -145,6 +145,7 @@ namespace WixToolset.BuildTasks
145 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths);
146 commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation);
147 commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces);
148 + commandLineBuilder.AppendArrayIfNotNull("-sw ", this.SuppressSpecificWarnings);
149 commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile);
150 commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
151 commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory);
src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
+29 -1
@@ -31,7 +31,7 @@ namespace WixToolsetTest.BuildTasks
31 var binFolder = Path.Combine(baseFolder, @"bin\");
32 var intermediateFolder = Path.Combine(baseFolder, @"obj\");
33
34 - var result = this.MsbuildRunner.Execute(projectPath, new[]
34 + var result = this.MsbuildRunner.Execute(projectPath, new[]
35 {
36 $"-p:WixTargetsPath={WixTargetsPath}",
37 $"-p:IntermediateOutputPath={intermediateFolder}",
@@ -39,6 +39,9 @@ namespace WixToolsetTest.BuildTasks
39 });
40 result.AssertSuccess();
41
42 + var warnings = result.Output.Where(line => line.Contains(": warning"));
43 + Assert.Equal(4, warnings.Count());
44 +
45 var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories)
46 .Select(s => s.Substring(baseFolder.Length + 1))
47 .OrderBy(s => s)
@@ -52,6 +55,31 @@ namespace WixToolsetTest.BuildTasks
55 }
56 }
57
58 + [Fact]
59 + public void CanBuildSimpleMsiPackageWithWarningSuppressions()
60 + {
61 + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj");
62 +
63 + using (var fs = new DisposableFileSystem())
64 + {
65 + var baseFolder = fs.GetFolder();
66 + var binFolder = Path.Combine(baseFolder, @"bin\");
67 + var intermediateFolder = Path.Combine(baseFolder, @"obj\");
68 +
69 + var result = this.MsbuildRunner.Execute(projectPath, new[]
70 + {
71 + $"-p:WixTargetsPath={WixTargetsPath}",
72 + $"-p:IntermediateOutputPath={intermediateFolder}",
73 + $"-p:OutputPath={binFolder}",
74 + "-p:SuppressSpecificWarnings=\"1118;1102\""
75 + });
76 + result.AssertSuccess();
77 +
78 + var warnings = result.Output.Where(line => line.Contains(": warning"));
79 + Assert.Empty(warnings);
80 + }
81 + }
82 +
83 [Fact]
84 public void CanBuildAndCleanSimpleMsiPackage()
85 {
src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs
+4
@@ -1,4 +1,8 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 +
3 +<?define Variable = "Value" ?>
4 +<?define Variable = "Value" ?>
5 +
6 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
7 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
8 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs
+1 -1
@@ -3,7 +3,7 @@
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 - <File Source="test.txt" />
6 + <File Source="test.txt" DefaultLanguage="1033" />
7 </Component>
8 </ComponentGroup>
9 </Fragment>