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