|
|
@@ -9,7 +9,7 @@ namespace BuildScript |
|
|
|
[Include("./build/BuildVersion.cs")] |
|
|
|
public partial class BuildScript : DefaultBuildScript |
|
|
|
{ |
|
|
|
private const string ArtifactsDir = "./artifacts"; |
|
|
|
protected string ArtifactsDir => RootDirectory.CombineWith("artifacts"); |
|
|
|
|
|
|
|
[FromArg("c|configuration")] |
|
|
|
public string Configuration { get; set; } |
|
|
@@ -29,27 +29,30 @@ namespace BuildScript |
|
|
|
protected override void BeforeBuildExecution(ITaskContext context) |
|
|
|
{ |
|
|
|
BuildVersion = FetchBuildVersion(context); |
|
|
|
TestProjectFiles = context.GetFiles("./test", "*/*.csproj"); |
|
|
|
ProjectFiles = context.GetFiles("./src", "*/*.csproj"); |
|
|
|
TestProjectFiles = context.GetFiles(RootDirectory.CombineWith("test"), "*/*.csproj"); |
|
|
|
ProjectFiles = context.GetFiles(RootDirectory.CombineWith("src"), "*/*.csproj"); |
|
|
|
} |
|
|
|
|
|
|
|
protected override void ConfigureTargets(ITaskContext context) |
|
|
|
{ |
|
|
|
var clean = context.CreateTarget("Clean") |
|
|
|
.SetDescription("") |
|
|
|
.SetDescription("Cleans the output of all projects in the solution.") |
|
|
|
.AddCoreTask(x => x.Clean() |
|
|
|
.AddDirectoryToClean(ArtifactsDir, true)); |
|
|
|
|
|
|
|
var restore = context.CreateTarget("Restore") |
|
|
|
.SetDescription("Restores the dependencies and tools of all projects in the solution.") |
|
|
|
.DependsOn(clean) |
|
|
|
.AddCoreTask(x => x.Restore()); |
|
|
|
|
|
|
|
var build = context.CreateTarget("Build") |
|
|
|
.SetDescription("Builds all projects in the solution.") |
|
|
|
.DependsOn(restore) |
|
|
|
.AddCoreTask(x => x.Build() |
|
|
|
.InformationalVersion(BuildVersion.VersionWithSuffix())); |
|
|
|
|
|
|
|
var tests = context.CreateTarget("Tests") |
|
|
|
.SetDescription("Runs all Cap tests.") |
|
|
|
.ForEach(TestProjectFiles, |
|
|
|
(projectFile, target) => |
|
|
|
{ |
|
|
@@ -59,17 +62,19 @@ namespace BuildScript |
|
|
|
}); |
|
|
|
|
|
|
|
var pack = context.CreateTarget("Pack") |
|
|
|
.SetDescription("Creates nuget packages for Cap.") |
|
|
|
.ForEach(ProjectFiles, (projectFile, target) => |
|
|
|
{ |
|
|
|
target.AddCoreTask(x => x.Pack() |
|
|
|
.NoBuild() |
|
|
|
.Project(projectFile) |
|
|
|
.IncludeSymbols() |
|
|
|
.When(() => !string.IsNullOrEmpty(BuildVersion.Suffix), t => t.VersionSufix(BuildVersion.Suffix)) |
|
|
|
.VersionSuffix(BuildVersion.Suffix) |
|
|
|
.OutputDirectory(ArtifactsDir)); |
|
|
|
}); |
|
|
|
|
|
|
|
context.CreateTarget("Default") |
|
|
|
.SetDescription("Runs all targets.") |
|
|
|
.SetAsDefault() |
|
|
|
.DependsOn(clean, restore, build, tests, pack); |
|
|
|
} |
|
|
|