From 06b0b7b3e5504d062fc2226dd9a64dc4efa41f47 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 1 Nov 2020 17:45:42 -0600 Subject: Add warnings for util:RegistrySearch (value) and DisplayInternalUI. --- src/WixToolset.Converters/WixConverter.cs | 38 +++++++++- .../WixToolsetTest.Converters/ExtensionFixture.cs | 80 ---------------------- .../FirewallExtensionFixture.cs | 47 +++++++++++++ .../UtilExtensionFixture.cs | 35 ++++++++++ 4 files changed, 118 insertions(+), 82 deletions(-) delete mode 100644 src/test/WixToolsetTest.Converters/ExtensionFixture.cs create mode 100644 src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs (limited to 'src') diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index ac63f26b..c713045e 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs @@ -78,6 +78,7 @@ namespace WixToolset.Converters private static readonly XName VariableElementName = WixNamespace + "Variable"; private static readonly XName UtilCloseApplicationElementName = WixUtilNamespace + "CloseApplication"; private static readonly XName UtilPermissionExElementName = WixUtilNamespace + "PermissionEx"; + private static readonly XName UtilRegistrySearchName = WixUtilNamespace + "RegistrySearch"; private static readonly XName UtilXmlConfigElementName = WixUtilNamespace + "XmlConfig"; private static readonly XName CustomActionElementName = WixNamespace + "CustomAction"; private static readonly XName PropertyElementName = WixNamespace + "Property"; @@ -151,8 +152,8 @@ namespace WixToolset.Converters { WixConverter.ErrorElementName, this.ConvertErrorElement }, { WixConverter.ExePackageElementName, this.ConvertSuppressSignatureValidation }, { WixConverter.ModuleElementName, this.ConvertModuleElement }, - { WixConverter.MsiPackageElementName, this.ConvertSuppressSignatureValidation }, - { WixConverter.MspPackageElementName, this.ConvertSuppressSignatureValidation }, + { WixConverter.MsiPackageElementName, this.ConvertWindowsInstallerPackageElement }, + { WixConverter.MspPackageElementName, this.ConvertWindowsInstallerPackageElement }, { WixConverter.MsuPackageElementName, this.ConvertSuppressSignatureValidation }, { WixConverter.PayloadElementName, this.ConvertSuppressSignatureValidation }, { WixConverter.PermissionExElementName, this.ConvertPermissionExElement }, @@ -171,6 +172,7 @@ namespace WixToolset.Converters { WixConverter.VariableElementName, this.ConvertVariableElement }, { WixConverter.UtilCloseApplicationElementName, this.ConvertUtilCloseApplicationElementName }, { WixConverter.UtilPermissionExElementName, this.ConvertUtilPermissionExElement }, + { WixConverter.UtilRegistrySearchName, this.ConvertUtilRegistrySearchElement }, { WixConverter.UtilXmlConfigElementName, this.ConvertUtilXmlConfigElement }, { WixConverter.PropertyElementName, this.ConvertPropertyElement }, { WixConverter.WixElementWithoutNamespaceName, this.ConvertElementWithoutNamespace }, @@ -863,6 +865,16 @@ namespace WixToolset.Converters private void ConvertUITextElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); + private void ConvertWindowsInstallerPackageElement(XElement element) + { + this.ConvertSuppressSignatureValidation(element); + + if (null != element.Attribute("DisplayInternalUI")) + { + this.OnError(ConverterTestType.DisplayInternalUiNotConvertable, element, "The DisplayInternalUI functionality has fundamentally changed and requires BootstrapperApplication support."); + } + } + private void ConvertCustomActionElement(XElement xCustomAction) { var xBinaryKey = xCustomAction.Attribute("BinaryKey"); @@ -986,6 +998,18 @@ namespace WixToolset.Converters } } + private void ConvertUtilRegistrySearchElement(XElement element) + { + if (this.SourceVersion < 4) + { + var result = element.Attribute("Result")?.Value; + if (result == null || result == "value") + { + this.OnError(ConverterTestType.UtilRegistryValueSearchBehaviorChange, element, "Breaking change: util:RegistrySearch for a value no longer clears the variable when the key or value is missing."); + } + } + } + private void ConvertUtilXmlConfigElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); /// @@ -1422,6 +1446,16 @@ namespace WixToolset.Converters /// A MediaTemplate with no attributes set is now provided by default. /// DefaultMediaTemplate, + + /// + /// util:RegistrySearch has breaking change when value is missing. + /// + UtilRegistryValueSearchBehaviorChange, + + /// + /// DisplayInternalUI can't be converted. + /// + DisplayInternalUiNotConvertable, } } } diff --git a/src/test/WixToolsetTest.Converters/ExtensionFixture.cs b/src/test/WixToolsetTest.Converters/ExtensionFixture.cs deleted file mode 100644 index 4bf2ed3d..00000000 --- a/src/test/WixToolsetTest.Converters/ExtensionFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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. - -namespace WixToolsetTest.Converters -{ - using System; - using System.Xml.Linq; - using WixBuildTools.TestSupport; - using WixToolset.Converters; - using WixToolsetTest.Converters.Mocks; - using Xunit; - - public class ExtensionFixture : BaseConverterFixture - { - [Fact] - public void FixRemoteAddressValue() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " 127.0.0.1", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - - [Fact] - public void FixXmlConfigValue() - { - var parse = String.Join(Environment.NewLine, - "", - " ", - " ", - " a<>b", - " ", - " ", - ""); - - var expected = new[] - { - "", - " ", - " ", - " ", - "" - }; - - var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); - - var messaging = new MockMessaging(); - var converter = new WixConverter(messaging, 2, null, null); - - var errors = converter.ConvertDocument(document); - Assert.Equal(3, errors); - - var actualLines = UnformattedDocumentLines(document); - WixAssert.CompareLineByLine(expected, actualLines); - } - } -} diff --git a/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs new file mode 100644 index 00000000..f3437078 --- /dev/null +++ b/src/test/WixToolsetTest.Converters/FirewallExtensionFixture.cs @@ -0,0 +1,47 @@ +// 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. + +namespace WixToolsetTest.Converters +{ + using System; + using System.Xml.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Converters; + using WixToolsetTest.Converters.Mocks; + using Xunit; + + public class ExtensionFixture : BaseConverterFixture + { + [Fact] + public void FixRemoteAddressValue() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + " ", + " 127.0.0.1", + " ", + " ", + ""); + + var expected = new[] + { + "", + " ", + " ", + " ", + "" + }; + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + Assert.Equal(3, errors); + + var actualLines = UnformattedDocumentLines(document); + WixAssert.CompareLineByLine(expected, actualLines); + } + } +} diff --git a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs index 9d55af79..9964e3b0 100644 --- a/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs +++ b/src/test/WixToolsetTest.Converters/UtilExtensionFixture.cs @@ -76,5 +76,40 @@ namespace WixToolsetTest.Converters var actualLines = UnformattedDocumentLines(document); WixAssert.CompareLineByLine(expected, actualLines); } + + [Fact] + public void WarnsOnAllRegistryValueSearches() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + " ", + " ", + " ", + " ", + ""); + + var expected = new[] + { + "", + " ", + " ", + " ", + " ", + " ", + "" + }; + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + Assert.Equal(4, errors); + + var actualLines = UnformattedDocumentLines(document); + WixAssert.CompareLineByLine(expected, actualLines); + } } } -- cgit v1.2.3-55-g6feb