From 4a93863b8d865bb4d65f77b34ee335d7b23a79fc Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 30 Jun 2020 06:31:41 -0700 Subject: [PATCH] Fix the blazorwasm benchmark app (#23498) Specifying the RID and PublishDir when publishing the driver app causes all sorts of build issues. This change moves specifying the RID in to the driver app and ensures PublishDir does not flow to the referenced RazorSDK project. * Fix docker build * Update readme typos --- .../benchmarkapps/Wasm.Performance/Driver/Program.cs | 5 ++--- .../benchmarkapps/Wasm.Performance/Driver/Selenium.cs | 8 +++++++- .../Driver/Wasm.Performance.Driver.csproj | 2 ++ src/Components/benchmarkapps/Wasm.Performance/README.md | 2 +- src/Components/benchmarkapps/Wasm.Performance/dockerfile | 5 +++-- .../benchmarkapps/Wasm.Performance/local.dockerfile | 2 +- .../src/Microsoft.AspNetCore.Razor.Tools.csproj | 1 + .../src/Microsoft.NET.Sdk.Razor.csproj | 6 +++--- 8 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs b/src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs index b2ae0170f6..c3c3ae618f 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs +++ b/src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs @@ -40,13 +40,12 @@ namespace Wasm.Performance.Driver return 1; } - if (stressRunSeconds < 1) + if (stressRunSeconds < 0) { Console.Error.WriteLine("Stress run duration must be a positive integer."); return 1; } - - if (stressRunSeconds > 0) + else if (stressRunSeconds > 0) { isStressRun = true; diff --git a/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs b/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs index da5fbe4e1a..f9d7ef47ef 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs +++ b/src/Components/benchmarkapps/Wasm.Performance/Driver/Selenium.cs @@ -15,7 +15,13 @@ namespace Wasm.Performance.Driver { const int SeleniumPort = 4444; static bool RunHeadlessBrowser = true; - static bool PoolForBrowserLogs = false; + + static bool PoolForBrowserLogs = +#if DEBUG + true; +#else + false; +#endif private static async ValueTask WaitForServerAsync(int port, CancellationToken cancellationToken) { diff --git a/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj b/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj index 523c04d26b..8172295228 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj +++ b/src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj @@ -8,6 +8,8 @@ false true + + linux-x64 diff --git a/src/Components/benchmarkapps/Wasm.Performance/README.md b/src/Components/benchmarkapps/Wasm.Performance/README.md index 6110956bfc..06fba416c8 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/README.md +++ b/src/Components/benchmarkapps/Wasm.Performance/README.md @@ -9,7 +9,7 @@ The TestApp is a regular BlazorWASM project and can be run using `dotnet run`. T Here are the commands you would need to run it locally inside docker: -1. `dotnet publish -c Release -r linux-x64 Driver/Wasm.Performance.Driver.csproj` +1. `dotnet publish -c Release Driver/Wasm.Performance.Driver.csproj` 2. `docker build -t blazor-local -f ./local.dockerfile . ` 3. `docker run -it blazor-local` diff --git a/src/Components/benchmarkapps/Wasm.Performance/dockerfile b/src/Components/benchmarkapps/Wasm.Performance/dockerfile index 8237cb9e59..baf4d03861 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/dockerfile +++ b/src/Components/benchmarkapps/Wasm.Performance/dockerfile @@ -20,10 +20,11 @@ ADD https://api.github.com/repos/dotnet/aspnetcore/git/ref/heads/${gitBranch} /a RUN git init \ && git fetch https://github.com/aspnet/aspnetcore ${gitBranch} \ && git reset --hard FETCH_HEAD \ - && git submodule update --init + && git submodule update --init \ + && git remote add origin https://github.com/aspnet/aspnetcore RUN ./restore.sh -RUN .dotnet/dotnet publish -c Release -r linux-x64 -o /app ./src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj +RUN .dotnet/dotnet publish -c Release --no-restore -o /app ./src/Components/benchmarkapps/Wasm.Performance/Driver/Wasm.Performance.Driver.csproj RUN chmod +x /app/Wasm.Performance.Driver WORKDIR /app diff --git a/src/Components/benchmarkapps/Wasm.Performance/local.dockerfile b/src/Components/benchmarkapps/Wasm.Performance/local.dockerfile index bccdc856f8..5971ed7ee0 100644 --- a/src/Components/benchmarkapps/Wasm.Performance/local.dockerfile +++ b/src/Components/benchmarkapps/Wasm.Performance/local.dockerfile @@ -3,7 +3,7 @@ FROM selenium/standalone-chrome:3.141.59-mercury as final ENV StressRunDuration=0 WORKDIR /app -COPY ./Driver/bin/Release/netcoreapp3.1/linux-x64/publish ./ +COPY ./Driver/bin/Release/net5.0/linux-x64/publish ./ COPY ./exec.sh ./ ENTRYPOINT [ "bash", "./exec.sh" ] diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj index 30885c51f1..1489542b02 100644 --- a/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj +++ b/src/Razor/Microsoft.AspNetCore.Razor.Tools/src/Microsoft.AspNetCore.Razor.Tools.csproj @@ -20,6 +20,7 @@ false + false diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj index 42cb964335..552d192460 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj @@ -30,7 +30,7 @@ ReferenceOutputAssembly="false" IsImplicityDefined="false" SkipGetTargetFrameworkProperties="true" - UndefineProperties="TargetFramework;TargetFrameworks" /> + UndefineProperties="TargetFramework;TargetFrameworks;RuntimeIdentifier;PublishDir" />