From 2724cfee4c163f3297ee25edfd2372767cfd4945 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 19 Jul 2018 00:58:00 -0700 Subject: Move tool projects to Tools repo --- src/WixToolset.BuildTasks/WixCommandLineBuilder.cs | 177 --------------------- 1 file changed, 177 deletions(-) delete mode 100644 src/WixToolset.BuildTasks/WixCommandLineBuilder.cs (limited to 'src/WixToolset.BuildTasks/WixCommandLineBuilder.cs') diff --git a/src/WixToolset.BuildTasks/WixCommandLineBuilder.cs b/src/WixToolset.BuildTasks/WixCommandLineBuilder.cs deleted file mode 100644 index a979dbb0..00000000 --- a/src/WixToolset.BuildTasks/WixCommandLineBuilder.cs +++ /dev/null @@ -1,177 +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 WixToolset.BuildTasks -{ - using System; - using System.Collections.Generic; - using System.Globalization; - using System.IO; - - using Microsoft.Build.Framework; - using Microsoft.Build.Utilities; - - /// - /// Helper class for appending the command line arguments. - /// - public class WixCommandLineBuilder : CommandLineBuilder - { - internal const int Unspecified = -1; - - /// - /// Append a switch to the command line if the value has been specified. - /// - /// Switch to append. - /// Value specified by the user. - public void AppendIfSpecified(string switchName, int value) - { - if (value != Unspecified) - { - this.AppendSwitchIfNotNull(switchName, value.ToString(CultureInfo.InvariantCulture)); - } - } - - /// - /// Append a switch to the command line if the condition is true. - /// - /// Switch to append. - /// Condition specified by the user. - public void AppendIfTrue(string switchName, bool condition) - { - if (condition) - { - this.AppendSwitch(switchName); - } - } - - /// - /// Append a switch to the command line if any values in the array have been specified. - /// - /// Switch to append. - /// Values specified by the user. - public void AppendArrayIfNotNull(string switchName, IEnumerable values) - { - if (values != null) - { - foreach (ITaskItem value in values) - { - this.AppendSwitchIfNotNull(switchName, value); - } - } - } - - /// - /// Append a switch to the command line if any values in the array have been specified. - /// - /// Switch to append. - /// Values specified by the user. - public void AppendArrayIfNotNull(string switchName, IEnumerable values) - { - if (values != null) - { - foreach (string value in values) - { - this.AppendSwitchIfNotNull(switchName, value); - } - } - } - - /// - /// Build the extensions argument. Each extension is searched in the current folder, user defined search - /// directories (ReferencePath), HintPath, and under Wix Extension Directory in that order. - /// The order of precedence is based off of that described in Microsoft.Common.Targets's SearchPaths - /// property for the ResolveAssemblyReferences task. - /// - /// The list of extensions to include. - /// Evaluated default folder for Wix Extensions - /// User defined reference directories to search in - public void AppendExtensions(ITaskItem[] extensions, string wixExtensionDirectory, string [] referencePaths) - { - if (extensions == null) - { - return; - } - - foreach (ITaskItem extension in extensions) - { - string className = extension.GetMetadata("Class"); - - string fileName = Path.GetFileName(extension.ItemSpec); - - if (String.IsNullOrEmpty(Path.GetExtension(fileName))) - { - fileName += ".dll"; - } - - // First try reference paths - var resolvedPath = FileSearchHelperMethods.SearchFilePaths(referencePaths, fileName); - - if (String.IsNullOrEmpty(resolvedPath)) - { - // Now try HintPath - resolvedPath = extension.GetMetadata("HintPath"); - - if (!File.Exists(resolvedPath)) - { - // Now try the item itself - resolvedPath = extension.ItemSpec; - - if (String.IsNullOrEmpty(Path.GetExtension(resolvedPath))) - { - resolvedPath += ".dll"; - } - - if (!File.Exists(resolvedPath)) - { - if (!String.IsNullOrEmpty(wixExtensionDirectory)) - { - // Now try the extension directory - resolvedPath = Path.Combine(wixExtensionDirectory, Path.GetFileName(resolvedPath)); - } - - if (!File.Exists(resolvedPath)) - { - // Extension wasn't found, just set it to the extension name passed in - resolvedPath = extension.ItemSpec; - } - } - } - } - - if (String.IsNullOrEmpty(className)) - { - this.AppendSwitchIfNotNull("-ext ", resolvedPath); - } - else - { - this.AppendSwitchIfNotNull("-ext ", className + ", " + resolvedPath); - } - } - } - - /// - /// Append arbitrary text to the command-line if specified. - /// - /// Text to append. - public void AppendTextIfNotNull(string textToAppend) - { - if (!String.IsNullOrEmpty(textToAppend)) - { - this.AppendSpaceIfNotEmpty(); - this.AppendTextUnquoted(textToAppend); - } - } - - /// - /// Append arbitrary text to the command-line if specified. - /// - /// Text to append. - public void AppendTextIfNotWhitespace(string textToAppend) - { - if (!String.IsNullOrWhiteSpace(textToAppend)) - { - this.AppendSpaceIfNotEmpty(); - this.AppendTextUnquoted(textToAppend); - } - } - } -} -- cgit v1.2.3-55-g6feb