2016-03-07 20:20:50 +00:00
|
|
|
|
using Microsoft.DotNet.Cli.Build.Framework;
|
2016-05-27 07:44:31 +00:00
|
|
|
|
using Microsoft.DotNet.InternalAbstractions;
|
2016-03-07 20:20:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
|
|
|
{
|
|
|
|
|
public class Monikers
|
|
|
|
|
{
|
2016-03-17 00:54:44 +00:00
|
|
|
|
public const string SharedFrameworkName = "Microsoft.NETCore.App";
|
2016-05-04 22:57:08 +00:00
|
|
|
|
public const string CLISdkBrandName = "Microsoft .NET Core 1.0.0 RC2 - SDK Preview 1";
|
|
|
|
|
public const string SharedFxBrandName = "Microsoft .NET Core 1.0.0 RC2 - Runtime";
|
|
|
|
|
public const string SharedHostBrandName = "Microsoft .NET Core 1.0.0 RC2 - Host";
|
2016-03-17 00:54:44 +00:00
|
|
|
|
|
2016-03-24 00:13:58 +00:00
|
|
|
|
public static string GetProductMoniker(BuildTargetContext c, string artifactPrefix, string version)
|
2016-03-07 20:20:50 +00:00
|
|
|
|
{
|
2016-05-27 07:44:31 +00:00
|
|
|
|
string rid = RuntimeEnvironment.GetRuntimeIdentifier();
|
|
|
|
|
|
|
|
|
|
if (rid == "ubuntu.16.04-x64" || rid == "fedora.23-x64" || rid == "opensuse.13.2-x64")
|
|
|
|
|
{
|
|
|
|
|
return $"{artifactPrefix}-{rid}.{version}";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string osname = GetOSShortName();
|
|
|
|
|
var arch = CurrentArchitecture.Current.ToString();
|
|
|
|
|
return $"{artifactPrefix}-{osname}-{arch}.{version}";
|
|
|
|
|
}
|
2016-03-07 20:20:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-30 05:38:14 +00:00
|
|
|
|
public static string GetBadgeMoniker()
|
|
|
|
|
{
|
|
|
|
|
switch (RuntimeEnvironment.GetRuntimeIdentifier())
|
|
|
|
|
{
|
|
|
|
|
case "ubuntu.16.04-x64":
|
|
|
|
|
return "Ubuntu_16_04_x64";
|
|
|
|
|
case "fedora.23-x64":
|
|
|
|
|
return "Fedora_23_x64";
|
|
|
|
|
case "opensuse.13.2-x64":
|
|
|
|
|
return "openSUSE_13_2_x64";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $"{CurrentPlatform.Current}_{CurrentArchitecture.Current}";
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-08 23:33:18 +00:00
|
|
|
|
public static string GetDebianPackageName(BuildTargetContext c)
|
|
|
|
|
{
|
|
|
|
|
var channel = c.BuildContext.Get<string>("Channel").ToLower();
|
|
|
|
|
var packageName = "";
|
|
|
|
|
switch (channel)
|
|
|
|
|
{
|
|
|
|
|
case "dev":
|
|
|
|
|
packageName = "dotnet-nightly";
|
|
|
|
|
break;
|
|
|
|
|
case "beta":
|
|
|
|
|
case "rc1":
|
|
|
|
|
case "rc2":
|
2016-05-09 18:48:36 +00:00
|
|
|
|
case "preview":
|
2016-03-08 23:33:18 +00:00
|
|
|
|
case "rtm":
|
|
|
|
|
packageName = "dotnet";
|
|
|
|
|
break;
|
2016-03-17 00:54:44 +00:00
|
|
|
|
default:
|
2016-03-08 23:33:18 +00:00
|
|
|
|
throw new Exception($"Unknown channel - {channel}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return packageName;
|
|
|
|
|
}
|
2016-03-22 18:40:57 +00:00
|
|
|
|
|
|
|
|
|
public static string GetSdkDebianPackageName(BuildTargetContext c)
|
|
|
|
|
{
|
|
|
|
|
var channel = c.BuildContext.Get<string>("Channel").ToLower();
|
2016-03-24 23:35:42 +00:00
|
|
|
|
var nugetVersion = c.BuildContext.Get<BuildVersion>("BuildVersion").NuGetVersion;
|
2016-03-22 18:40:57 +00:00
|
|
|
|
|
|
|
|
|
var packagePrefix = "";
|
|
|
|
|
switch (channel)
|
|
|
|
|
{
|
|
|
|
|
case "dev":
|
|
|
|
|
packagePrefix = "dotnet-nightly";
|
|
|
|
|
break;
|
|
|
|
|
case "beta":
|
|
|
|
|
case "rc1":
|
|
|
|
|
case "rc2":
|
2016-05-09 18:48:36 +00:00
|
|
|
|
case "preview":
|
2016-03-22 18:40:57 +00:00
|
|
|
|
case "rtm":
|
|
|
|
|
packagePrefix = "dotnet";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new Exception($"Unknown channel - {channel}");
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-24 23:35:42 +00:00
|
|
|
|
return $"{packagePrefix}-dev-{nugetVersion}";
|
2016-03-22 18:40:57 +00:00
|
|
|
|
}
|
2016-03-08 23:33:18 +00:00
|
|
|
|
|
2016-05-27 20:24:39 +00:00
|
|
|
|
public static string GetDebianSharedFrameworkPackageName(string sharedFrameworkNugetVersion)
|
2016-03-10 01:33:05 +00:00
|
|
|
|
{
|
2016-03-17 00:54:44 +00:00
|
|
|
|
return $"dotnet-sharedframework-{SharedFrameworkName}-{sharedFrameworkNugetVersion}".ToLower();
|
2016-03-10 01:33:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-15 23:41:18 +00:00
|
|
|
|
public static string GetDebianSharedHostPackageName(BuildTargetContext c)
|
|
|
|
|
{
|
|
|
|
|
return $"dotnet-host".ToLower();
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-07 20:20:50 +00:00
|
|
|
|
public static string GetOSShortName()
|
|
|
|
|
{
|
|
|
|
|
string osname = "";
|
|
|
|
|
switch (CurrentPlatform.Current)
|
|
|
|
|
{
|
|
|
|
|
case BuildPlatform.Windows:
|
|
|
|
|
osname = "win";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
osname = CurrentPlatform.Current.ToString().ToLower();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return osname;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|