/Documentation/Patch Builder/Build Pipeline Script Examples

Build Pipeline Script Examples

In this section, we will attempt to show you how you can use many different ways to integrate the patch builder application into your build pipeline.

📝 Script Examples
Scenario 1: The “Standard” Pipeline (Upload to servers)

Use this script to scan your game folder, build the patch, and upload it to your LaunchBoost servers automatically.

PowerShell (build_patch.ps1)

Note for Newbies: In PowerShell, the backtick (`) allows a command to continue on the next line. Make sure there is no space after the backtick!

Plain Text
# 1. Define your paths and credentials
$BuilderExe = "C:\Tools\LaunchBoost\patch-builder.exe"
$GameFiles = "C:\Users\Dev\Documents\Unreal Projects\MyGame\Build\Windows"
$ApiKey = "lb_live_xxxxxxxxxxxxxxxxx"
$Slug = "my-awesome-game"
$NewVersion = "1.0.4"

# 2. Run the Builder
Write-Host "🚀 Starting LaunchBoost Patch Process..."& $BuilderExe -automation `
-apiKey $ApiKey `
-projectSlug $Slug `
-inputDirectory $GameFiles `
-versionNumber $NewVersion

# 3. Check Success
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ Patch Deployed Successfully!" -ForegroundColor Green
} else {
Write-Host "❌ Build Failed. Check logs for details." -ForegroundColor Red
exit 1
}
Scenario 2: Local Test Build (No Upload)

Use this if you want to generate the patch files to inspect them locally before pushing to the public.

Plain Text
.\patch-builder.exe -automation `
-apiKey "lb_live_..." `
-projectSlug "my-game" `
-inputDirectory "C:\Game\Build" `
-versionNumber "1.0.5" `
-outputDirectory "C:\Users\Dev\Desktop\TestPatchOutput" `
-upload=false
Code Examples

Here are the integration examples for C++, C#, Java, and Batch. These scripts demonstrate how to programmatically trigger the LaunchBoost Patch Builder from your own tools or game engines.

1. C++ Example (Windows API)

This is commonly used if you are building a custom tool chain in C++ or integrating directly into a game engine editor (like Unreal Engine source).

C++
#include <windows.h>
#include <iostream>
#include <string>int main() {
// 1. Configuration
std::string builderPath = "C:\\Tools\\patch-builder.exe";
std::string apiKey = "lb_live_your_api_key_here";
std::string slug = "my-game-project";
std::string inputDir = "C:\\Builds\\Shipping\\Win64";
std::string version = "1.0.5";

// 2. Build the Command Line
// Note: The first argument in lpCommandLine must be the executable itself
std::string cmdArgs = "\"" + builderPath + "\" -automation"
+ " -apiKey \"" + apiKey + "\""
+ " -projectSlug \"" + slug + "\""
+ " -inputDirectory \"" + inputDir + "\""
+ " -versionNumber \"" + version + "\"";

// 3. Setup Windows Process Structures
STARTUPINFOA si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));std::cout << "🚀 Launching Patch Builder..." << std::endl;

// 4. Create the Process
// We use const_cast because CreateProcess can modify the command string in-place
if (!CreateProcessA(NULL, const_cast<char*>(cmdArgs.c_str()), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
std::cerr << "❌ Failed to launch process. Error: " << GetLastError() << std::endl;
return 1;
}

// 5. Wait for it to finish
WaitForSingleObject(pi.hProcess, INFINITE);

// 6. Check Exit Code
DWORD exitCode = 0;
GetExitCodeProcess(pi.hProcess, &exitCode);CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);if (exitCode == 0) {
std::cout << "✅ Patch built and uploaded successfully!" << std::endl;
return 0;
} else {
std::cerr << "❌ Builder failed with exit code: " << exitCode << std::endl;
return 1;
}
}
2. C# Example (.NET / Unity Tools)

This is perfect for building custom editor tools in Unity or standalone C# build/launcher applications.

C#
using System;
using System.Diagnostics;

class Program
{
static void Main(string[] args)
{
// 1. Configuration
string builderPath = @"C:\Tools\patch-builder.exe";
string apiKey = "lb_live_your_api_key_here";
string slug = "my-game-project";
string inputDir = @"C:\Builds\Shipping\Win64";
string version = "1.0.5";// 2. Setup Process Info
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = builderPath,
// Format arguments exactly as they appear in CLI
Arguments = $"-automation -apiKey \"{apiKey}\" -projectSlug \"{slug}\" -inputDirectory \"{inputDir}\" -versionNumber \"{version}\"",
UseShellExecute = false, // Required to capture output if needed
RedirectStandardOutput = true,
CreateNoWindow = true // Keep it headless
};try
{
Console.WriteLine("🚀 Starting Patch Builder...");

// 3. Start the Process
using (Process exeProcess = Process.Start(startInfo))
{
// Optional: Read standard output
string output = exeProcess.StandardOutput.ReadToEnd();
Console.WriteLine(output);exeProcess.WaitForExit();// 4. Check Result
if (exeProcess.ExitCode == 0)
{
Console.WriteLine("✅ Patch Deployed Successfully!");
}
else
{
Console.WriteLine($"❌ Error: Builder exited with code {exeProcess.ExitCode}");
// You would check %APPDATA%/LaunchBoost/session-log.txt here for details
}
}
}
catch (Exception ex)
{
Console.WriteLine($"❌ Critical Error: {ex.Message}");
}
}
}
3. Java Example (Jenkins / TeamCity)

If you run your build pipeline on a Jenkins agent or use Java-based tools.

JavaScript
import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class PatchBuilderPipeline {public static void main(String[] args) {


// 1. Configuration
String builderPath = "C:\\Tools\\patch-builder.exe";
String apiKey = "lb_live_your_api_key_here";
String slug = "my-game-project";
String inputDir = "C:\\Builds\\Shipping\\Win64";
String version = "1.0.5";

// 2. Build Argument List
List<String> commands = new ArrayList<>();
commands.add(builderPath);
commands.add("-automation");
commands.add("-apiKey");
commands.add(apiKey);
commands.add("-projectSlug");
commands.add(slug);
commands.add("-inputDirectory");
commands.add(inputDir);
commands.add("-versionNumber");
commands.add(version);try {
System.out.println("🚀 Launching Patch Builder...");

// 3. Setup ProcessBuilder
ProcessBuilder pb = new ProcessBuilder(commands);
pb.inheritIO(); // Pipes the output to your Java console

// 4. Run and Wait
Process process = pb.start();
int exitCode = process.waitFor();

// 5. Check Result
if (exitCode == 0) {
System.out.println("✅ Patch Deployed Successfully!");
} else {
System.err.println("❌ Builder failed with exit code: " + exitCode);
System.exit(1);
}} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
4. Batch File Example (.bat)

The simplest method. Useful for quick desktop shortcuts or simple scheduled tasks.

Plain Text
@echo off
SETLOCAL

:: 1. Configuration
set BUILDER="C:\Tools\patch-builder.exe"
set API_KEY="lb_live_your_api_key_here"
set SLUG="my-game-project"
set INPUT_DIR="C:\Builds\Shipping\Win64"
set VERSION="1.0.5"

echo ------------------------------------------
echo 🚀 Launching LaunchBoost Automation...
echo ------------------------------------------

:: 2. Execution
:: %* allows you to pass extra flags if needed when calling this script
%BUILDER% -automation ^
-apiKey %API_KEY% ^
-projectSlug %SLUG% ^
-inputDirectory %INPUT_DIR% ^
-versionNumber %VERSION%

:: 3. Error Checking
if %ERRORLEVEL% EQU 0 (
echo.
echo ✅ SUCCESS: Patch has been built and uploaded.
exit /b 0
) else (
echo.
echo ❌ FAILURE: Process ended with Exit Code %ERRORLEVEL%
echo Please check %%APPDATA%%\LaunchBoost\session-log.txt for details.
exit /b 1
)