Piotrp msft/msbuild/incremental test (#3842)
* Incremental Testing - Part 1 * Fix 'clean' bug * Remove --fallbacksource from TestAssetPackage restore.
This commit is contained in:
parent
caa4cf373c
commit
16bedef2c5
7 changed files with 457 additions and 149 deletions
66
build_projects/dotnet-cli-build/DotNetBuild.cs
Normal file
66
build_projects/dotnet-cli-build/DotNetBuild.cs
Normal file
|
@ -0,0 +1,66 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetBuild : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "build"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetBuildBasePath()}"; }
|
||||
}
|
||||
|
||||
public string BuildBasePath { get; set; }
|
||||
|
||||
public string Configuration { get; set; }
|
||||
|
||||
public string Framework { get; set; }
|
||||
|
||||
public string ProjectPath { get; set; }
|
||||
|
||||
private string GetBuildBasePath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(BuildBasePath))
|
||||
{
|
||||
return $"--build-base-path {BuildBasePath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetConfiguration()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
return $"--configuration {Configuration}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetFramework()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Framework))
|
||||
{
|
||||
return $"--framework {Framework}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetProjectPath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ProjectPath))
|
||||
{
|
||||
return $"{ProjectPath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
90
build_projects/dotnet-cli-build/DotNetPack.cs
Normal file
90
build_projects/dotnet-cli-build/DotNetPack.cs
Normal file
|
@ -0,0 +1,90 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetPack : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "pack"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()}"; }
|
||||
}
|
||||
|
||||
public string Configuration { get; set; }
|
||||
|
||||
public bool NoBuild { get; set; }
|
||||
|
||||
public string BuildBasePath { get; set; }
|
||||
|
||||
public string Output { get; set; }
|
||||
|
||||
public string ProjectPath { get; set; }
|
||||
|
||||
public string VersionSuffix { get; set; }
|
||||
|
||||
private string GetConfiguration()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
return $"--configuration {Configuration}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetNoBuild()
|
||||
{
|
||||
if (NoBuild)
|
||||
{
|
||||
return $"--no-build";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetBuildBasePath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(BuildBasePath))
|
||||
{
|
||||
return $"--build-base-path {BuildBasePath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetOutput()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Output))
|
||||
{
|
||||
return $"--output {Output}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetProjectPath()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ProjectPath))
|
||||
{
|
||||
return $"{ProjectPath}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetVersionSuffix()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(VersionSuffix))
|
||||
{
|
||||
return $"--version-suffix {VersionSuffix}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
42
build_projects/dotnet-cli-build/DotNetRestore.cs
Normal file
42
build_projects/dotnet-cli-build/DotNetRestore.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetRestore : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "restore"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetVerbosity()} {GetFallbackSource()}"; }
|
||||
}
|
||||
|
||||
public string FallbackSource { get; set; }
|
||||
|
||||
public string Verbosity { get; set; }
|
||||
|
||||
private string GetFallbackSource()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(FallbackSource))
|
||||
{
|
||||
return $"--fallbacksource {FallbackSource}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetVerbosity()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Verbosity))
|
||||
{
|
||||
return $"--verbosity {Verbosity}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
54
build_projects/dotnet-cli-build/DotNetTest.cs
Normal file
54
build_projects/dotnet-cli-build/DotNetTest.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class DotNetTest : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "test"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetConfiguration()} {GetXml()} {GetNoTrait()}"; }
|
||||
}
|
||||
|
||||
public string Configuration { get; set; }
|
||||
|
||||
public string Xml { get; set; }
|
||||
|
||||
public string NoTrait { get; set; }
|
||||
|
||||
private string GetConfiguration()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
return $"--configuration {Configuration}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetNoTrait()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
return $"-notrait {NoTrait}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetXml()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Xml))
|
||||
{
|
||||
return $"-xml {Xml}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,78 +55,4 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
base.LogToolCommand($"{GetWorkingDirectory()}> {message}");
|
||||
}
|
||||
}
|
||||
|
||||
public class DotNetRestore : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "restore"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetVerbosity()}"; }
|
||||
}
|
||||
|
||||
public string Verbosity { get; set; }
|
||||
|
||||
private string GetVerbosity()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Verbosity))
|
||||
{
|
||||
return $"--verbosity {Verbosity}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class DotNetTest : DotNetTool
|
||||
{
|
||||
protected override string Command
|
||||
{
|
||||
get { return "test"; }
|
||||
}
|
||||
|
||||
protected override string Args
|
||||
{
|
||||
get { return $"{GetConfiguration()} {GetXml()} {GetNoTrait()}"; }
|
||||
}
|
||||
|
||||
public string Configuration { get; set; }
|
||||
|
||||
public string Xml { get; set; }
|
||||
|
||||
public string NoTrait { get; set; }
|
||||
|
||||
private string GetConfiguration()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
return $"--configuration {Configuration}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetNoTrait()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Configuration))
|
||||
{
|
||||
return $"-notrait {NoTrait}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetXml()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Xml))
|
||||
{
|
||||
return $"-xml {Xml}";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue