Files
sbox-public/engine/Tools/SboxBuild/Steps/BuildAddons.cs
Lorenz Junglas 8bb48bac56 Move Pipelines out of SboxBuild into GitHub yml
Allows us to get rid of a ton of abstraction in SboxBuild, and gets rid of a lot of GitHub API plumbing.
I feel like now that our workflows are more complex it's nicer to just use GitHub directly rather than having our own pipeline abstraction in SboxBuild.
This way we get nicer logging and error reporting, which we can\t achieve through GitHub API.
2026-06-19 13:49:41 +01:00

81 lines
1.6 KiB
C#

using System;
using System.IO;
using static Facepunch.Constants;
namespace Facepunch.Steps;
internal class BuildAddons
{
internal ExitCode Run()
{
try
{
string rootDir = Directory.GetCurrentDirectory();
string gameDir = Path.Combine( rootDir, "game" );
Log.Info( "Step 1: Generate solution" );
string sboxDevPath = Path.Combine( gameDir, "sbox-dev.exe" );
if ( !File.Exists( sboxDevPath ) )
{
Log.Error( $"Error: sbox-dev.exe not found at {sboxDevPath}" );
return ExitCode.Failure;
}
bool gameTestSuccess = Utility.RunProcess(
sboxDevPath,
"-generatesolution",
gameDir
);
if ( !gameTestSuccess )
{
Log.Error( "Solution generation failed!" );
return ExitCode.Failure;
}
Log.Info( "Step 2: Building Addons" );
bool addonsSuccess = Utility.RunDotnetCommand(
gameDir,
"build \"s&box.slnx\""
);
if ( !addonsSuccess )
{
Log.Error( "Addons build failed!" );
return ExitCode.Failure;
}
Log.Info( "Step 3: Building Menu" );
string menuBuildPath = Path.Combine( gameDir, "bin", "managed", "MenuBuild.exe" );
if ( !File.Exists( menuBuildPath ) )
{
Log.Error( $"Error: MenuBuild.exe not found at {menuBuildPath}" );
return ExitCode.Failure;
}
bool menuSuccess = Utility.RunProcess(
menuBuildPath,
"",
gameDir
);
if ( !menuSuccess )
{
Log.Error( "Menu build failed!" );
return ExitCode.Failure;
}
Log.Info( "Addons and Menu built successfully!" );
return ExitCode.Success;
}
catch ( Exception ex )
{
Log.Error( $"Build operations failed with error: {ex}" );
return ExitCode.Failure;
}
}
}