mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-07 13:58:25 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using static Facepunch.Constants;
|
|
|
|
namespace Facepunch.Steps;
|
|
|
|
internal class BuildAddons( string name ) : Step( name )
|
|
{
|
|
protected override ExitCode RunInternal()
|
|
{
|
|
try
|
|
{
|
|
string rootDir = Directory.GetCurrentDirectory();
|
|
string gameDir = Path.Combine( rootDir, "game" );
|
|
|
|
Log.Info( "Step 1: Building Addons" );
|
|
|
|
bool addonsSuccess = Utility.RunDotnetCommand(
|
|
gameDir,
|
|
"build \"s&box.slnx\""
|
|
);
|
|
|
|
if ( !addonsSuccess )
|
|
{
|
|
Log.Error( "Addons build failed!" );
|
|
return ExitCode.Failure;
|
|
}
|
|
|
|
Log.Info( "Step 2: 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;
|
|
}
|
|
}
|
|
}
|