From 63223d5c023846ab7b4cef222326c913d2e0521f Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 22 Jan 2025 22:45:45 -0500 Subject: Emit deprecation warning for Heat. Fixes https://github.com/wixtoolset/issues/issues/8913 --- src/ext/Bal/test/examples/Directory.wixproj.props | 2 +- src/test/burn/TestData/Manual/BundleB/BundleB.wixproj | 2 +- src/tools/heat/Data/HarvesterWarnings.cs | 7 ++++++- src/tools/heat/HeatCommand.cs | 1 - src/tools/heat/Program.cs | 4 ++++ src/tools/test/WixToolsetTest.Heat/HeatRunner.cs | 2 +- src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs | 8 ++++---- 7 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ext/Bal/test/examples/Directory.wixproj.props b/src/ext/Bal/test/examples/Directory.wixproj.props index 2226b690..3ce0ad09 100644 --- a/src/ext/Bal/test/examples/Directory.wixproj.props +++ b/src/ext/Bal/test/examples/Directory.wixproj.props @@ -4,7 +4,7 @@ Bundle .exe - -generate payloadgroup + -generate payloadgroup -sw5149 $(OutputPath)examples\ None x64 diff --git a/src/test/burn/TestData/Manual/BundleB/BundleB.wixproj b/src/test/burn/TestData/Manual/BundleB/BundleB.wixproj index b37138e0..36792c2b 100644 --- a/src/test/burn/TestData/Manual/BundleB/BundleB.wixproj +++ b/src/test/burn/TestData/Manual/BundleB/BundleB.wixproj @@ -4,7 +4,7 @@ Bundle hyperlinkLicense {5DE2F206-3C37-4265-81F7-095284E16B08} - -generate payloadgroup + -generate payloadgroup -sw5149 diff --git a/src/tools/heat/Data/HarvesterWarnings.cs b/src/tools/heat/Data/HarvesterWarnings.cs index 80ee5c31..1bbd5bed 100644 --- a/src/tools/heat/Data/HarvesterWarnings.cs +++ b/src/tools/heat/Data/HarvesterWarnings.cs @@ -2,13 +2,17 @@ namespace WixToolset.Harvesters.Data { - using System; using System.Resources; using WixToolset.Data; #pragma warning disable 1591 // TODO: add documentation public static class HarvesterWarnings { + public static Message HeatIsDeprecated() + { + return Message(null, Ids.HeatIsDeprecated, "Heat is deprecated and will be removed in WiX v7. Consider alternative solutions, like the Files element."); + } + public static Message AssemblyHarvestFailed(string file, string message) { return Message(null, Ids.AssemblyHarvestFailed, "Could not harvest data from a file that was expected to be an assembly: {0}. If this file is not an assembly you can ignore this warning. Otherwise, this error detail may be helpful to diagnose the failure: {1}", file, message); @@ -66,6 +70,7 @@ namespace WixToolset.Harvesters.Data public enum Ids { + HeatIsDeprecated = 5149, SelfRegHarvestFailed = 5150, AssemblyHarvestFailed = 5151, TypeLibLoadFailed = 5152, diff --git a/src/tools/heat/HeatCommand.cs b/src/tools/heat/HeatCommand.cs index 34198011..c8703ec1 100644 --- a/src/tools/heat/HeatCommand.cs +++ b/src/tools/heat/HeatCommand.cs @@ -15,7 +15,6 @@ namespace WixToolset.Harvesters using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; using WixToolset.Harvesters.Extensibility; - using Wix = WixToolset.Harvesters.Serialize; internal class HeatCommand : BaseCommandLineCommand { diff --git a/src/tools/heat/Program.cs b/src/tools/heat/Program.cs index f74def8f..80423e18 100644 --- a/src/tools/heat/Program.cs +++ b/src/tools/heat/Program.cs @@ -12,6 +12,7 @@ namespace WixToolset.Tools.Heat using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; using WixToolset.Harvesters; + using WixToolset.Harvesters.Data; using WixToolset.Harvesters.Extensibility; using WixToolset.Tools.Core; @@ -78,6 +79,9 @@ namespace WixToolset.Tools.Heat var commandLine = HeatCommandLineFactory.CreateCommandLine(serviceProvider, heatExtensions); var command = commandLine.ParseStandardCommandLine(arguments); + + messaging.Write(HarvesterWarnings.HeatIsDeprecated()); + return command?.ExecuteAsync(CancellationToken.None) ?? Task.FromResult(1); } } diff --git a/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs b/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs index e4004300..0f6c4f66 100644 --- a/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs +++ b/src/tools/test/WixToolsetTest.Heat/HeatRunner.cs @@ -37,7 +37,7 @@ namespace WixToolsetTest.Heat /// public static WixRunnerResult Execute(params string[] args) { - return Execute(true, args); + return Execute(warningsAsErrors: false, args); } /// diff --git a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs index a7d46962..f8bc3fda 100644 --- a/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs +++ b/src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs @@ -47,7 +47,7 @@ namespace WixToolsetTest.Sdk Assert.Single(heatCommandLines); var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); - WixAssert.StringCollectionEmpty(warnings); + Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); var generatedContents = File.ReadAllText(generatedFilePath); @@ -103,7 +103,7 @@ namespace WixToolsetTest.Sdk Assert.Equal(2, heatCommandLines.Count()); var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); - WixAssert.StringCollectionEmpty(warnings); + Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); Assert.True(File.Exists(generatedFilePath)); @@ -198,7 +198,7 @@ namespace WixToolsetTest.Sdk } var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); - WixAssert.StringCollectionEmpty(warnings); + Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_Tools Version 4Cs.wxs"); Assert.True(File.Exists(generatedFilePath)); @@ -319,7 +319,7 @@ namespace WixToolsetTest.Sdk } var warnings = result.Output.Where(line => line.Contains(": warning")).ToArray(); - WixAssert.StringCollectionEmpty(warnings); + Assert.All(warnings, warning => warning.Contains("warning HEAT5149")); var generatedFilePath = Path.Combine(intermediateFolder, "Release", "_SdkStyleCs.wxs"); Assert.True(File.Exists(generatedFilePath)); -- cgit v1.2.3-55-g6feb