2using System.Collections.Generic;
8using Nuke.Common.Utilities;
9using Nuke.Common.Utilities.Collections;
34[DisableDefaultOutput(DefaultOutput.ErrorsAndWarnings)]
37 protected override void OnBuildCreated()
39 base.OnBuildCreated();
54 [Parameter(
Name =
"unreal")]
139 .If(!ubtArgs.IsEmpty(), _ => _.
UbtArgs(ubtArgs.JoinSpace()));
150 if (_engineVersionCache ==
null)
153 Assert.NotNull(versionString,
"Unreal Engine version couldn't be determined");
154 _engineVersionCache =
new(versionString!);
156 return _engineVersionCache!;
172 Log.Information(
"Project name: {0}",
ProjectPath.NameWithoutExtension);
173 Log.Information(
"Unreal version: {0}", unrealVersion.VersionName);
174 Log.Information(
"Unreal full version: {0}", unrealVersion.VersionPatch);
176 Log.Information(
"Output folder: {0}",
GetOutput());
189 => Arguments.GetBlock(name)
194 .DoubleQuoteIfNeeded()
223 bool considerPlugins =
true,
224 IEnumerable<string>? extraConfigSubfolder =
null
227 extraConfigSubfolder = (extraConfigSubfolder ?? Enumerable.Empty<
string>())
230 IReadOnlyCollection<AbsolutePath> GlobIni(AbsolutePath folder)
232 return folder.GlobFiles($
"{shortName}.ini", $
"*{shortName}.ini");
235 void MergeInis(AbsolutePath folder,
ConfigIni result)
237 if (folder.DirectoryExists())
238 foreach (var iniFile
in GlobIni(folder))
242 result.
Merge(currIni);
246 void GatherInis(AbsolutePath configFolder,
ConfigIni result)
248 MergeInis(configFolder, resultIni);
249 foreach (var folder
in extraConfigSubfolder.Select(s => configFolder / s))
251 if (folder.DirectoryExists())
252 MergeInis(folder, resultIni);
256 if (lowestLevel <= IniHierarchyLevel.Base && highestLevel >=
IniHierarchyLevel.Base)
259 var baseIni =
ConfigIni.
Parse(File.ReadAllText(configFolder /
"Base.ini"));
261 resultIni.
Merge(baseIni);
263 GatherInis(configFolder, resultIni);
266 if (lowestLevel <= IniHierarchyLevel.Default && highestLevel >=
IniHierarchyLevel.Default)
269 GatherInis(configFolder, resultIni);
271 if (lowestLevel <= IniHierarchyLevel.Default && highestLevel >=
IniHierarchyLevel.Default && considerPlugins)
273 foreach (var pluginConfigFolder
in (
ProjectFolder /
"Plugins").GlobDirectories(
"**/Config"))
275 GatherInis(pluginConfigFolder, resultIni);
278 if (lowestLevel <= IniHierarchyLevel.Saved && highestLevel >=
IniHierarchyLevel.Saved)
281 GatherInis(configFolder, resultIni);
High level representation of an Unreal Engine version.
The root class representing Unreal INI configuration.
void Merge(ConfigIni from)
Compose another ConfigIni instance into this one, overriding existing values and adding new ones.
static ? ConfigIni Parse(string? input)
Parse an Unreal configuration text into a ConfigIni.
The main build class Unreal projects using Nuke.Unreal should inherit from. This class contains all b...
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 AbsolutePath ProjectPath
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 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
EngineVersion GetEngineVersionFromProject()
Utility function to get the proper Engine version associated with current project....
virtual ? string UnrealVersion
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 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 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 UnrealPlatformFlag GetHostPlatformFlag()
Get the current development platform flag Nuke.Unreal is ran on.
static AbsolutePath GetEnginePath(string engineAssociation, bool ignoreCache=false)
Get the Unreal Engine path based on an input association text. (version, GUID or absolute path)
Base interface for build components which require an UnrealBuild main class.
IniHierarchyLevel
Indicating the INI config hierarchy importance, from least important to most important (in terms of w...