From f1a59d030eab9d13ab6531f358ae3513b3dee268 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Thu, 6 Apr 2017 15:02:20 -0700 Subject: [PATCH] Supply runtime identifier on publishing standalone apps --- build/dependencies.props | 1 + .../Deployers/ApplicationDeployer.cs | 29 +++++++++++++++++-- ...spNetCore.Server.IntegrationTesting.csproj | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index db8feeeac0..69be82b3e2 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,6 +2,7 @@ 2.0.0-* 4.3.0 + 1.1.0 2.0.0-* 1.6.1 2.0.0-* diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting/Deployers/ApplicationDeployer.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting/Deployers/ApplicationDeployer.cs index d89a2fac06..4cef40cd69 100644 --- a/src/Microsoft.AspNetCore.Server.IntegrationTesting/Deployers/ApplicationDeployer.cs +++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting/Deployers/ApplicationDeployer.cs @@ -7,9 +7,9 @@ using System.Diagnostics; using System.IO; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting.Common; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Logging; +using PlatformAbstractions = Microsoft.DotNet.PlatformAbstractions; namespace Microsoft.AspNetCore.Server.IntegrationTesting { @@ -56,8 +56,14 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting var parameters = $"publish " + $" --output \"{DeploymentParameters.PublishedApplicationRootPath}\"" + $" --framework {DeploymentParameters.TargetFramework}" - + $" --configuration {DeploymentParameters.Configuration}" - + $" {DeploymentParameters.AdditionalPublishParameters}"; + + $" --configuration {DeploymentParameters.Configuration}"; + + if (DeploymentParameters.ApplicationType == ApplicationType.Standalone) + { + parameters += $" --runtime {GetRuntimeIdentifier()}"; + } + + parameters += $" {DeploymentParameters.AdditionalPublishParameters}"; var startInfo = new ProcessStartInfo { @@ -205,5 +211,22 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting } public abstract void Dispose(); + + private string GetRuntimeIdentifier() + { + var architecture = PlatformAbstractions.RuntimeEnvironment.RuntimeArchitecture; + switch (PlatformAbstractions.RuntimeEnvironment.OperatingSystemPlatform) + { + case PlatformAbstractions.Platform.Windows: + return "win7-" + architecture; + case PlatformAbstractions.Platform.Linux: + return "linux-" + architecture; + case PlatformAbstractions.Platform.Darwin: + return "osx.10.12-" + architecture; + default: + throw new InvalidOperationException( + "Unrecognized operation system platform: " + PlatformAbstractions.RuntimeEnvironment.OperatingSystemPlatform); + } + } } } diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting/Microsoft.AspNetCore.Server.IntegrationTesting.csproj b/src/Microsoft.AspNetCore.Server.IntegrationTesting/Microsoft.AspNetCore.Server.IntegrationTesting.csproj index 2d88c56830..109c834ec3 100644 --- a/src/Microsoft.AspNetCore.Server.IntegrationTesting/Microsoft.AspNetCore.Server.IntegrationTesting.csproj +++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting/Microsoft.AspNetCore.Server.IntegrationTesting.csproj @@ -23,6 +23,7 @@ +