├── .gitmodules ├── BuildGraph ├── BuildEngine.xml ├── BuildProject.xml └── ProjectVariables.xml ├── Gauntlet ├── DeployBuild.cs ├── Devices.json └── README.md ├── Misc ├── BuildPlugin.ps1 └── README.md └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Perforce"] 2 | path = Perforce 3 | url = https://github.com/jackknobel/P4Scripts 4 | [submodule "JenkinsLibrary"] 5 | path = JenkinsLibrary 6 | url = https://github.com/jackknobel/JenkinsLibrary 7 | -------------------------------------------------------------------------------- /BuildGraph/BuildEngine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 55 | -------------------------------------------------------------------------------- /BuildGraph/BuildProject.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 162 | -------------------------------------------------------------------------------- /BuildGraph/ProjectVariables.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 17 | 18 | 28 | -------------------------------------------------------------------------------- /Gauntlet/DeployBuild.cs: -------------------------------------------------------------------------------- 1 | using AutomationTool; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using UnrealBuildTool; 7 | 8 | namespace Gauntlet.Examples 9 | { 10 | [Help("Uses Gauntlet classes to install a build on one or more devices")] 11 | [Help("project=", "The path to your game's .uproject file")] 12 | [Help("devices= or devices=", "Devices to install on. If empty uses the default device for this machine")] 13 | [Help("platform=", "Platform for these builds and devices")] 14 | [Help("configuration=", "Configuration to install/launch. Defaults to development")] 15 | [Help("build=", "Path to a folder with a build, or a folder that contains platform folders with builds in (e.g. /Saved/StagedBuilds)")] 16 | [Help("cmdline=", "Additional command line arguments to pass to build for when it next launches")] 17 | public class DeployBuild : BuildCommand 18 | { 19 | [AutoParam("")] 20 | public string Project; 21 | 22 | [AutoParamWithNames("", "device", "devices")] 23 | public string Devices = ""; 24 | 25 | [AutoParam("")] 26 | public string Platform; 27 | 28 | [AutoParam("Development")] 29 | public string Configuration; 30 | 31 | [AutoParam("")] 32 | public string Build; 33 | 34 | [AutoParamWithNames("", "cmdline", "commandline")] 35 | public string Commandline = ""; 36 | 37 | public override ExitCode Execute() 38 | { 39 | Log.Level = Gauntlet.LogLevel.VeryVerbose; 40 | 41 | AutoParam.ApplyParamsAndDefaults(this, Environment.GetCommandLineArgs()); 42 | 43 | // Fix up any pathing issues (some implementations don't like backslashes i.e. xbox) 44 | Project = Path.GetFileNameWithoutExtension(Project.Replace(@"\", "/")); 45 | Build = Build.Replace(@"\", "/"); 46 | 47 | UnrealTargetPlatform ParsedPlatform = UnrealTargetPlatform.Parse(Platform); 48 | UnrealTargetConfiguration ParseConfiguration = (UnrealTargetConfiguration)Enum.Parse(typeof(UnrealTargetConfiguration), Configuration, true); 49 | 50 | DevicePool.Instance.AddDevices(ParsedPlatform, Devices, false); 51 | 52 | // Find sources for this platform (note some platforms have multiple sources for staged builds, packaged builds etc) 53 | IEnumerable BuildSources = Gauntlet.Utils.InterfaceHelpers.FindImplementations().Where(BuildSource => BuildSource.CanSupportPlatform(ParsedPlatform)); 54 | 55 | // Find first build at the specified path that match the config 56 | IBuild FoundBuild = null; 57 | foreach (IBuild Build in BuildSources.SelectMany(BuildSource => BuildSource.GetBuildsAtPath(Project, Build))) 58 | { 59 | Log.Info("Found Build for {0} with config {1}", Build.Platform, Build.Configuration.ToString()); 60 | 61 | if(Build.Configuration == ParseConfiguration) 62 | { 63 | FoundBuild = Build; 64 | break; 65 | } 66 | } 67 | 68 | if (FoundBuild == null) 69 | { 70 | throw new AutomationException("No builds for platform {0} found at {1} matching configuration {2}", Platform, Build, ParseConfiguration); 71 | } 72 | 73 | UnrealAppConfig Config = new UnrealAppConfig(); 74 | Config.Build = FoundBuild; 75 | Config.ProjectName = Project; 76 | Config.Configuration = ParseConfiguration; 77 | Config.CommandLine = Commandline; 78 | 79 | List AcquiredDevices = new List(); 80 | 81 | /* This seems redundant but it's the only way to grab the devices at this stage 82 | * Todo: This will only pass in devices that are powered on, find a way to grab off devices and power them on 83 | */ 84 | Log.Info("Enumerating Devices!"); 85 | DevicePool.Instance.EnumerateDevices(ParsedPlatform, Device => 86 | { 87 | if(!AcquiredDevices.Contains(Device)) 88 | { 89 | AcquiredDevices.Add(Device); 90 | } 91 | return true; 92 | }); 93 | 94 | if(AcquiredDevices.Count == 0) 95 | { 96 | Log.Error("Failed to find any valid devices!"); 97 | return ExitCode.Error_AppInstallFailed; 98 | } 99 | 100 | Log.Info("Beginning Installation to {0} devices!", AcquiredDevices.Count); 101 | 102 | // Reserve our devices so nothing else can use them 103 | DevicePool.Instance.ReserveDevices(AcquiredDevices); 104 | 105 | foreach (ITargetDevice Device in AcquiredDevices) 106 | { 107 | if (!Device.IsAvailable) 108 | { 109 | Log.Info("{0} is not available, skipping", Device.Name); 110 | continue; 111 | } 112 | 113 | if (!Device.IsOn) 114 | { 115 | Log.Info("Powering on {0}", Device); 116 | Device.PowerOn(); 117 | } 118 | else if (Globals.Params.ParseParam("reboot")) 119 | { 120 | Log.Info("Rebooting {0}", Device); 121 | Device.Reboot(); 122 | } 123 | 124 | if (!Device.Connect()) 125 | { 126 | Log.Warning("Failed to connect to {0}", Device.Name); 127 | continue; 128 | } 129 | 130 | Log.Info("Installing {0} to {1}", Config.Build.ToString(), Device.Name); 131 | try 132 | { 133 | Device.InstallApplication(Config); 134 | } 135 | catch(AutomationException error) 136 | { 137 | Log.Error("Failed to install to {0} due to: {1}", Device.Name, error.ToString()); 138 | } 139 | 140 | Log.Info("Disconnecting from {0}", Device.Name); 141 | Device.Disconnect(); 142 | } 143 | 144 | // Release our saved devices 145 | DevicePool.Instance.ReleaseDevices(AcquiredDevices); 146 | 147 | return ExitCode.Success; 148 | } 149 | 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /Gauntlet/Devices.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_comment": "** This file is read by build machines, please VALIDATE changes before saving! ** ", 4 | "Name": "My-PC", 5 | "Type": "Win64", 6 | "Address": "10.1.1.112" 7 | }, 8 | { 9 | "Name": "TV 4K", 10 | "Type": "TVOS", 11 | "Address": "", 12 | "Available": "Disabled" 13 | }, 14 | { 15 | "Name": "My iPad", 16 | "Type": "IOS", 17 | "Address": "" 18 | }, 19 | { 20 | "_comment": "An Example Device, doesn't actually exist ", 21 | "Name": "ExampleDevKit", 22 | "Type": "PS4", 23 | "Address": "10.1.201.229", 24 | "Available": "20:00-08:00" 25 | }, 26 | { 27 | "_comment": "An Example Device, doesn't actually exist ", 28 | "Name": "ExampleDevKit2", 29 | "Type": "PS4", 30 | "Address": "10.1.201.220", 31 | "Available": "Disabled" 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /Gauntlet/README.md: -------------------------------------------------------------------------------- 1 | # Gauntlet Scripts 2 | Before running these scripts it's important you have created an Automation Project for your game, as these scripts will belong in there. You can follow a guide on how to do that here: 3 | 4 | 5 | 6 | 7 | #### Deploy Build 8 | 9 | Call by: 10 | RunUAT DeployBuild 11 | 12 | With Arguments: 13 | -project: The path to your game's .uproject file 14 | -devices: Devices to install on; or devices= 15 | -platform: Platform for these builds and devices 16 | -configuration: Configuration to install/launch. Defaults to development 17 | -build: Path to a folder with a build, or a folder that contains platform folders with builds in (e.g. /Saved/StagedBuilds) 18 | -cmdline: Additional command line arguments to pass to build for when it next launches 19 | 20 | 21 | #### Devices.json File 22 | 23 | Example devices.json file that can be used with gauntlet to declare a bunch of devices rather then having to manually pass them over the commandline. -------------------------------------------------------------------------------- /Misc/BuildPlugin.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jackknobel/UnrealBuildScripts/e90a418fff4563957bef5291dc5d6d0cf8ff7496/Misc/BuildPlugin.ps1 -------------------------------------------------------------------------------- /Misc/README.md: -------------------------------------------------------------------------------- 1 | # Misc Scripts 2 | Random stuff I've written to help various workflows 3 | 4 | 5 | 6 | #### BuildPlugin (Powershell) 7 | 8 | Will find all installed versions of UE4, package a given plugin and has an option to zip the result. 9 | 10 | Call by: 11 | .\\BuildPlugin.ps1 12 | 13 | With Arguments: 14 | [Required] -PluginPath: The path to your plugin's .uplugin file 15 | [Required] -OutputDir: The directory we want to output this plugin too 16 | (Note the *Actual* output will be OutputDir/EngineVersion/PluginName) for easier identification and drag + dropping. 17 | -Zip: Do we want to zip up the result (will output to the $OutputDir) 18 | -VersionString: Version String to append to the front of the zip file 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unreal Build Scripts 2 | Scripts I've found useful when developing in UE4 3 | 4 | 5 | 6 | ## Build Graph 7 | 8 | [BuildGraph](https://docs.unrealengine.com/latest/INT/Programming/Development/BuildGraph/) scripts used for testing and building a UE4 project. If you are a familiar with BuildGraph then these should be pretty straightforward to use. If you are not, I would recommend taking a geeze (look) through the documentation or read the article I have written [here](http://jackknobel.com/How-To/BuildGraph). 9 | 10 | Example Usage to Package for Win64 11 | 12 | `RunUAT.bat BuildGraph -script="\BuildProject.xml" -target="Package Game Win64" -set:ProjectName=-Set:ProjectDir="" -Set:BuildConfig=Development -Set:OutputDir=""` 13 | 14 | Additionally you can use the ProjectVariables.xml to set some defaults instead of having to explicitly pass them. 15 | 16 | ## Gauntlet 17 | 18 | Gauntlet commands or scripts that can be useful during development 19 | 20 | 21 | ## Jenkins 22 | 23 | Jenkins library used to make invoking UE4 compilation and packaging easier e.g. 24 | `UE4.CompileProject(params.BuildConfig as unreal.BuildConfiguration)` 25 | 26 | See readme in sub folder for more info. 27 | 28 | ## Misc 29 | 30 | Misc scripts I've written to help various workflows 31 | 32 | ## Perforce 33 | 34 | Perforce scripts to help with some more obtuse perforce issues like reapplying a typemap to existing files or setting local perforce variables. 35 | --------------------------------------------------------------------------------