Skip to content

Commit

Permalink
Switch to using RuntimeInformation APIs instead of deprecated Platfor…
Browse files Browse the repository at this point in the history
…mAbstractions

See dotnet/sdk#11076
  • Loading branch information
dsplaisted authored and Anipik committed Apr 23, 2020
1 parent 4bbfd63 commit 44a42ac
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "5.0.100-preview.1.20154.9",
"dotnet": "5.0.100-preview.4.20217.10",
"runtimes": {
"dotnet": [
"$(MicrosoftNETCoreAppRuntimePackageVersion)"
Expand Down
3 changes: 2 additions & 1 deletion test/EndToEnd/GivenSelfContainedAppsRollForward.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
Expand All @@ -20,7 +21,7 @@ internal void ItRollsForwardToTheLatestVersion(string packageName, string minorV
PackageName = packageName,
MinorVersion = minorVersion,
// Set RuntimeIdentifier to opt in to roll-forward behavior
RuntimeIdentifier = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier()
RuntimeIdentifier = RuntimeInformation.RuntimeIdentifier
};

var testInstance = testProjectCreator.Create();
Expand Down
3 changes: 2 additions & 1 deletion test/EndToEnd/ProjectBuildTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.DotNet.TestFramework;
Expand Down Expand Up @@ -127,7 +128,7 @@ private void TestTemplateBuild(string templateName, bool selfContained = false)
.Execute(newArgs)
.Should().Pass();

var buildArgs = selfContained ? "" :$"-r {RuntimeEnvironment.GetRuntimeIdentifier()}";
var buildArgs = selfContained ? "" :$"-r {RuntimeInformation.RuntimeIdentifier}";
var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
new BuildCommand()
.WithEnvironmentVariable("PATH", dotnetRoot) // override PATH since razor rely on PATH to find dotnet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// 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.DotNet.PlatformAbstractions;

using System.Runtime.InteropServices;
using Xunit;

namespace Microsoft.DotNet.Tools.Test.Utilities
Expand All @@ -10,7 +11,7 @@ public class UnixOnlyFactAttribute : FactAttribute
{
public UnixOnlyFactAttribute()
{
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
this.Skip = "This test requires Unix to run";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.DotNet.PlatformAbstractions;
using System.Runtime.InteropServices;
using Xunit;

namespace Microsoft.DotNet.Tools.Test.Utilities
Expand All @@ -10,7 +10,7 @@ public class UnixOnlyTheoryAttribute : TheoryAttribute
{
public UnixOnlyTheoryAttribute()
{
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
this.Skip = "This test requires Unix to run";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.DotNet.PlatformAbstractions;
using System.Runtime.InteropServices;
using Xunit;

namespace Microsoft.DotNet.Tools.Test.Utilities
Expand All @@ -10,7 +10,7 @@ public class WindowsOnlyFactAttribute : FactAttribute
{
public WindowsOnlyFactAttribute()
{
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
this.Skip = "This test requires Windows to run";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.DotNet.PlatformAbstractions;
using System.Runtime.InteropServices;
using Xunit;

namespace Microsoft.DotNet.Tools.Test.Utilities
Expand All @@ -10,7 +10,7 @@ public class WindowsOnlyTheoryAttribute : TheoryAttribute
{
public WindowsOnlyTheoryAttribute()
{
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Windows)
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
this.Skip = "This test requires Windows to run";
}
Expand Down

0 comments on commit 44a42ac

Please sign in to comment.