Skip to content

Commit

Permalink
Emit deprecation warning for Heat.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnson committed Jan 23, 2025
1 parent 7288b0b commit 727f334
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/ext/Bal/test/examples/Directory.wixproj.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Bundle</OutputType>
<TargetExt>.exe</TargetExt>
<HarvestDirectoryAdditionalOptions>-generate payloadgroup</HarvestDirectoryAdditionalOptions>
<HarvestDirectoryAdditionalOptions>-generate payloadgroup -sw5149</HarvestDirectoryAdditionalOptions>
<OutputPath>$(OutputPath)examples\</OutputPath>
<DefaultCompressionLevel>None</DefaultCompressionLevel>
<InstallerPlatform>x64</InstallerPlatform>
Expand Down
2 changes: 1 addition & 1 deletion src/test/burn/TestData/Manual/BundleB/BundleB.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>Bundle</OutputType>
<BA>hyperlinkLicense</BA>
<UpgradeCode>{5DE2F206-3C37-4265-81F7-095284E16B08}</UpgradeCode>
<HarvestDirectoryAdditionalOptions>-generate payloadgroup</HarvestDirectoryAdditionalOptions>
<HarvestDirectoryAdditionalOptions>-generate payloadgroup -sw5149</HarvestDirectoryAdditionalOptions>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion src/tools/heat/Data/HarvesterWarnings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -66,6 +70,7 @@ private static Message Message(SourceLineNumber sourceLineNumber, Ids id, Resour

public enum Ids
{
HeatIsDeprecated = 5149,
SelfRegHarvestFailed = 5150,
AssemblyHarvestFailed = 5151,
TypeLibLoadFailed = 5152,
Expand Down
1 change: 0 additions & 1 deletion src/tools/heat/HeatCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 4 additions & 0 deletions src/tools/heat/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -78,6 +79,9 @@ public Task<int> Run(IServiceProvider serviceProvider, IMessageListener listener

var commandLine = HeatCommandLineFactory.CreateCommandLine(serviceProvider, heatExtensions);
var command = commandLine.ParseStandardCommandLine(arguments);

messaging.Write(HarvesterWarnings.HeatIsDeprecated());

return command?.ExecuteAsync(CancellationToken.None) ?? Task.FromResult(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/test/WixToolsetTest.Heat/HeatRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static int Execute(string[] args, out List<Message> messages, bool warnin
/// <returns></returns>
public static WixRunnerResult Execute(params string[] args)
{
return Execute(true, args);
return Execute(warningsAsErrors: false, args);
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/tools/test/WixToolsetTest.HeatTasks/MsbuildHeatFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void CanBuildHeatFilePackage(BuildSystem buildSystem)
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);
Expand Down Expand Up @@ -103,7 +103,7 @@ public void CanBuildHeatFileWithMultipleFilesPackage(BuildSystem buildSystem)
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));
Expand Down Expand Up @@ -198,7 +198,7 @@ public void CanBuildHeatProjectPreSdkStyle(BuildSystem buildSystem, bool useTool
}

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));
Expand Down Expand Up @@ -319,7 +319,7 @@ public void CanBuildHeatProjectSdkStyle(BuildSystem buildSystem, bool useToolsVe
}

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));
Expand Down

0 comments on commit 727f334

Please sign in to comment.