2using System.Diagnostics;
7using Nuke.Common.Utilities.Collections;
9using Nuke.Common.Tools.Git;
12using Nuke.Common.Utilities;
13using Nuke.Common.ProjectModel;
15using System.Runtime.InteropServices;
16using Nuke.Cola.Tooling;
17using Nuke.Common.Tooling;
38 | Opens Nuke.Unreal online documentation.
44 Process.Start(
new ProcessStartInfo
46 UseShellExecute =
true,
47 FileName =
"https://mcro.de/Nuke.Unreal"
57 public virtual Target
Info => _ => _
61 | Prints curated information about project
77 | Removes previous deployment folder
81 .Executes(() =>
GetOutput().DeleteDirectory());
93 | Removes auto generated folders of Unreal Engine from the project
109 | Removes auto generated folders of Unreal Engine from the plugins
116 void recurseBody(AbsolutePath path)
118 if (Glob.Files(path,
"*.uplugin", GlobOptions.CaseInsensitive).Any())
120 Log.Debug(
"Cleaning plugin {0}", path);
125 foreach (var dir
in Directory.EnumerateDirectories(path))
127 recurseBody((AbsolutePath)dir);
132 foreach (var pluginDir
in Directory.EnumerateDirectories(
PluginsFolder))
134 recurseBody((AbsolutePath)pluginDir);
144 public virtual Target
Clean => _ => _
148 | Removes auto generated folders of Unreal Engine
168 | Switch to an explicit Engine version
179 Log.Information($
"Targeting Unreal Engine {UnrealVersion} on platform {Platform}");
183 _projectDescriptor =
null;
184 _engineVersionCache =
null;
201 | Run necessary preparations which needs to be done before Unreal tools can handle
202 | the project. By default it is empty and the main build project may override it or
203 | other Targets can depend on it / hook into it.
223 | Generate project files for the default IDE of the current platform.
224 | You can specify further details with -->ubt argument block It is equivalent to
225 | right clicking the uproject and selecting "Generate _IDE_ project files
".
246 public virtual Target SetupPlatformSdk => _ => _
253 if (sdk.IsValid(
this))
255 Log.Information(
"Preparing SDK for {0}",
Platform);
260 Log.Error(
"An SDK for {0} cannot be prepared for current build",
Platform);
279 | Build the editor binaries so this project can be opened properly in the
299 "ShaderCompileWorker",
323 public virtual Target
Build => _ => _
327 | Build this project for execution
336 .DependsOn(SetupPlatformSdk)
346 .For(targets, (t, _) => _
370 var section =
ReadIniHierarchy(
"Game")[
"/Script/UnrealEd.ProjectPackagingSettings"];
371 return section !=
null && section
372 .GetFirst(
"ForDistribution",
new() { Value =
"" }).Value
373 .EqualsAnyOrdinalIgnoreCase(
"true",
"1");
389 public virtual Target
Cook => _ => _
393 | Cook Unreal assets for standalone game execution
397 | --AndroidTextureMode
413 .Clientconfig(config)
426 .If(isAndroidPlatform, _ => _
449 | Ensure support for plain C# build plugins without the need for CSX or dotnet
450 | projects. This only needs to be done once, you can check the results into
457 var project = ProjectModelTasks.ParseProject(BuildProjectFile);
458 project.SkipEvaluation =
true;
459 var compileItems = project.GetItems(
"Compile");
460 var pattern =
"../**/*.nuke.cs";
462 if (BuildProjectFile.ReadAllText().Contains(pattern))
463 Log.Debug(
"Build project already supports standalone C# build plugins.");
466 Log.Information(
"Preparing build project to accept standalone C# files. {0}, in {1}", pattern, BuildProjectFile);
467 project.AddItem(
"Compile", pattern);
469 Log.Information(
"This only needs to be done once, you can check the results into source control.");
504 | Simply run UAT with arguments passed after `-->`
506 | The following symbols are replaced by Nuke.Unreal:
507 | ~p : Project file path
508 | ~pdir : Project folder
509 | ~ue : Unreal Engine folder
512 | --IgnoreGlobalArgs (adv.)
516 .DependsOn(SetupPlatformSdk)
549 | Simply run UBT with arguments passed after `-->`
551 | The following symbols are replaced by Nuke.Unreal:
552 | ~p : Project file path
553 | ~pdir : Project folder
554 | ~ue : Unreal Engine folder
557 | --IgnoreGlobalArgs (adv.)
561 .DependsOn(SetupPlatformSdk)
583 | Start a UShell session. This opens a new console window, and nuke will exit
584 | immadiately. Working directory is the project folder, regardless of actual
589 .DependsOn(SetupPlatformSdk)
593 var scriptExt = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
"bat" :
"sh";
594 var ushellScript = ushellDir / (
"ushell." + scriptExt);
595 ProcessTasks.StartShell(
642 public virtual Target
Run => _ => _
646 | Run an Unreal tool from the engine binaries folder. You can omit the `Unreal`
647 | prefix and the extension. For example:
649 | nuke run --tool pak --> ./Path/To/MyProject.pak -Extract "D:/temp
"
650 | nuke run --tool editor-cmd --> ~p -run=MyCommandlet
652 | Working directory is the project folder, regardless of actual working
655 | The following symbols are replaced by Nuke.Unreal:
656 | ~p : Project file path
657 | ~pdir : Project folder
658 | ~ue : Unreal Engine folder
665 .Requires(() =>
Tool)
705 | Run an editor commandlet with arguments passed in after -->
707 | The following symbols are replaced by Nuke.Unreal:
708 | ~p : Project file path
709 | ~pdir : Project folder
710 | ~ue : Unreal Engine folder
723 .Prepend($
"{ProjectPath} -run={Cmd}")
The main build class Unreal projects using Nuke.Unreal should inherit from. This class contains all b...
virtual Target HelpNukeUnreal
virtual Target CleanDeployment
virtual Target BuildEditor
AbsolutePath ProjectFolder
Path to folder containing the .project file.
virtual IEnumerable< string > GetArgumentBlock(string name="")
Get optionally named argument block (section after -->) with contextual data substituted....
virtual Target RunEditorCmd
virtual AbsolutePath ProjectPath
string ProjectName
Short name of the project.
ProjectDescriptor ProjectDescriptor
"Immutable" C# representation of the .uproject contents
AbsolutePath UnrealEnginePath
Path to the root of the associated Unreal Engine installation/source.
virtual UbtConfig UbtGlobal(UbtConfig _)
UBT arguments to be applied globally for all UBT invocations. Override this function in your main bui...
virtual Target CleanProject
virtual UatConfig UatCook(UatConfig _)
UAT arguments to be applied every time UAT is called for Cooking. Override this function in your main...
virtual AbsolutePath GetOutput()
Get an output folder where the targets should store their artifacts. Override this function in your m...
virtual UnrealConfig[] Config
virtual UnrealConfig[] EditorConfig
virtual Target CleanPlugins
virtual ? string UnrealVersion
virtual bool ForDistribution()
Enforce packaging for distribution when that is set from Game ini files. Override this function in yo...
AbsolutePath PluginsFolder
Path to the Unreal plugins folder of this project.
ConfigIni ReadIniHierarchy(string shortName, IniHierarchyLevel lowestLevel=IniHierarchyLevel.Base, IniHierarchyLevel highestLevel=IniHierarchyLevel.Saved, bool considerPlugins=true, IEnumerable< string >? extraConfigSubfolder=null)
Read INI configuration emulating the same hierarchy of importance as Unreal Engine also does.
virtual void PrintInfo()
Print some rudimentary information onto console about this project and it's environment....
virtual Target EnsureBuildPluginSupport
virtual AndroidCookFlavor[] AndroidTextureMode
virtual UnrealPlatform Platform
virtual UatConfig UatGlobal(UatConfig _)
UAT arguments to be applied globally for all UAT invocations. Override this function in your main bui...
Build configurations UBT supports.
The regular target types UBT supports.
static readonly UnrealTargetType Editor
Editor builds for the project.
static readonly UnrealTargetType Game
Can act as both client and server.
A collection of utilities around basic functions regarding the environment of the Engine we're workin...
static void WriteJson(object input, AbsolutePath path)
Write data in JSON with Unreal conventions of JSON format.
static ToolEx AutomationTool(EngineVersion ofVersion)
Prepare invocation for UAT.
static ToolEx GetTool(IUnrealBuild build, string name)
Get a native binary tool from Engine/Binaries folder. Unreal tools written in C# or stored in other f...
static UnrealPlatformFlag GetHostPlatformFlag()
Get the current development platform flag Nuke.Unreal is ran on.
static ToolEx BuildTool(EngineVersion ofVersion)
Prepare invocation for UBT.
static void InvalidateEnginePathCache()
In the rare and unlikely case that the Engine location may have changed during one session.
static bool IsSource(AbsolutePath enginePath)
Is given path an engine built from source?
static void ClearFolder(AbsolutePath folder)
Clear intermediate folders of Unreal from a given folder.
Base interface for build components which require an UnrealBuild main class.