Nefarius.Peripherals.Serial.../build/Build.cs

54 lines
1.6 KiB
C#

using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.Git;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.MSBuild;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
class Build : NukeBuild
{
public static int Main () => Execute<Build>(x => x.Compile);
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly string Configuration = IsLocalBuild ? "Debug" : "Release";
[Solution("PInvokeSerialPort.sln")] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
[GitVersion] readonly GitVersion GitVersion;
Target Clean => _ => _
.Executes(() =>
{
});
Target Restore => _ => _
.DependsOn(Clean)
.Executes(() =>
{
MSBuild(s => s
.SetTargetPath(Solution)
.SetTargets("Restore"));
});
Target Compile => _ => _
.DependsOn(Restore)
.Executes(() =>
{
MSBuild(s => s
.SetTargetPath(Solution)
.SetTargets("Rebuild")
.SetConfiguration(Configuration)
.SetAssemblyVersion(GitVersion.GetNormalizedAssemblyVersion())
.SetFileVersion(GitVersion.GetNormalizedFileVersion())
.SetInformationalVersion(GitVersion.InformationalVersion)
.SetMaxCpuCount(Environment.ProcessorCount)
.SetNodeReuse(IsLocalBuild));
});
}