From 947aac0397cfe8a990e08eb73edbc8e707fc76e0 Mon Sep 17 00:00:00 2001 From: Marco van den Oever Date: Mon, 17 Aug 2020 13:28:18 +0200 Subject: [PATCH] App icon, single exe output --- build.cake | 73 ++++++++++++++++--- .../windows-terminal-quake.csproj | 2 +- 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/build.cake b/build.cake index d686ed7..9540f57 100644 --- a/build.cake +++ b/build.cake @@ -1,19 +1,74 @@ #tool "nuget:?package=vswhere&version=2.6.7" +#tool "nuget:?package=ILRepack&version=2.0.18" var configuration = Argument("configuration", "Release"); +var output = Argument("output", "artifacts"); +var version = Argument("version", "v0.4"); var sln = "windows-terminal-quake.sln"; +var bin = "./windows-terminal-quake/bin"; -Task("Default").Does(() => -{ - NuGetRestore(sln); +Task("Clean") + .Does(() => + { + CleanDirectory(output); + }); + +Task("Build") + .IsDependentOn("Clean") + .Does(() => + { + MSBuild(sln, new MSBuildSettings + { + Configuration = "Release", + Restore = true, + ToolPath = GetFiles(VSWhereLatest() + "/**/MSBuild.exe").FirstOrDefault() + }); + }); - MSBuild(sln, new MSBuildSettings +Task("Artifact.Regular") + .IsDependentOn("Build") + .Does(() => { - Configuration = "Release", - Restore = true, - ToolPath = GetFiles(VSWhereLatest() + "/**/MSBuild.exe").FirstOrDefault() + var art = output + "/Artifact.Regular"; + CopyDirectory(bin, art); + DeleteFiles(art + "/*.config"); + DeleteFiles(art + "/*.pdb"); }); -}); -RunTarget("Default"); \ No newline at end of file +Task("Artifact.SingleExe") + .IsDependentOn("Build") + .Does(() => + { + var deps = GetFiles(bin + "/*.dll"); + var art = output + "/Artifact.SingleExe"; + System.IO.Directory.CreateDirectory(art); + + ILRepack( + art + "/windows-terminal-quake.exe", // Output file + bin + "/windows-terminal-quake.exe", // Primary assembly + deps, // Assembly paths + new ILRepackSettings() + ); + + CopyFile(bin + "/windows-terminal-quake.json", art + "/windows-terminal-quake.json"); + DeleteFile(art + "/windows-terminal-quake.exe.config"); + }); + +Task("Artifact.SingleExe.Zip") + .IsDependentOn("Artifact.SingleExe") + .Does(() => + { + var art = output + "/Artifact.SingleExe.Zip"; + System.IO.Directory.CreateDirectory(art); + + Zip(output + "/Artifact.SingleExe", art + $"/windows-terminal-quake-{version}-{DateTimeOffset.UtcNow:yyyy-MM-dd_HHmm}.zip"); + }); + +Task("Default") + .IsDependentOn("Artifact.Regular") + .IsDependentOn("Artifact.SingleExe") + .IsDependentOn("Artifact.SingleExe.Zip") + .Does(() => {}); + +RunTarget("Default"); diff --git a/windows-terminal-quake/windows-terminal-quake.csproj b/windows-terminal-quake/windows-terminal-quake.csproj index c0441ce..88f77ad 100644 --- a/windows-terminal-quake/windows-terminal-quake.csproj +++ b/windows-terminal-quake/windows-terminal-quake.csproj @@ -4,7 +4,7 @@ bin WinExe net472 - + UI\icon.ico