mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-23 22:12:48 +01:00
96 lines
2.8 KiB
C#
96 lines
2.8 KiB
C#
using System.Linq;
|
|
using Nuke.Common;
|
|
using Nuke.Common.CI;
|
|
using Nuke.Common.Execution;
|
|
using Nuke.Common.Git;
|
|
using Nuke.Common.IO;
|
|
using Nuke.Common.ProjectModel;
|
|
using Nuke.Common.Tools.DotNet;
|
|
using Nuke.Common.Tools.GitVersion;
|
|
using static Nuke.Common.IO.FileSystemTasks;
|
|
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
|
|
|
[CheckBuildProjectConfigurations]
|
|
[ShutdownDotNetAfterServerBuild]
|
|
class Build : NukeBuild
|
|
{
|
|
/// Support plugins are available for:
|
|
/// - JetBrains ReSharper https://nuke.build/resharper
|
|
/// - JetBrains Rider https://nuke.build/rider
|
|
/// - Microsoft VisualStudio https://nuke.build/visualstudio
|
|
/// - Microsoft VSCode https://nuke.build/vscode
|
|
|
|
public static int Main() => Execute<Build>(x => x.Package);
|
|
|
|
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
|
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
|
|
|
|
[Solution]
|
|
readonly Solution Solution;
|
|
|
|
Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve");
|
|
|
|
[GitRepository]
|
|
readonly GitRepository GitRepository;
|
|
|
|
[GitVersion(Framework = "netcoreapp3.1")]
|
|
readonly GitVersion GitVersion;
|
|
|
|
AbsolutePath OutputDirectory => RootDirectory / "output";
|
|
|
|
Target Clean => _ => _
|
|
.Executes(() =>
|
|
{
|
|
DotNetClean();
|
|
EnsureCleanDirectory(OutputDirectory);
|
|
});
|
|
|
|
Target Restore => _ => _
|
|
.DependsOn(Clean)
|
|
.Executes(() =>
|
|
{
|
|
DotNetRestore(s => s
|
|
.SetProjectFile(Solution));
|
|
});
|
|
|
|
Target Compile => _ => _
|
|
.DependsOn(Restore)
|
|
.Executes(() =>
|
|
{
|
|
DotNetBuild(s => s
|
|
.SetProjectFile(Solution)
|
|
.SetConfiguration(Configuration)
|
|
.SetAssemblyVersion(GitVersion.AssemblySemVer)
|
|
.SetFileVersion(GitVersion.AssemblySemFileVer)
|
|
.SetInformationalVersion(GitVersion.InformationalVersion)
|
|
.EnableNoRestore());
|
|
});
|
|
|
|
Target Test => _ => _
|
|
.DependsOn(Compile)
|
|
.Executes(() =>
|
|
{
|
|
DotNetTest(s => s
|
|
.SetProjectFile(Solution)
|
|
.EnableNoRestore()
|
|
.EnableNoBuild());
|
|
});
|
|
|
|
Target Package => _ => _
|
|
.DependsOn(Test)
|
|
.Executes(() =>
|
|
{
|
|
DotNetPack(s => s
|
|
.SetProject(SieveProject)
|
|
.SetConfiguration(Configuration)
|
|
.SetOutputDirectory(OutputDirectory)
|
|
.SetVersion(GitVersion.NuGetVersionV2)
|
|
.EnableNoRestore()
|
|
.EnableNoBuild());
|
|
});
|
|
|
|
Target Ci => _ => _
|
|
.DependsOn(Package);
|
|
|
|
}
|