make dotnet-build show build summary (#5277)
* make dotnet-build show build summary * Fix race in some dotnet-migrate (sln) tests
This commit is contained in:
parent
218ec5a5cf
commit
c9b873caad
3 changed files with 25 additions and 2 deletions
|
@ -89,6 +89,8 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
msbuildArgs.Add($"/verbosity:{verbosityOption.Value()}");
|
msbuildArgs.Add($"/verbosity:{verbosityOption.Value()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msbuildArgs.Add($"/clp:Summary");
|
||||||
|
|
||||||
msbuildArgs.AddRange(app.RemainingArguments);
|
msbuildArgs.AddRange(app.RemainingArguments);
|
||||||
|
|
||||||
return new MSBuildForwardingApp(msbuildArgs).Execute();
|
return new MSBuildForwardingApp(msbuildArgs).Execute();
|
||||||
|
|
|
@ -72,5 +72,25 @@ namespace Microsoft.DotNet.Cli.Build.Tests
|
||||||
.Should().Pass()
|
.Should().Pass()
|
||||||
.And.HaveStdOutContaining("Hello World");
|
.And.HaveStdOutContaining("Hello World");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ItPrintsBuildSummary()
|
||||||
|
{
|
||||||
|
var testAppName = "MSBuildTestApp";
|
||||||
|
var testInstance = TestAssets.Get(testAppName)
|
||||||
|
.CreateInstance(testAppName)
|
||||||
|
.WithSourceFiles()
|
||||||
|
.WithRestoreFiles();
|
||||||
|
|
||||||
|
string expectedBuildSummary = @"Build succeeded.
|
||||||
|
0 Warning(s)
|
||||||
|
0 Error(s)";
|
||||||
|
|
||||||
|
var cmd = new BuildCommand()
|
||||||
|
.WithWorkingDirectory(testInstance.Root)
|
||||||
|
.ExecuteWithCapturedOutput();
|
||||||
|
cmd.Should().Pass();
|
||||||
|
cmd.StdOut.Should().ContainVisuallySameFragment(expectedBuildSummary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Microsoft.DotNet.TestFramework;
|
||||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Migration.Tests
|
namespace Microsoft.DotNet.Migration.Tests
|
||||||
|
@ -37,11 +38,11 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
"PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj");
|
"PJAppWithSlnAndXprojRefThatRefsCsprojWhereSlnDoesNotRefCsproj");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MigrateAndBuild(string groupName, string projectName)
|
private void MigrateAndBuild(string groupName, string projectName, [CallerMemberName] string callingMethod = "", string identifier = "")
|
||||||
{
|
{
|
||||||
var projectDirectory = TestAssets
|
var projectDirectory = TestAssets
|
||||||
.Get(groupName, projectName)
|
.Get(groupName, projectName)
|
||||||
.CreateInstance()
|
.CreateInstance(callingMethod: callingMethod, identifier: identifier)
|
||||||
.WithSourceFiles()
|
.WithSourceFiles()
|
||||||
.Root;
|
.Root;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue