diff --git a/src/core-sdk-tasks/CurrentPlatform.cs b/src/core-sdk-tasks/CurrentPlatform.cs deleted file mode 100644 index 93ff09bfb0fc..000000000000 --- a/src/core-sdk-tasks/CurrentPlatform.cs +++ /dev/null @@ -1,206 +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; -using System.Linq; -using System.Runtime.InteropServices; -using Microsoft.DotNet.PlatformAbstractions; -using RuntimeEnvironment = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment; - -namespace Microsoft.DotNet.Cli.Build.Framework -{ - public static class CurrentPlatform - { - public static BuildPlatform Current - { - get - { - return DetermineCurrentPlatform(); - } - } - - public static bool IsWindows - { - get - { - return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - } - } - - public static bool IsOSX - { - get - { - return RuntimeInformation.IsOSPlatform(OSPlatform.OSX); - } - } - - public static bool IsFreeBSD - { - get - { - return RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")); - } - } - - public static bool IsUbuntu - { - get - { - var osname = RuntimeEnvironment.OperatingSystem; - return string.Equals(osname, "ubuntu", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool IsCentOS - { - get - { - var osname = RuntimeEnvironment.OperatingSystem; - return string.Equals(osname, "centos", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool IsRHEL - { - get - { - var osname = RuntimeEnvironment.OperatingSystem; - return string.Equals(osname, "rhel", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool IsFedora - { - get - { - var osname = RuntimeEnvironment.OperatingSystem; - return string.Equals(osname, "fedora", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool IsOpenSuse - { - get - { - var osname = RuntimeEnvironment.OperatingSystem; - return string.Equals(osname, "opensuse", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool IsUnix - { - get - { - return IsLinux || IsOSX || IsFreeBSD; - } - } - - public static bool IsDebian - { - get - { - var osname = RuntimeEnvironment.OperatingSystem; - return string.Equals(osname, "debian", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool IsLinux - { - get - { - return IsUbuntu || IsCentOS || IsRHEL || IsDebian || IsFedora || IsOpenSuse; - } - } - - public static bool IsPlatform(BuildPlatform platform, string version = null) - { - return IsPlatform(platform) && (version == null || IsVersion(version)); - } - - public static bool IsAnyPlatform(params BuildPlatform[] platforms) - { - return platforms.Any(p => IsPlatform(p)); - } - - public static bool IsPlatform(BuildPlatform platform) - { - switch (platform) - { - case BuildPlatform.Windows: - return IsWindows; - case BuildPlatform.Ubuntu: - return IsUbuntu; - case BuildPlatform.OSX: - return IsOSX; - case BuildPlatform.FreeBSD: - return IsFreeBSD; - case BuildPlatform.CentOS: - return IsCentOS; - case BuildPlatform.RHEL: - return IsRHEL; - case BuildPlatform.Debian: - return IsDebian; - case BuildPlatform.Fedora: - return IsFedora; - case BuildPlatform.OpenSuse: - return IsOpenSuse; - case BuildPlatform.Unix: - return IsUnix; - case BuildPlatform.Linux: - return IsLinux; - default: - throw new Exception("Unrecognized Platform."); - } - } - - public static bool IsVersion(string version) - { - return RuntimeEnvironment.OperatingSystemVersion.Equals(version, StringComparison.OrdinalIgnoreCase); - } - - private static BuildPlatform DetermineCurrentPlatform() - { - if (IsWindows) - { - return BuildPlatform.Windows; - } - else if (IsOSX) - { - return BuildPlatform.OSX; - } - else if (IsUbuntu) - { - return BuildPlatform.Ubuntu; - } - else if (IsCentOS) - { - return BuildPlatform.CentOS; - } - else if (IsRHEL) - { - return BuildPlatform.RHEL; - } - else if (IsDebian) - { - return BuildPlatform.Debian; - } - else if (IsFedora) - { - return BuildPlatform.Fedora; - } - else if (IsOpenSuse) - { - return BuildPlatform.OpenSuse; - } - else if (IsFreeBSD) - { - return BuildPlatform.FreeBSD; - } - else - { - return default(BuildPlatform); - } - } - } -} diff --git a/src/core-sdk-tasks/GetCurrentRuntimeInformation.cs b/src/core-sdk-tasks/GetCurrentRuntimeInformation.cs deleted file mode 100644 index 7506491f2f53..000000000000 --- a/src/core-sdk-tasks/GetCurrentRuntimeInformation.cs +++ /dev/null @@ -1,47 +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 Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using Microsoft.DotNet.Cli.Build.Framework; -using Microsoft.DotNet.PlatformAbstractions; - -namespace Microsoft.DotNet.Cli.Build -{ - public class GetCurrentRuntimeInformation : Task - { - [Output] - public string Rid { get; set; } - - [Output] - public string OSName { get; set; } - - [Output] - public string OSPlatform { get; set; } - - public override bool Execute() - { - Rid = RuntimeEnvironment.GetRuntimeIdentifier(); - OSName = GetOSShortName(); - OSPlatform = RuntimeEnvironment.OperatingSystemPlatform.ToString().ToLower(); - - return true; - } - - private static string GetOSShortName() - { - string osname = ""; - switch (CurrentPlatform.Current) - { - case BuildPlatform.Windows: - osname = "win"; - break; - default: - osname = CurrentPlatform.Current.ToString().ToLower(); - break; - } - - return osname; - } - } -} diff --git a/src/core-sdk-tasks/core-sdk-tasks.csproj b/src/core-sdk-tasks/core-sdk-tasks.csproj index d6c8968d4056..20ce4702efd0 100644 --- a/src/core-sdk-tasks/core-sdk-tasks.csproj +++ b/src/core-sdk-tasks/core-sdk-tasks.csproj @@ -10,7 +10,6 @@ - diff --git a/src/redist/targets/BuildCoreSdkTasks.targets b/src/redist/targets/BuildCoreSdkTasks.targets index e535146ae6ac..99bef914053a 100644 --- a/src/redist/targets/BuildCoreSdkTasks.targets +++ b/src/redist/targets/BuildCoreSdkTasks.targets @@ -20,7 +20,6 @@ - diff --git a/src/redist/targets/FileExtensions.targets b/src/redist/targets/FileExtensions.targets index 39156c3484d4..d2691675009b 100644 --- a/src/redist/targets/FileExtensions.targets +++ b/src/redist/targets/FileExtensions.targets @@ -1,31 +1,31 @@ - .zip - .tar.gz + .tar.gz + .zip - .msi - .pkg + .msi + .pkg .deb .rpm - .exe - $(InstallerExtension) + .exe + $(InstallerExtension) $(InstallerExtension) $(InstallerExtension) lib - + .so - .dll - .dylib + .dll + .dylib .exe - + - .ps1 - .sh + .sh + .ps1 diff --git a/src/redist/targets/GenerateLayout.targets b/src/redist/targets/GenerateLayout.targets index 970111c9d82a..ac18551f54b2 100644 --- a/src/redist/targets/GenerateLayout.targets +++ b/src/redist/targets/GenerateLayout.targets @@ -34,10 +34,10 @@ https://dotnetfeed.blob.core.windows.net/dotnet-core/ $(HostRid) - $(HostMonikerRid) + $(OSName)-$(Architecture) - -internal + -internal @@ -77,7 +77,7 @@ $(AspNetCoreSharedFxInstallerRid) x64 - aspnetcore-runtime-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreSharedFxInstallerRid)$(InstallerExtension) + aspnetcore-runtime-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreSharedFxInstallerRid)$(InstallerExtension) aspnetcore-runtime-internal-$(MicrosoftAspNetCoreAppRuntimePackageVersion)-$(AspNetCoreSharedFxInstallerRid).wixlib aspnetcore-targeting-pack-$(MicrosoftAspNetCoreAppRefPackageVersion)$(InstallerExtension) @@ -98,7 +98,7 @@ $(CoreSetupDownloadDirectory)/combinedSharedHostAndFrameworkArchive$(ArchiveExtension) - + win-$(AlternateArchitecture) win-arm win-arm64 diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets index f417fa7b1995..9f53268ab1c7 100644 --- a/src/redist/targets/GetRuntimeInformation.targets +++ b/src/redist/targets/GetRuntimeInformation.targets @@ -1,23 +1,20 @@ - - - - - - - True - $(HostOSName) - $(HostOSPlatform) + $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) + win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant) + + True + win + osx + freebsd linux - linux $(OSName)-$(Architecture) - true + true true true true @@ -29,13 +26,6 @@ '$(Rid)' == 'linux-musl-x64' ">$(Rid) $(OSName)-$(Architecture) - $(HostRid) - $(HostOSName)-$(Architecture) - $(HostMonikerRid) - $(Architecture) - dotnet-sdk-internal dotnet-sdk @@ -45,8 +35,7 @@ Dotnet SDK Bundle Installer $(CliProductBandVersion) $(ProductMonikerRid) - $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(Version)- - $(DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdkWithoutHostMonikerRid)$(HostMonikerRidForFileName) + $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(Version)-$(Architecture) diff --git a/src/redist/targets/SetBuildDefaults.targets b/src/redist/targets/SetBuildDefaults.targets index 52d64447a3a7..0378bbb5356c 100644 --- a/src/redist/targets/SetBuildDefaults.targets +++ b/src/redist/targets/SetBuildDefaults.targets @@ -12,7 +12,7 @@ OR $(Rid.StartsWith('ubuntu.18.04')))">true false - true + true