Merging rel/1.0.0-preview2 into rel/1.0.0.

This commit is contained in:
Eric Erhardt 2016-10-03 14:47:24 -05:00
commit 5055935008
20 changed files with 215 additions and 57 deletions

View file

@ -238,7 +238,8 @@ namespace Microsoft.DotNet.Cli
{
HelpCommand.PrintVersionHeader();
var commitSha = GetCommitSha() ?? "N/A";
DotnetVersionFile versionFile = DotnetFiles.VersionFileObject;
var commitSha = versionFile.CommitSha ?? "N/A";
Reporter.Output.WriteLine();
Reporter.Output.WriteLine("Product Information:");
Reporter.Output.WriteLine($" Version: {Product.Version}");
@ -248,7 +249,7 @@ namespace Microsoft.DotNet.Cli
Reporter.Output.WriteLine($" OS Name: {RuntimeEnvironment.OperatingSystem}");
Reporter.Output.WriteLine($" OS Version: {RuntimeEnvironment.OperatingSystemVersion}");
Reporter.Output.WriteLine($" OS Platform: {RuntimeEnvironment.OperatingSystemPlatform}");
Reporter.Output.WriteLine($" RID: {RuntimeEnvironment.GetRuntimeIdentifier()}");
Reporter.Output.WriteLine($" RID: {GetDisplayRid(versionFile)}");
}
private static bool IsArg(string candidate, string longName)
@ -261,16 +262,17 @@ namespace Microsoft.DotNet.Cli
return (shortName != null && candidate.Equals("-" + shortName)) || (longName != null && candidate.Equals("--" + longName));
}
private static string GetCommitSha()
private static string GetDisplayRid(DotnetVersionFile versionFile)
{
var versionFile = DotnetFiles.VersionFile;
FrameworkDependencyFile fxDepsFile = new FrameworkDependencyFile();
if (File.Exists(versionFile))
{
return File.ReadLines(versionFile).FirstOrDefault()?.Substring(0, 10);
}
string currentRid = RuntimeEnvironment.GetRuntimeIdentifier();
return null;
// if the current RID isn't supported by the shared framework, display the RID the CLI was
// built with instead, so the user knows which RID they should put in their "runtimes" section.
return fxDepsFile.IsRuntimeSupported(currentRid) ?
currentRid :
versionFile.BuildRid;
}
}
}