mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
BuildTool: Stop after when Module failed
This commit is contained in:
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices.ComTypes;
|
|
||||||
using SimpleExec;
|
using SimpleExec;
|
||||||
|
using Spectre.Console;
|
||||||
using static SimpleExec.Command;
|
using static SimpleExec.Command;
|
||||||
using Command = System.CommandLine.Command;
|
using Command = System.CommandLine.Command;
|
||||||
|
|
||||||
@@ -95,19 +95,18 @@ class GlitchyEngineHelperModule : Module
|
|||||||
|
|
||||||
public override async Task<bool> Run(BuildInfo buildInfo)
|
public override async Task<bool> Run(BuildInfo buildInfo)
|
||||||
{
|
{
|
||||||
// $(ProjectDir)/../bin/vscmake.bat x64 $(ProjectDir) x64-debug
|
|
||||||
// $(ProjectDir)/../bin/vscmake.bat x64 $(ProjectDir) x64-release
|
|
||||||
|
|
||||||
buildInfo.WorkingDirectory.NavigateFromWorkspaceRoot("GlitchyEngineHelper");
|
buildInfo.WorkingDirectory.NavigateFromWorkspaceRoot("GlitchyEngineHelper");
|
||||||
|
|
||||||
if (buildInfo.BuildDebug)
|
if (buildInfo.BuildDebug)
|
||||||
{
|
{
|
||||||
await RunAsync("cmake", "--preset x64-debug");
|
await RunAsync("cmake", "--preset x64-debug");
|
||||||
|
await RunAsync("cmake", "--build --preset x64-debug");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buildInfo.BuildRelease)
|
if (buildInfo.BuildRelease)
|
||||||
{
|
{
|
||||||
await RunAsync("cmake", "--preset x64-release");
|
await RunAsync("cmake", "--preset x64-release");
|
||||||
|
await RunAsync("cmake", "--build --preset x64-release");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -294,7 +293,7 @@ class Program
|
|||||||
Argument<string[]> modulesArgument = new("modules")
|
Argument<string[]> modulesArgument = new("modules")
|
||||||
{
|
{
|
||||||
Description = "The modules to build.",
|
Description = "The modules to build.",
|
||||||
DefaultValueFactory = _ => [BeefWorkspaceModule.ModuleName]
|
// DefaultValueFactory = _ => [AllModule.ModuleName]
|
||||||
};
|
};
|
||||||
|
|
||||||
modulesArgument.Validators.Add(result =>
|
modulesArgument.Validators.Add(result =>
|
||||||
@@ -399,7 +398,7 @@ class Program
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Module> acutalModuleOrder = allModulesOrdered.Intersect(modulesToBuild).ToList();
|
List<Module> acutalModuleOrder = allModulesOrdered.Intersect(modulesToBuild).ToList();
|
||||||
|
|
||||||
Console.WriteLine($"Building modules: {string.Join(", ", acutalModuleOrder.Select(m => m.Name))}");
|
Console.WriteLine($"Building modules: {string.Join(", ", acutalModuleOrder.Select(m => m.Name))}");
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
|
|
||||||
@@ -408,19 +407,27 @@ class Program
|
|||||||
|
|
||||||
foreach (Module module in acutalModuleOrder)
|
foreach (Module module in acutalModuleOrder)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Building module: {module.Name}");
|
string message = $"Building module: [bold italic blue]{module.Name}[/]";
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine(new string('-', message.Length));
|
||||||
|
AnsiConsole.MarkupLine(message);
|
||||||
|
Console.WriteLine(new string('-', message.Length));
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
buildInfo.WorkingDirectory.NavigateToIndex(0);
|
buildInfo.WorkingDirectory.NavigateToIndex(0);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await module.Run(buildInfo);
|
await module.Run(buildInfo);
|
||||||
|
|
||||||
|
AnsiConsole.MarkupLine($"\n[green]Module [bold italic]{module.Name}[/] completed successfully.[/]\n");
|
||||||
}
|
}
|
||||||
catch (ExitCodeException e)
|
catch (ExitCodeException e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Building module failed with exit code: " + e.ExitCode);
|
AnsiConsole.MarkupLine($"\n[bold red]Error:[/] Module [bold italic]{module.Name}[/] failed with exit code: [red]{e.ExitCode}[/]\n");
|
||||||
|
|
||||||
// TODO: allow abort once a step failed.
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SimpleExec" Version="12.0.0" />
|
<PackageReference Include="SimpleExec" Version="13.0.0" />
|
||||||
<PackageReference Include="System.CommandLine" Version="2.0.0-rc.2.25502.107" />
|
<PackageReference Include="Spectre.Console" Version="0.55.0" />
|
||||||
|
<PackageReference Include="System.CommandLine" Version="2.0.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="CopyExe" AfterTargets="Publish">
|
<Target Name="CopyExe" AfterTargets="Publish">
|
||||||
<Copy SourceFiles="$(PublishDir)$(TargetName).exe"
|
<Copy SourceFiles="$(PublishDir)$(TargetName).exe" DestinationFolder="$(DeploymentPath)" SkipUnchangedFiles="true" />
|
||||||
DestinationFolder="$(DeploymentPath)"
|
|
||||||
SkipUnchangedFiles="true" />
|
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"BuildTool": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"commandLineArgs": "build All --debug --workspace \"$(ProjectDir)/../../\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user