From 8e239a482506d2c6edfde542dce4e64d1ff84b8b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 16 Mar 2017 21:34:10 -0500 Subject: [PATCH] Clean up dead code These are old usages of GetRuntimeIdentifier() that are no longer needed. --- src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs | 11 ---- .../DotnetRuntimeIdentifiers.cs | 34 ------------ .../RuntimeEnvironmentRidExtensions.cs | 54 ------------------- .../StreamForwarderTests.cs | 2 - 4 files changed, 101 deletions(-) delete mode 100644 src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs diff --git a/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs b/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs index d4212fb6a..3a5accdfb 100644 --- a/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs +++ b/src/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs @@ -25,16 +25,5 @@ namespace Microsoft.DotNet.Cli { get { return s_versionFileObject.Value; } } - - /// - /// Reads the version file and adds runtime specific information - /// - public static string ReadAndInterpretVersionFile() - { - var content = File.ReadAllText(DotnetFiles.VersionFile); - content += Environment.NewLine; - content += RuntimeEnvironment.GetRuntimeIdentifier(); - return content; - } } } diff --git a/src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs b/src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs deleted file mode 100644 index 747fa8901..000000000 --- a/src/Microsoft.DotNet.Cli.Utils/DotnetRuntimeIdentifiers.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.Collections.Generic; - -namespace Microsoft.DotNet.Cli.Utils -{ - internal static class DotnetRuntimeIdentifiers - { - public static IEnumerable InferCurrentRuntimeIdentifiers(DotnetVersionFile versionFile) - { - IEnumerable fallbackIdentifiers = null; - - // If the machine's RID isn't supported by the shared framework (i.e. the CLI - // is being used on a newer version of an OS), add the RID that the CLI was built - // with as a fallback. The RID the CLI was built with will have the correct - // runtime.* NuGet packages available. - // For example, when a user is using osx.10.12, but we only support osx.10.10 and - // osx.10.11, the project.json "runtimes" section cannot contain osx.10.12, since - // that RID isn't contained in the runtime graph - users will get a restore error. - FrameworkDependencyFile fxDepsFile = new FrameworkDependencyFile(); - if (!fxDepsFile.SupportsCurrentRuntime()) - { - string buildRid = versionFile.BuildRid; - if (!string.IsNullOrEmpty(buildRid)) - { - fallbackIdentifiers = new string[] { buildRid }; - } - } - - return RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers(fallbackIdentifiers); - } - } -} diff --git a/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs b/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs index 1d695a5de..b758f047e 100644 --- a/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs +++ b/src/Microsoft.DotNet.Cli.Utils/RuntimeEnvironmentRidExtensions.cs @@ -29,59 +29,5 @@ namespace Microsoft.DotNet.Cli.Utils return "win7-" + arch; } } - - public static IEnumerable GetAllCandidateRuntimeIdentifiers() - { - return GetAllCandidateRuntimeIdentifiers(null); - } - - public static IEnumerable GetAllCandidateRuntimeIdentifiers(IEnumerable fallbackIdentifiers = null) - { - List result = new List(); - - if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows) - { - result.Add(RuntimeEnvironment.GetRuntimeIdentifier()); - } - else - { - var arch = RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant(); - if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.1", StringComparison.Ordinal)) - { - result.Add("win7-" + arch); - } - else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.2", StringComparison.Ordinal)) - { - result.Add("win8-" + arch); - result.Add("win7-" + arch); - } - else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("6.3", StringComparison.Ordinal)) - { - result.Add("win81-" + arch); - result.Add("win8-" + arch); - result.Add("win7-" + arch); - } - else if (RuntimeEnvironment.OperatingSystemVersion.StartsWith("10.0", StringComparison.Ordinal)) - { - result.Add("win10-" + arch); - result.Add("win81-" + arch); - result.Add("win8-" + arch); - result.Add("win7-" + arch); - } - } - - if (fallbackIdentifiers != null) - { - foreach (string fallbackIdentifier in fallbackIdentifiers) - { - if (!result.Contains(fallbackIdentifier)) - { - result.Add(fallbackIdentifier); - } - } - } - - return result; - } } } diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs index 0ec85046c..b0b825e43 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/StreamForwarderTests.cs @@ -13,8 +13,6 @@ namespace StreamForwarderTests { public class StreamForwarderTests : TestBase { - private static readonly string s_rid = DotnetLegacyRuntimeIdentifiers.InferLegacyRestoreRuntimeIdentifier(); - public static IEnumerable ForwardingTheoryVariations { get