improved build.cake formatting

This commit is contained in:
Ell 2022-09-12 16:50:17 +02:00
parent 307ad45de9
commit 056827822b

View file

@ -7,9 +7,8 @@ var config = Argument("configuration", "Release");
var tinyLifeDir = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/Tiny Life"; var tinyLifeDir = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/Tiny Life";
Task("Build").Does(() => { Task("Build").DoesForEach(GetFiles("**/*.csproj"), p => {
foreach (var project in GetFiles("**/*.csproj")) DotNetBuild(p.FullPath, new DotNetBuildSettings { Configuration = config });
DotNetBuild(project.FullPath, new DotNetBuildSettings { Configuration = config });
}); });
Task("CopyToMods").IsDependentOn("Build").Does(() => { Task("CopyToMods").IsDependentOn("Build").Does(() => {
@ -56,18 +55,14 @@ Task("Run").IsDependentOn("CopyToMods").Does(() => {
Information($"Tiny Life exited with exit code {process.ExitCode}"); Information($"Tiny Life exited with exit code {process.ExitCode}");
}); });
Task("Publish").IsDependentOn("Build").Does(() => { Task("Publish").IsDependentOn("Build").DoesForEach(GetDirectories($"bin/{config}/net*"), d => {
foreach (var dir in GetDirectories($"bin/{config}/net*")) { var dllFile = GetFiles($"{d}/**/*.dll").FirstOrDefault();
var dllFile = GetFiles($"{dir}/**/*.dll").FirstOrDefault(); if (dllFile == null)
if (dllFile == null) { throw new Exception($"Couldn't find built mod in {d}");
Warning($"Couldn't find built mod in {dir}"); var dllName = System.IO.Path.GetFileNameWithoutExtension(dllFile.ToString());
continue; var zipLoc = $"{d.GetParent()}/{dllName}.zip";
} Zip(d, zipLoc, GetFiles($"{d}/**/*"));
var dllName = System.IO.Path.GetFileNameWithoutExtension(dllFile.ToString()); Information($"Published {dllName} to {zipLoc}");
var zipLoc = $"{dir.GetParent()}/{dllName}.zip";
Zip(dir, zipLoc, GetFiles($"{dir}/**/*"));
Information($"Published {dllName} to {zipLoc}");
}
}); });
RunTarget(target); RunTarget(target);