diff --git a/src/core-sdk-tasks/AddMetadataIsPE.cs b/src/core-sdk-tasks/AddMetadataIsPE.cs index aa003114d..b0e894741 100644 --- a/src/core-sdk-tasks/AddMetadataIsPE.cs +++ b/src/core-sdk-tasks/AddMetadataIsPE.cs @@ -26,16 +26,9 @@ namespace Microsoft.DotNet.Cli.Build { var resultItem = new TaskItem(item); item.CopyMetadataTo(resultItem); - - if (File.Exists(resultItem.GetMetadata("FullPath")) && - HasMetadata(resultItem.GetMetadata("FullPath"))) - { - resultItem.SetMetadata("IsPE", "True"); - } - else - { - resultItem.SetMetadata("IsPE", "False"); - } + + var isPe = File.Exists(resultItem.GetMetadata("FullPath")) && HasMetadata(resultItem.GetMetadata("FullPath")); + resultItem.SetMetadata("IsPE", isPe.ToString()); resultItemsList.Add(resultItem); } diff --git a/src/core-sdk-tasks/AzurePublisher.cs b/src/core-sdk-tasks/AzurePublisher.cs index 6bfb5efe4..bd25f079e 100644 --- a/src/core-sdk-tasks/AzurePublisher.cs +++ b/src/core-sdk-tasks/AzurePublisher.cs @@ -27,7 +27,6 @@ namespace Microsoft.DotNet.Cli.Build private const string s_dotnetBlobContainerName = "dotnet"; - private string _connectionString { get; set; } private string _containerName { get; set; } private CloudBlobContainer _blobContainer { get; set; } @@ -41,14 +40,7 @@ namespace Microsoft.DotNet.Cli.Build { var storageCredentials = new StorageCredentials(accountName, accountKey); var storageAccount = new CloudStorageAccount(storageCredentials, true); - return GetDotnetBlobContainer(storageAccount, containerName); - } - - private CloudBlobContainer GetDotnetBlobContainer(CloudStorageAccount storageAccount, string containerName) - { - CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); - - return blobClient.GetContainerReference(containerName); + return storageAccount.CreateCloudBlobClient().GetContainerReference(containerName); } public string UploadFile(string file, Product product, string version) @@ -105,11 +97,7 @@ namespace Microsoft.DotNet.Cli.Build } } - public IEnumerable ListBlobs(Product product, string version) - { - string virtualDirectory = $"{product}/{version}"; - return ListBlobs(virtualDirectory); - } + public IEnumerable ListBlobs(Product product, string version) => ListBlobs($"{product}/{version}"); public IEnumerable ListBlobs(string virtualDirectory) { @@ -120,10 +108,7 @@ namespace Microsoft.DotNet.Cli.Build return blobFiles.Results.Select(bf => bf.Uri.PathAndQuery.Replace($"/{_containerName}/", string.Empty)); } - public string AcquireLeaseOnBlob( - string blob, - TimeSpan? maxWaitDefault = null, - TimeSpan? delayDefault = null) + public string AcquireLeaseOnBlob(string blob, TimeSpan? maxWaitDefault = null, TimeSpan? delayDefault = null) { TimeSpan maxWait = maxWaitDefault ?? TimeSpan.FromSeconds(120); TimeSpan delay = delayDefault ?? TimeSpan.FromMilliseconds(500); @@ -194,13 +179,11 @@ namespace Microsoft.DotNet.Cli.Build try { DeleteBlob(path); - return true; } catch (Exception e) { Console.WriteLine($"Deleting blob {path} failed with \r\n{e.Message}"); - return false; } } diff --git a/src/core-sdk-tasks/BuildFPMToolPreReqs.cs b/src/core-sdk-tasks/BuildFPMToolPreReqs.cs index a918673c0..fd6329aea 100644 --- a/src/core-sdk-tasks/BuildFPMToolPreReqs.cs +++ b/src/core-sdk-tasks/BuildFPMToolPreReqs.cs @@ -114,32 +114,29 @@ namespace Microsoft.DotNet.Build.Tasks // --verbose : Set verbose output for FPM tool --Static // : Add all the folder mappings for package_root, docs, man pages --Static - var parameters = new List(); - parameters.Add("-s dir"); - parameters.Add("-t rpm"); - parameters.Add(string.Concat("-n ", configJson.Package_Name)); - parameters.Add(string.Concat("-v ", package_version)); - parameters.Add(string.Concat("-a ", configJson.Control.Architecture)); + var parameters = new List + { + "-s dir", + "-t rpm", + string.Concat("-n ", configJson.Package_Name), + string.Concat("-v ", package_version), + string.Concat("-a ", configJson.Control.Architecture) + }; // Build the list of dependencies as -d -d if (configJson.Rpm_Dependencies != null) { foreach (RpmDependency rpmdep in configJson.Rpm_Dependencies) { - string dependency = ""; if (rpmdep.Package_Name != "") { // If no version is specified then the dependency is just the package without >= check - if (rpmdep.Package_Version == "") - { - dependency = rpmdep.Package_Name; - } - else - { - dependency = string.Concat(rpmdep.Package_Name, " >= ", rpmdep.Package_Version); - } + string dependency = rpmdep.Package_Version != "" ? + string.Concat(rpmdep.Package_Name, " >= ", rpmdep.Package_Version) : + rpmdep.Package_Name; + + parameters.Add(string.Concat("-d ", EscapeArg(dependency))); } - if (dependency != "") parameters.Add(string.Concat("-d ", EscapeArg(dependency))); } } @@ -180,14 +177,11 @@ namespace Microsoft.DotNet.Build.Tasks // Map all the payload directories as they need to install on the system if (configJson.Install_Root != null) - parameters.Add(string.Concat(Path.Combine(InputDir, "package_root/="), - configJson.Install_Root)); // Package Files + parameters.Add(string.Concat(Path.Combine(InputDir, "package_root/="), configJson.Install_Root)); // Package Files if (configJson.Install_Man != null) - parameters.Add(string.Concat(Path.Combine(InputDir, "docs", "host/="), - configJson.Install_Man)); // Man Pages + parameters.Add(string.Concat(Path.Combine(InputDir, "docs", "host/="), configJson.Install_Man)); // Man Pages if (configJson.Install_Doc != null) - parameters.Add(string.Concat(Path.Combine(InputDir, "templates", "copyright="), - configJson.Install_Doc)); // CopyRight File + parameters.Add(string.Concat(Path.Combine(InputDir, "templates", "copyright="), configJson.Install_Doc)); // CopyRight File return string.Join(" ", parameters); } @@ -217,14 +211,12 @@ namespace Microsoft.DotNet.Build.Tasks { sb.Append('\\', 2 * backslashCount); } - // Escape any preceding backslashes and the quote else if (arg[i] == '"') { sb.Append('\\', (2 * backslashCount) + 1); sb.Append('"'); } - // Output any consumed backslashes and the character else { @@ -252,6 +244,7 @@ namespace Microsoft.DotNet.Build.Tasks { return true; } + return false; } } diff --git a/src/core-sdk-tasks/CalculateTemplateVersions.cs b/src/core-sdk-tasks/CalculateTemplateVersions.cs index d8f3e1b11..ade0d8dac 100644 --- a/src/core-sdk-tasks/CalculateTemplateVersions.cs +++ b/src/core-sdk-tasks/CalculateTemplateVersions.cs @@ -124,7 +124,7 @@ namespace Microsoft.DotNet.Cli.Build } } - public record BundledTemplate + public class BundledTemplate { public string InstallPath { get; set; } public string MajorMinorVersion { get; set; } diff --git a/src/core-sdk-tasks/Crossgen.cs b/src/core-sdk-tasks/Crossgen.cs index 83f86aecf..4c11dc74f 100644 --- a/src/core-sdk-tasks/Crossgen.cs +++ b/src/core-sdk-tasks/Crossgen.cs @@ -121,8 +121,6 @@ namespace Microsoft.DotNet.Build.Tasks private string GetCreateSymbols() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "--pdb" : "--perfmap"; - private string GetReadyToRun() => ReadyToRun ? "-readytorun" : null; - private string GetInPath() => $"\"{SourceAssembly}\""; private string GetOutPath() => $"-o \"{TempOutputPath}\""; @@ -141,8 +139,6 @@ namespace Microsoft.DotNet.Build.Tasks return platformAssemblyPaths; } - private string GetMissingDependenciesOk() => "-MissingDependenciesOK"; - protected override void LogToolCommand(string message) => base.LogToolCommand($"{GetWorkingDirectory()}> {message}"); } } diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs index 5623cb98c..73c34e641 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/TempFileSystem/FileNameUtilities.cs @@ -12,7 +12,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities /// internal static class FileNameUtilities { - private const string DirectorySeparatorStr = "\\"; internal const char DirectorySeparatorChar = '\\'; internal const char AltDirectorySeparatorChar = '/'; internal const char VolumeSeparatorChar = ':';