diff options
author | Bob Arnson <bob@firegiant.com> | 2025-02-14 23:49:12 -0500 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2025-03-03 14:25:07 -0500 |
commit | ae96ff06cadd0141f48d88a7e9983ca81dace613 (patch) | |
tree | 692c21c53be97e30e60a515b215342b27a7087d0 /src | |
parent | ca6e44d496b0c589fdaabad69a00643f539c47cd (diff) | |
download | wix-ae96ff06cadd0141f48d88a7e9983ca81dace613.tar.gz wix-ae96ff06cadd0141f48d88a7e9983ca81dace613.tar.bz2 wix-ae96ff06cadd0141f48d88a7e9983ca81dace613.zip |
Convert tools\ to MSTest and traversal projects.
Diffstat (limited to 'src')
10 files changed, 113 insertions, 86 deletions
diff --git a/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs b/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs index 4776e6f1..8f3fecd9 100644 --- a/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs +++ b/src/internal/WixInternal.MSTestSupport/MsbuildUtilities.cs | |||
@@ -16,7 +16,7 @@ namespace WixInternal.MSTestSupport | |||
16 | 16 | ||
17 | public static class MsbuildUtilities | 17 | public static class MsbuildUtilities |
18 | { | 18 | { |
19 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", string verbosityLevel = "normal", bool suppressValidation = true) | 19 | public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", string verbosityLevel = "normal", bool suppressValidation = true, bool binlog = true) |
20 | { | 20 | { |
21 | var allArgs = new List<string> | 21 | var allArgs = new List<string> |
22 | { | 22 | { |
@@ -26,9 +26,13 @@ namespace WixInternal.MSTestSupport | |||
26 | // Node reuse means that child msbuild processes can stay around after the build completes. | 26 | // Node reuse means that child msbuild processes can stay around after the build completes. |
27 | // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. | 27 | // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. |
28 | "-nr:false", | 28 | "-nr:false", |
29 | MsbuildUtilities.GetQuotedSwitch(buildSystem, "bl", Path.ChangeExtension(projectPath, ".binlog")) | ||
30 | }; | 29 | }; |
31 | 30 | ||
31 | if (binlog) | ||
32 | { | ||
33 | MsbuildUtilities.GetQuotedSwitch(buildSystem, "bl", Path.ChangeExtension(projectPath, ".binlog")); | ||
34 | } | ||
35 | |||
32 | if (arguments != null) | 36 | if (arguments != null) |
33 | { | 37 | { |
34 | allArgs.AddRange(arguments); | 38 | allArgs.AddRange(arguments); |
diff --git a/src/internal/WixInternal.MSTestSupport/WixAssert.cs b/src/internal/WixInternal.MSTestSupport/WixAssert.cs index 927ebee6..b4c59fa5 100644 --- a/src/internal/WixInternal.MSTestSupport/WixAssert.cs +++ b/src/internal/WixInternal.MSTestSupport/WixAssert.cs | |||
@@ -77,15 +77,19 @@ namespace WixInternal.MSTestSupport | |||
77 | Assert.AreNotEqual(expected, actual, comparer); | 77 | Assert.AreNotEqual(expected, actual, comparer); |
78 | } | 78 | } |
79 | 79 | ||
80 | public static void Single<T>(IEnumerable<T> collection) | 80 | public static T Single<T>(IEnumerable<T> collection) |
81 | { | 81 | { |
82 | Assert.AreEqual(1, collection.Count()); | 82 | return collection.Single(); |
83 | } | 83 | } |
84 | 84 | ||
85 | public static void Single<T>(IEnumerable<T> collection, Func<T, bool> predicate) | 85 | public static T Single<T>(IEnumerable<T> collection, Func<T, bool> predicate) |
86 | { | 86 | { |
87 | var results = collection.Where(predicate); | 87 | return collection.Where(predicate).Single(); |
88 | Assert.AreEqual(1, results.Count()); | 88 | } |
89 | |||
90 | public static void All<T>(IEnumerable<T> collection, Func<T, bool> predicate) | ||
91 | { | ||
92 | Assert.IsTrue(collection.All(predicate)); | ||
89 | } | 93 | } |
90 | 94 | ||
91 | public static void Empty<T>(IEnumerable<T> collection) | 95 | public static void Empty<T>(IEnumerable<T> collection) |
diff --git a/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs b/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs index 9ca84936..db71c4cd 100644 --- a/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs +++ b/src/tools/test/WixToolsetTest.Heat/DirectoryToPayloadGroupFixture.cs | |||
@@ -5,12 +5,13 @@ namespace WixToolsetTest.Heat | |||
5 | using System; | 5 | using System; |
6 | using System.IO; | 6 | using System.IO; |
7 | using System.Linq; | 7 | using System.Linq; |
8 | using WixInternal.TestSupport; | 8 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
9 | using Xunit; | 9 | using WixInternal.MSTestSupport; |
10 | 10 | ||
11 | [TestClass] | ||
11 | public class DirectoryToPayloadGroupFixture | 12 | public class DirectoryToPayloadGroupFixture |
12 | { | 13 | { |
13 | [Fact] | 14 | [TestMethod] |
14 | public void CanHarvestSimpleDirectory() | 15 | public void CanHarvestSimpleDirectory() |
15 | { | 16 | { |
16 | var folder = TestData.Get("TestData", "SingleFile"); | 17 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -43,7 +44,7 @@ namespace WixToolsetTest.Heat | |||
43 | } | 44 | } |
44 | } | 45 | } |
45 | 46 | ||
46 | [Fact] | 47 | [TestMethod] |
47 | public void CanHarvestSimpleDirectoryWithSourceDirSubstitution() | 48 | public void CanHarvestSimpleDirectoryWithSourceDirSubstitution() |
48 | { | 49 | { |
49 | var folder = TestData.Get("TestData", "SingleFile"); | 50 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -77,7 +78,7 @@ namespace WixToolsetTest.Heat | |||
77 | } | 78 | } |
78 | } | 79 | } |
79 | 80 | ||
80 | [Fact] | 81 | [TestMethod] |
81 | public void CanHarvestNestedFiles() | 82 | public void CanHarvestNestedFiles() |
82 | { | 83 | { |
83 | var folder = TestData.Get("TestData", "NestedFiles"); | 84 | var folder = TestData.Get("TestData", "NestedFiles"); |
diff --git a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs index d517e209..c5f3df74 100644 --- a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs +++ b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs | |||
@@ -4,12 +4,13 @@ namespace WixToolsetTest.Heat | |||
4 | { | 4 | { |
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Linq; | 6 | using System.Linq; |
7 | using WixInternal.TestSupport; | 7 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
8 | using Xunit; | 8 | using WixInternal.MSTestSupport; |
9 | 9 | ||
10 | [TestClass] | ||
10 | public class HeatFixture | 11 | public class HeatFixture |
11 | { | 12 | { |
12 | [Fact] | 13 | [TestMethod] |
13 | public void CanHarvestSimpleDirectory() | 14 | public void CanHarvestSimpleDirectory() |
14 | { | 15 | { |
15 | var folder = TestData.Get("TestData", "SingleFile"); | 16 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -48,7 +49,7 @@ namespace WixToolsetTest.Heat | |||
48 | } | 49 | } |
49 | } | 50 | } |
50 | 51 | ||
51 | [Fact] | 52 | [TestMethod] |
52 | public void CanHarvestSimpleDirectoryToComponentGroup() | 53 | public void CanHarvestSimpleDirectoryToComponentGroup() |
53 | { | 54 | { |
54 | var folder = TestData.Get("TestData", "SingleFile"); | 55 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -88,7 +89,7 @@ namespace WixToolsetTest.Heat | |||
88 | } | 89 | } |
89 | } | 90 | } |
90 | 91 | ||
91 | [Fact] | 92 | [TestMethod] |
92 | public void CanHarvestSimpleDirectoryToInstallFolder() | 93 | public void CanHarvestSimpleDirectoryToInstallFolder() |
93 | { | 94 | { |
94 | var folder = TestData.Get("TestData", "SingleFile"); | 95 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -129,7 +130,7 @@ namespace WixToolsetTest.Heat | |||
129 | } | 130 | } |
130 | } | 131 | } |
131 | 132 | ||
132 | [Fact] | 133 | [TestMethod] |
133 | public void CanHarvestFile() | 134 | public void CanHarvestFile() |
134 | { | 135 | { |
135 | var folder = TestData.Get("TestData", "SingleFile"); | 136 | var folder = TestData.Get("TestData", "SingleFile"); |
@@ -171,7 +172,7 @@ namespace WixToolsetTest.Heat | |||
171 | } | 172 | } |
172 | } | 173 | } |
173 | 174 | ||
174 | [Fact] | 175 | [TestMethod] |
175 | public void CanHarvestRegistry() | 176 | public void CanHarvestRegistry() |
176 | { | 177 | { |
177 | var folder = TestData.Get("TestData", "RegFile"); | 178 | var folder = TestData.Get("TestData", "RegFile"); |
@@ -195,7 +196,7 @@ namespace WixToolsetTest.Heat | |||
195 | } | 196 | } |
196 | } | 197 | } |
197 | 198 | ||
198 | [Fact] | 199 | [TestMethod] |
199 | public void CanHarvestRegistryIntoComponentGroup() | 200 | public void CanHarvestRegistryIntoComponentGroup() |
200 | { | 201 | { |
201 | var folder = TestData.Get("TestData", "RegFile"); | 202 | var folder = TestData.Get("TestData", "RegFile"); |
diff --git a/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs b/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs index 0f6c4f66..d8dec06f 100644 --- a/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs +++ b/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs | |||
@@ -5,7 +5,7 @@ namespace WixToolsetTest.Heat | |||
5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading.Tasks; | 6 | using System.Threading.Tasks; |
7 | using WixToolset.Core; | 7 | using WixToolset.Core; |
8 | using WixInternal.Core.TestPackage; | 8 | using WixInternal.Core.MSTestPackage; |
9 | using WixToolset.Data; | 9 | using WixToolset.Data; |
10 | using WixToolset.Extensibility.Services; | 10 | using WixToolset.Extensibility.Services; |
11 | using WixToolset.Tools.Heat; | 11 | using WixToolset.Tools.Heat; |
diff --git a/src/tools/test/WixToolsetTest.Heat/WixToolsetTest.Heat.csproj b/src/tools/test/WixToolsetTest.Heat/WixToolsetTest.Heat.csproj index fb86ecdf..660dca3b 100644 --- a/src/tools/test/WixToolsetTest.Heat/WixToolsetTest.Heat.csproj +++ b/src/tools/test/WixToolsetTest.Heat/WixToolsetTest.Heat.csproj | |||
@@ -1,11 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!-- 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 | <!-- 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. --> |
3 | 3 | ||
4 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="MSTest.Sdk"> |
5 | <PropertyGroup> | 5 | <PropertyGroup> |
6 | <TargetFramework>net472</TargetFramework> | 6 | <TargetFramework>net472</TargetFramework> |
7 | <DefaultItemExcludes>TestData\**;$(DefaultItemExcludes)</DefaultItemExcludes> | 7 | <DefaultItemExcludes>TestData\**;$(DefaultItemExcludes)</DefaultItemExcludes> |
8 | <IsWixTestProject>true</IsWixTestProject> | 8 | <IsWixMSTestProject>true</IsWixMSTestProject> |
9 | </PropertyGroup> | 9 | </PropertyGroup> |
10 | 10 | ||
11 | <ItemGroup> | 11 | <ItemGroup> |
@@ -17,6 +17,6 @@ | |||
17 | </ItemGroup> | 17 | </ItemGroup> |
18 | 18 | ||
19 | <ItemGroup> | 19 | <ItemGroup> |
20 | <PackageReference Include="WixInternal.Core.TestPackage" /> | 20 | <PackageReference Include="WixInternal.Core.MSTestPackage" /> |
21 | </ItemGroup> | 21 | </ItemGroup> |
22 | </Project> | 22 | </Project> |
diff --git a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs index f8bc3fda..61efad47 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs +++ b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs | |||
@@ -5,12 +5,13 @@ namespace WixToolsetTest.Sdk | |||
5 | using System; | 5 | using System; |
6 | using System.IO; | 6 | using System.IO; |
7 | using System.Linq; | 7 | using System.Linq; |
8 | using WixInternal.TestSupport; | 8 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
9 | using WixInternal.Core.TestPackage; | 9 | using WixInternal.MSTestSupport; |
10 | using WixInternal.Core.MSTestPackage; | ||
10 | using WixToolset.Data; | 11 | using WixToolset.Data; |
11 | using WixToolset.Data.Symbols; | 12 | using WixToolset.Data.Symbols; |
12 | using Xunit; | ||
13 | 13 | ||
14 | [TestClass] | ||
14 | public class MsbuildHeatFixture | 15 | public class MsbuildHeatFixture |
15 | { | 16 | { |
16 | public static readonly string HeatTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildHeatFixture).Assembly.CodeBase).LocalPath), "..", "..", "..", "publish", "WixToolset.Heat", "build", "WixToolset.Heat.targets"); | 17 | public static readonly string HeatTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(MsbuildHeatFixture).Assembly.CodeBase).LocalPath), "..", "..", "..", "publish", "WixToolset.Heat", "build", "WixToolset.Heat.targets"); |
@@ -20,10 +21,10 @@ namespace WixToolsetTest.Sdk | |||
20 | EnsureWixSdkCached(); | 21 | EnsureWixSdkCached(); |
21 | } | 22 | } |
22 | 23 | ||
23 | [Theory] | 24 | [TestMethod] |
24 | [InlineData(BuildSystem.DotNetCoreSdk)] | 25 | [DataRow(BuildSystem.DotNetCoreSdk)] |
25 | [InlineData(BuildSystem.MSBuild)] | 26 | [DataRow(BuildSystem.MSBuild)] |
26 | [InlineData(BuildSystem.MSBuild64)] | 27 | [DataRow(BuildSystem.MSBuild64)] |
27 | public void CanBuildHeatFilePackage(BuildSystem buildSystem) | 28 | public void CanBuildHeatFilePackage(BuildSystem buildSystem) |
28 | { | 29 | { |
29 | var sourceFolder = TestData.Get("TestData", "HeatFilePackage"); | 30 | var sourceFolder = TestData.Get("TestData", "HeatFilePackage"); |
@@ -44,10 +45,10 @@ namespace WixToolsetTest.Sdk | |||
44 | result.AssertSuccess(); | 45 | result.AssertSuccess(); |
45 | 46 | ||
46 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); | 47 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); |
47 | Assert.Single(heatCommandLines); | 48 | WixAssert.Single(heatCommandLines); |
48 | 49 | ||
49 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | 50 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); |
50 | Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); | 51 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); |
51 | 52 | ||
52 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); | 53 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); |
53 | var generatedContents = File.ReadAllText(generatedFilePath); | 54 | var generatedContents = File.ReadAllText(generatedFilePath); |
@@ -76,10 +77,10 @@ namespace WixToolsetTest.Sdk | |||
76 | } | 77 | } |
77 | } | 78 | } |
78 | 79 | ||
79 | [Theory] | 80 | [TestMethod] |
80 | [InlineData(BuildSystem.DotNetCoreSdk)] | 81 | [DataRow(BuildSystem.DotNetCoreSdk)] |
81 | [InlineData(BuildSystem.MSBuild)] | 82 | [DataRow(BuildSystem.MSBuild)] |
82 | [InlineData(BuildSystem.MSBuild64)] | 83 | [DataRow(BuildSystem.MSBuild64)] |
83 | public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem) | 84 | public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem) |
84 | { | 85 | { |
85 | var sourceFolder = TestData.Get(@"TestData", "HeatFileMultipleFilesSameFileName"); | 86 | var sourceFolder = TestData.Get(@"TestData", "HeatFileMultipleFilesSameFileName"); |
@@ -100,13 +101,13 @@ namespace WixToolsetTest.Sdk | |||
100 | result.AssertSuccess(); | 101 | result.AssertSuccess(); |
101 | 102 | ||
102 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); | 103 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "file", buildSystem); |
103 | Assert.Equal(2, heatCommandLines.Count()); | 104 | Assert.AreEqual(2, heatCommandLines.Count()); |
104 | 105 | ||
105 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | 106 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); |
106 | Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); | 107 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); |
107 | 108 | ||
108 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); | 109 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); |
109 | Assert.True(File.Exists(generatedFilePath)); | 110 | Assert.IsTrue(File.Exists(generatedFilePath)); |
110 | 111 | ||
111 | var generatedContents = File.ReadAllText(generatedFilePath); | 112 | var generatedContents = File.ReadAllText(generatedFilePath); |
112 | var testXml = generatedContents.GetTestXml(); | 113 | var testXml = generatedContents.GetTestXml(); |
@@ -126,7 +127,7 @@ namespace WixToolsetTest.Sdk | |||
126 | "</Wix>", testXml); | 127 | "</Wix>", testXml); |
127 | 128 | ||
128 | generatedFilePath = Path.Combine(intermediateFolder, "Release", "_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs"); | 129 | generatedFilePath = Path.Combine(intermediateFolder, "Release", "_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs"); |
129 | Assert.True(File.Exists(generatedFilePath)); | 130 | Assert.IsTrue(File.Exists(generatedFilePath)); |
130 | 131 | ||
131 | generatedContents = File.ReadAllText(generatedFilePath); | 132 | generatedContents = File.ReadAllText(generatedFilePath); |
132 | testXml = generatedContents.GetTestXml(); | 133 | testXml = generatedContents.GetTestXml(); |
@@ -146,7 +147,7 @@ namespace WixToolsetTest.Sdk | |||
146 | "</Wix>", testXml); | 147 | "</Wix>", testXml); |
147 | 148 | ||
148 | var pdbPath = Path.Combine(binFolder, "HeatFileMultipleFilesSameFileName.wixpdb"); | 149 | var pdbPath = Path.Combine(binFolder, "HeatFileMultipleFilesSameFileName.wixpdb"); |
149 | Assert.True(File.Exists(pdbPath)); | 150 | Assert.IsTrue(File.Exists(pdbPath)); |
150 | 151 | ||
151 | var intermediate = Intermediate.Load(pdbPath); | 152 | var intermediate = Intermediate.Load(pdbPath); |
152 | var section = intermediate.Sections.Single(); | 153 | var section = intermediate.Sections.Single(); |
@@ -157,13 +158,13 @@ namespace WixToolsetTest.Sdk | |||
157 | } | 158 | } |
158 | } | 159 | } |
159 | 160 | ||
160 | [Theory] | 161 | [TestMethod] |
161 | [InlineData(BuildSystem.DotNetCoreSdk, true)] | 162 | [DataRow(BuildSystem.DotNetCoreSdk, true)] |
162 | [InlineData(BuildSystem.DotNetCoreSdk, false)] | 163 | [DataRow(BuildSystem.DotNetCoreSdk, false)] |
163 | [InlineData(BuildSystem.MSBuild, true)] | 164 | [DataRow(BuildSystem.MSBuild, true)] |
164 | [InlineData(BuildSystem.MSBuild, false)] | 165 | [DataRow(BuildSystem.MSBuild, false)] |
165 | [InlineData(BuildSystem.MSBuild64, true)] | 166 | [DataRow(BuildSystem.MSBuild64, true)] |
166 | [InlineData(BuildSystem.MSBuild64, false)] | 167 | [DataRow(BuildSystem.MSBuild64, false)] |
167 | public void CanBuildHeatProjectPreSdkStyle(BuildSystem buildSystem, bool useToolsVersion) | 168 | public void CanBuildHeatProjectPreSdkStyle(BuildSystem buildSystem, bool useToolsVersion) |
168 | { | 169 | { |
169 | var sourceFolder = TestData.Get(@"TestData", "HeatProject"); | 170 | var sourceFolder = TestData.Get(@"TestData", "HeatProject"); |
@@ -186,22 +187,22 @@ namespace WixToolsetTest.Sdk | |||
186 | result.AssertSuccess(); | 187 | result.AssertSuccess(); |
187 | 188 | ||
188 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); | 189 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); |
189 | var heatCommandLine = Assert.Single(heatCommandLines); | 190 | var heatCommandLine = WixAssert.Single(heatCommandLines); |
190 | 191 | ||
191 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) | 192 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) |
192 | { | 193 | { |
193 | Assert.Contains("-usetoolsversion", heatCommandLine); | 194 | Assert.IsTrue(heatCommandLine.Contains("-usetoolsversion")); |
194 | } | 195 | } |
195 | else | 196 | else |
196 | { | 197 | { |
197 | Assert.DoesNotContain("-usetoolsversion", heatCommandLine); | 198 | Assert.IsFalse(heatCommandLine.Contains("-usetoolsversion")); |
198 | } | 199 | } |
199 | 200 | ||
200 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | 201 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); |
201 | Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); | 202 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); |
202 | 203 | ||
203 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_Tools Version 4Cs.wxs"); | 204 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_Tools Version 4Cs.wxs"); |
204 | Assert.True(File.Exists(generatedFilePath)); | 205 | Assert.IsTrue(File.Exists(generatedFilePath)); |
205 | 206 | ||
206 | var generatedContents = File.ReadAllText(generatedFilePath); | 207 | var generatedContents = File.ReadAllText(generatedFilePath); |
207 | var testXml = generatedContents.GetTestXml(); | 208 | var testXml = generatedContents.GetTestXml(); |
@@ -260,7 +261,7 @@ namespace WixToolsetTest.Sdk | |||
260 | "</Wix>", testXml); | 261 | "</Wix>", testXml); |
261 | 262 | ||
262 | var pdbPath = Path.Combine(binFolder, "Release", "HeatProjectPreSdkStyle.wixpdb"); | 263 | var pdbPath = Path.Combine(binFolder, "Release", "HeatProjectPreSdkStyle.wixpdb"); |
263 | Assert.True(File.Exists(pdbPath)); | 264 | Assert.IsTrue(File.Exists(pdbPath)); |
264 | 265 | ||
265 | var intermediate = Intermediate.Load(pdbPath); | 266 | var intermediate = Intermediate.Load(pdbPath); |
266 | var section = intermediate.Sections.Single(); | 267 | var section = intermediate.Sections.Single(); |
@@ -270,13 +271,13 @@ namespace WixToolsetTest.Sdk | |||
270 | } | 271 | } |
271 | } | 272 | } |
272 | 273 | ||
273 | [Theory] | 274 | [TestMethod] |
274 | [InlineData(BuildSystem.DotNetCoreSdk, true)] | 275 | [DataRow(BuildSystem.DotNetCoreSdk, true)] |
275 | [InlineData(BuildSystem.DotNetCoreSdk, false)] | 276 | [DataRow(BuildSystem.DotNetCoreSdk, false)] |
276 | [InlineData(BuildSystem.MSBuild, true)] | 277 | [DataRow(BuildSystem.MSBuild, true)] |
277 | [InlineData(BuildSystem.MSBuild, false)] | 278 | [DataRow(BuildSystem.MSBuild, false)] |
278 | [InlineData(BuildSystem.MSBuild64, true)] | 279 | [DataRow(BuildSystem.MSBuild64, true)] |
279 | [InlineData(BuildSystem.MSBuild64, false)] | 280 | [DataRow(BuildSystem.MSBuild64, false)] |
280 | public void CanBuildHeatProjectSdkStyle(BuildSystem buildSystem, bool useToolsVersion) | 281 | public void CanBuildHeatProjectSdkStyle(BuildSystem buildSystem, bool useToolsVersion) |
281 | { | 282 | { |
282 | var sourceFolder = TestData.Get(@"TestData\HeatProject"); | 283 | var sourceFolder = TestData.Get(@"TestData\HeatProject"); |
@@ -307,22 +308,22 @@ namespace WixToolsetTest.Sdk | |||
307 | result.AssertSuccess(); | 308 | result.AssertSuccess(); |
308 | 309 | ||
309 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); | 310 | var heatCommandLines = MsbuildUtilities.GetToolCommandLines(result, "heat", "project", buildSystem); |
310 | var heatCommandLine = Assert.Single(heatCommandLines); | 311 | var heatCommandLine = WixAssert.Single(heatCommandLines); |
311 | 312 | ||
312 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) | 313 | if (useToolsVersion && buildSystem != BuildSystem.DotNetCoreSdk) |
313 | { | 314 | { |
314 | Assert.Contains("-usetoolsversion", heatCommandLine); | 315 | Assert.IsTrue(heatCommandLine.Contains("-usetoolsversion")); |
315 | } | 316 | } |
316 | else | 317 | else |
317 | { | 318 | { |
318 | Assert.DoesNotContain("-usetoolsversion", heatCommandLine); | 319 | Assert.IsFalse(heatCommandLine.Contains("-usetoolsversion")); |
319 | } | 320 | } |
320 | 321 | ||
321 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); | 322 | var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); |
322 | Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); | 323 | WixAssert.All(warnings, warning => warning.Contains("warning HEAT5149")); |
323 | 324 | ||
324 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_SdkStyleCs.wxs"); | 325 | var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_SdkStyleCs.wxs"); |
325 | Assert.True(File.Exists(generatedFilePath)); | 326 | Assert.IsTrue(File.Exists(generatedFilePath)); |
326 | 327 | ||
327 | var generatedContents = File.ReadAllText(generatedFilePath); | 328 | var generatedContents = File.ReadAllText(generatedFilePath); |
328 | var testXml = generatedContents.GetTestXml(); | 329 | var testXml = generatedContents.GetTestXml(); |
@@ -379,7 +380,7 @@ namespace WixToolsetTest.Sdk | |||
379 | "</Wix>", testXml); | 380 | "</Wix>", testXml); |
380 | 381 | ||
381 | var pdbPath = Path.Combine(binFolder, "Release", "HeatProjectSdkStyle.wixpdb"); | 382 | var pdbPath = Path.Combine(binFolder, "Release", "HeatProjectSdkStyle.wixpdb"); |
382 | Assert.True(File.Exists(pdbPath)); | 383 | Assert.IsTrue(File.Exists(pdbPath)); |
383 | 384 | ||
384 | var intermediate = Intermediate.Load(pdbPath); | 385 | var intermediate = Intermediate.Load(pdbPath); |
385 | var section = intermediate.Sections.Single(); | 386 | var section = intermediate.Sections.Single(); |
diff --git a/src/tools/test/WixToolsetTest.HeatTasks/WixToolsetTest.HeatTasks.csproj b/src/tools/test/WixToolsetTest.HeatTasks/WixToolsetTest.HeatTasks.csproj index 1d808f53..13ec5ac3 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/WixToolsetTest.HeatTasks.csproj +++ b/src/tools/test/WixToolsetTest.HeatTasks/WixToolsetTest.HeatTasks.csproj | |||
@@ -1,11 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!-- 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 | <!-- 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. --> |
3 | 3 | ||
4 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="MSTest.Sdk"> |
5 | <PropertyGroup> | 5 | <PropertyGroup> |
6 | <TargetFramework>net472</TargetFramework> | 6 | <TargetFramework>net472</TargetFramework> |
7 | <DefaultItemExcludes>TestData\**;$(DefaultItemExcludes)</DefaultItemExcludes> | 7 | <DefaultItemExcludes>TestData\**;$(DefaultItemExcludes)</DefaultItemExcludes> |
8 | <IsWixTestProject>true</IsWixTestProject> | 8 | <IsWixMSTestProject>true</IsWixMSTestProject> |
9 | </PropertyGroup> | 9 | </PropertyGroup> |
10 | 10 | ||
11 | <ItemGroup> | 11 | <ItemGroup> |
@@ -14,7 +14,7 @@ | |||
14 | </ItemGroup> | 14 | </ItemGroup> |
15 | 15 | ||
16 | <ItemGroup> | 16 | <ItemGroup> |
17 | <PackageReference Include="WixInternal.TestSupport" /> | 17 | <PackageReference Include="WixInternal.MSTestSupport" /> |
18 | <PackageReference Include="WixInternal.Core.TestPackage" /> | 18 | <PackageReference Include="WixInternal.Core.MSTestPackage" /> |
19 | </ItemGroup> | 19 | </ItemGroup> |
20 | </Project> | 20 | </Project> |
diff --git a/src/tools/tools.cmd b/src/tools/tools.cmd index fe90cf07..132c0f10 100644 --- a/src/tools/tools.cmd +++ b/src/tools/tools.cmd | |||
@@ -19,20 +19,8 @@ | |||
19 | 19 | ||
20 | @echo Building tools %_C% | 20 | @echo Building tools %_C% |
21 | 21 | ||
22 | :: Build | 22 | :: Build, Publish, Test, Pack |
23 | msbuild -Restore tools.sln -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\tools_build.binlog || exit /b | 23 | msbuild -Restore tools_t.proj -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\tools.binlog || exit /b |
24 | |||
25 | :: Publish | ||
26 | msbuild publish_t.proj -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\tools_publish.binlog || exit /b | ||
27 | |||
28 | :: Test | ||
29 | dotnet test ^ | ||
30 | %_B%\test\WixToolsetTest.Heat\net472\WixToolsetTest.Heat.dll ^ | ||
31 | %_B%\test\WixToolsetTest.HeatTasks\net472\WixToolsetTest.HeatTasks.dll ^ | ||
32 | --nologo -l "trx;LogFileName=%_L%\TestResults\tools.trx" || exit /b | ||
33 | |||
34 | :: Pack | ||
35 | msbuild -t:Pack WixToolset.Heat -p:Configuration=%_C% -p:NoBuild=true -tl -nologo -m -warnaserror -bl:%_L%\tools_pack.binlog || exit /b | ||
36 | 24 | ||
37 | @goto :end | 25 | @goto :end |
38 | 26 | ||
diff --git a/src/tools/tools_t.proj b/src/tools/tools_t.proj new file mode 100644 index 00000000..60685ef1 --- /dev/null +++ b/src/tools/tools_t.proj | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.Build.Traversal"> | ||
5 | <ItemGroup> | ||
6 | <ProjectReference Include="publish_t.proj" BuildInParallel="false" /> | ||
7 | |||
8 | <ProjectReference Include="thmviewer\thmviewer.vcxproj" /> | ||
9 | <ProjectReference Include="WixToolset.Templates\WixToolset.Templates.csproj" /> | ||
10 | <ProjectReference Include="WixToolset.Heat\WixToolset.Heat.csproj" /> | ||
11 | |||
12 | <!-- <ProjectReference Include="heat\heat.csproj" /> | ||
13 | <ProjectReference Include="WixToolset.HeatTasks\WixToolset.HeatTasks.csproj" /> --> | ||
14 | |||
15 | <ProjectReference Include="test\WixToolsetTest.HeatTasks\WixToolsetTest.HeatTasks.csproj" /> | ||
16 | <ProjectReference Include="test\WixToolsetTest.Heat\WixToolsetTest.Heat.csproj" /> | ||
17 | |||
18 | <ProjectReference Include="WixToolset.Heat\WixToolset.Heat.csproj" Targets="Pack" /> | ||
19 | </ItemGroup> | ||
20 | |||
21 | <Target Name="WixClean" BeforeTargets="Restore" Condition="'$(SuppressWixClean)' != 'true'"> | ||
22 | <RemoveDir Directories="$(RootBuildFolder)tools" /> | ||
23 | <RemoveDir Directories="$(USERPROFILE)\.nuget\packages\wixtoolset.heat" Condition="'$(NUGET_PACKAGES)' == ''" /> | ||
24 | <RemoveDir Directories="$(NUGET_PACKAGES)\wixtoolset.heat" Condition="'$(NUGET_PACKAGES)' != ''" /> | ||
25 | |||
26 | <Delete Files="$(ArtifactsFolder)WixToolset.Heat.*.nupkg" /> | ||
27 | </Target> | ||
28 | </Project> | ||