Nuke.Unreal
Build Unreal apps in Style.
Loading...
Searching...
No Matches
IUnrealBuild.cs
1using System.Collections.Generic;
2using Nuke.Common;
3using Nuke.Common.IO;
7
8namespace Nuke.Unreal;
9
10/// <summary>
11/// Base interface for build components which require an UnrealBuild main class.
12/// </summary>
13public interface IUnrealBuild : INukeBuild
14{
15 //////// GENERAL PARAMETERS ////////
16
17 /// <summary>
18 /// Get an output folder where the targets should store their artifacts. Override this
19 /// function in your main build class to enforce your own.
20 /// </summary>
21 AbsolutePath GetOutput();
22
23 /// <summary>
24 /// <para>
25 /// **NUKE PARAMETER**
26 /// </para>
27 /// Set platform for running targets
28 /// </summary>
30
31 /// <summary>
32 /// <para>
33 /// **NUKE PARAMETER**
34 /// </para>
35 /// The target configuration for building or packaging the project
36 /// </summary>
38
39 /// <summary>
40 /// <para>
41 /// **NUKE PARAMETER**
42 /// </para>
43 /// The editor configuration to be used while building or packaging the project
44 /// </summary>
46
47 /// <summary>
48 /// <para>
49 /// **NUKE PARAMETER**
50 /// </para>
51 /// The Unreal target type for building the project
52 /// </summary>
54
55 /// <summary>
56 /// <para>
57 /// **NUKE PARAMETER**
58 /// </para>
59 /// Select texture compression mode for Android
60 /// </summary>
62
63 /// <summary>
64 /// UBT arguments to be applied globally for all UBT invocations. Override this function
65 /// in your main build class if your project needs extra intricacies for everything what
66 /// UBT may do through Nuke.Unreal.
67 ///
68 /// These arguments are also propagated to all UAT invocations through its `-UbtArgs`
69 /// </summary>
71
72 /// <summary>
73 /// UAT arguments to be applied globally for all UAT invocations. Override this function
74 /// in your main build class if your project needs extra intricacies for everything what
75 /// UAT may do through Nuke.Unreal.
76 /// </summary>
78
79 /// <summary>
80 /// Utility function to get the proper Engine version associated with current project.
81 /// Rather use `Unreal.Version` static function, that looks nicer.
82 /// </summary>
84
85 /// <summary>
86 /// Path to the root of the associated Unreal Engine installation/source
87 /// </summary>
88 AbsolutePath UnrealEnginePath { get; }
89
90 /// <summary>
91 /// Get optionally named argument block (section after `-->`) with contextual data
92 /// substituted.
93 /// <list type="bullet">
94 /// <item>`~p` Project file path</item>
95 /// <item>`~pdir` Project folder</item>
96 /// <item>`~ue` Unreal Engine folder</item>
97 /// </list>
98 /// </summary>
99 IEnumerable<string> GetArgumentBlock(string name = "");
100
101 /// <summary>
102 /// Read INI configuration emulating the same hierarchy of importance as Unreal Engine
103 /// also does.
104 /// </summary>
105 /// <param name="shortName">The name of the configuration like `Game` or `Engine`</param>
106 /// <param name="lowestLevel">
107 /// The least important level of hierarchy for reading this config.
108 /// Default is `Base`
109 /// </param>
110 /// <param name="highestLevel">
111 /// The maximum important level of hierarchy for reading this config
112 /// Default is `Saved`
113 /// </param>
114 /// <param name="considerPlugins">
115 /// If true also consider config files found in plugins.
116 /// Default if true.
117 /// </param>
118 /// <param name="extraConfigSubfolder">
119 /// Manually add extra configuration subfolders which may be outside of the normal
120 /// sources of config files.
121 /// </param>
122 /// <returns>The parsed contents of the indicated config name</returns>
124 string shortName,
125 IniHierarchyLevel lowestLevel = IniHierarchyLevel.Base,
126 IniHierarchyLevel highestLevel = IniHierarchyLevel.Saved,
127 bool considerPlugins = true,
128 IEnumerable<string>? extraConfigSubfolder = null
129 );
130
131 //////// PROJECT PARAMETERS ////////
132
133 /// <summary>
134 /// <para>
135 /// Optionally specify a path to a `.uproject` file.
136 /// </para>
137 /// <para>
138 /// If not overridden Nuke.Unreal will traverse upwards on the directory tree,
139 /// then sift through all subdirectories recursively (ignoring some known folders)
140 /// </para>
141 /// </summary>
142 AbsolutePath ProjectPath { get; }
143
144 /// <summary>
145 /// Path to folder containing the `.project` file
146 /// </summary>
147 AbsolutePath ProjectFolder { get; }
148
149 /// <summary>
150 /// Path to the Unreal plugins folder of this project
151 /// </summary>
152 AbsolutePath PluginsFolder { get; }
153
154 /// <summary>
155 /// Short name of the project
156 /// </summary>
157 string ProjectName { get; }
158
159 /// <summary>
160 /// "Immutable" C# representation of the `.uproject` contents
161 /// </summary>
163
164 /// <summary>
165 /// UAT arguments to be applied every time UAT is called for Cooking. Override this function
166 /// in your main build class if your project needs extra intricacies for Cooking.
167 /// For example specifying maps explicitly.
168 /// </summary>
170
171 /// <summary>
172 /// Enforce packaging for distribution when that is set from `Game` ini files.
173 /// Override this function in your main build class if you want a different logic set for
174 /// flagging packages for distribution.
175 /// </summary>
177
178 //////// BOILERPLATE PARAMETERS ////////
179
180 /// <summary>
181 /// <para>
182 /// **NUKE PARAMETER**
183 /// </para>
184 /// Specify a folder containing generator specific folders for Scriban scaffolding and templates. If left empty
185 /// the templates coming with Nuke.Unreal will be used.
186 /// </summary>
187 AbsolutePath TemplatesPath { get; }
188
189 /// <summary>
190 /// <para>
191 /// **NUKE PARAMETER**
192 /// </para>
193 /// Name parameter for boilerplate generators.
194 /// </summary>
195 string[] Name { get; }
196
197 /// <summary>
198 /// <para>
199 /// **NUKE PARAMETER**
200 /// </para>
201 /// <para>
202 /// Specification(s) of the imported library(ies). This is used slightly differently based on which library
203 /// type is being used:
204 /// </para>
205 /// <para>
206 /// Header / CMake: It's only the name of the library (like `\--Spec spdlog`)
207 /// </para>
208 /// <para>
209 /// XRepo: specify the xrepo package reference and its config separated by space. For example:
210 /// </para>
211 /// <code>
212 /// \--Spec "zlib"
213 /// \--Spec "zlib 1.2.x"
214 /// \--Spec "boost regex=true,thread=true"
215 /// \--Spec "imgui 1.91.1 freetype=true"
216 /// </code>
217 /// <para>
218 /// Or multiple libraries at once
219 /// </para>
220 /// <code>
221 /// \--Spec "zlib 1.2.x" "boost regex=true,thread=true" "imgui 1.91.1 freetype=true"
222 /// </code>
223 /// <para>
224 /// More about xrepo: https://xrepo.xmake.io
225 /// </para>
226 /// </summary>
227 /// <remarks>
228 /// Since Unreal uses MD runtime linkage `runtimes='MD'` config is always appended by Nuke.Unreal, and the
229 /// user must not specify it.
230 /// </remarks>
231 string[] Spec { get; }
232
233 //////// GENERAL TARGETS ////////
234
235 /// <summary>
236 /// <para>
237 /// **NUKE TARGET**
238 /// </para>
239 /// Opens the Nuke.Unreal online documentation
240 /// </summary>
241 Target HelpNukeUnreal { get; }
242
243 /// <summary>
244 /// <para>
245 /// **NUKE TARGET**
246 /// </para>
247 /// Prints curated information about project
248 /// </summary>
249 Target Info { get; }
250
251 /// <summary>
252 /// <para>
253 /// **NUKE TARGET**
254 /// </para>
255 /// Removes previous deployment folder
256 /// </summary>
257 Target CleanDeployment { get; }
258
259 /// <summary>
260 /// <para>
261 /// **NUKE TARGET**
262 /// </para>
263 /// Removes auto generated folders of Unreal Engine from the project
264 /// </summary>
265 Target CleanProject { get; }
266
267 /// <summary>
268 /// <para>
269 /// **NUKE TARGET**
270 /// </para>
271 /// Removes auto generated folders of Unreal Engine from the plugins
272 /// </summary>
273 Target CleanPlugins { get; }
274
275 /// <summary>
276 /// <para>
277 /// **NUKE TARGET**
278 /// </para>
279 /// Removes auto generated folders of Unreal Engine
280 /// </summary>
281 Target Clean { get; }
282
283 /// <summary>
284 /// <para>
285 /// **NUKE TARGET**
286 /// </para>
287 /// Switch to an explicit Engine version
288 /// <code>
289 /// \--unreal (req.)
290 /// </code>
291 /// </summary>
292 Target Switch { get; }
293
294 /// <summary>
295 /// <para>
296 /// **NUKE TARGET**
297 /// </para>
298 /// <para>
299 /// Run necessary preparations which needs to be done before Unreal tools can handle
300 /// the project. By default it is empty and the main build project may override it or
301 /// other Targets can depend on it / hook into it.
302 /// </para>
303 /// </summary>
304 Target Prepare { get; }
305
306 /// <summary>
307 /// <para>
308 /// **NUKE TARGET**
309 /// </para>
310 /// Generate project files for the default IDE of the current platform. You can specify further details with
311 /// `-->ubt` argument block. It is equivalent to right clicking the uproject and selecting "Generate _IDE_
312 /// project files".
313 /// <code>
314 /// \-->ubt (args.)
315 /// </code>
316 /// </summary>
317 Target Generate { get; }
318
319 Target SetupPlatformSdk { get; }
320
321 /// <summary>
322 /// <para>
323 /// **NUKE TARGET**
324 /// </para>
325 /// Build the editor binaries so this project can be opened properly in the Unreal editor
326 /// <code>
327 /// \--EditorConfig
328 /// \-->ubt (args.)
329 /// </code>
330 /// </summary>
331 Target BuildEditor { get; }
332
333 /// <summary>
334 /// <para>
335 /// **NUKE TARGET**
336 /// </para>
337 /// Build this project for execution
338 /// <code>
339 /// \--TargetType
340 /// \--Config
341 /// \--Platform
342 /// \-->ubt (args.)
343 /// </code>
344 /// </summary>
345 Target Build { get; }
346
347 /// <summary>
348 /// <para>
349 /// **NUKE TARGET**
350 /// </para>
351 /// Cook Unreal assets for standalone game execution
352 /// <code>
353 /// \--Config
354 /// \--Platform
355 /// \--AndroidTextureMode
356 /// \-->ubt (args.)
357 /// \-->uat (args.)
358 /// </code>
359 /// </summary>
360 Target Cook { get; }
361
362 /// <summary>
363 /// <para>
364 /// **NUKE TARGET**
365 /// </para>
366 /// Ensure support for plain C# build plugins without the need for CSX or dotnet projects. This only needs to
367 /// be done once, you can check the results into source control.
368 /// </summary>
370
371 //////// RUN UNREAL TOOLS TARGETS ////////
372
373 /// <summary>
374 /// <para>
375 /// **NUKE TARGET**
376 /// </para>
377 /// Simply run UAT with arguments passed after `-->`
378 /// <code>
379 /// \--> (args.)
380 /// \--IgnoreGlobalArgs (adv.)
381 /// </code>
382 /// <para>
383 /// The following symbols are replaced by Nuke.Unreal:
384 /// </para>
385 /// <code>
386 /// ~p : Project file path
387 /// ~pdir : Project folder
388 /// ~ue : Unreal Engine folder
389 /// </code>
390 /// </summary>
391 Target RunUat { get; }
392
393 /// <summary>
394 /// <para>
395 /// **NUKE TARGET**
396 /// </para>
397 /// Simply run UBT with arguments passed after `-->`
398 /// <code>
399 /// \--> (args.)
400 /// \--IgnoreGlobalArgs (adv.)
401 /// </code>
402 /// <para>
403 /// The following symbols are replaced by Nuke.Unreal:
404 /// </para>
405 /// <code>
406 /// ~p : Project file path
407 /// ~pdir : Project folder
408 /// ~ue : Unreal Engine folder
409 /// </code>
410 /// </summary>
411 Target RunUbt { get; }
412
413 /// <summary>
414 /// <para>
415 /// **NUKE TARGET**
416 /// </para>
417 /// Start a UShell session. This opens a new console window, and nuke will exit immadiately. Working directory
418 /// is the project folder, regardless of actual working directory.
419 /// </summary>
420 Target RunShell { get; }
421
422 /// <summary>
423 /// <para>
424 /// **NUKE TARGET**
425 /// </para>
426 /// <para>
427 /// Run an Unreal tool from the engine binaries folder. You can omit the `Unreal` prefix and the extension.
428 /// For example:
429 /// </para>
430 /// <code>
431 /// nuke run \--tool pak \--> ./Path/To/MyProject.pak -Extract "D:/temp"
432 /// nuke run \--tool editor-cmd \--> ~p -run=MyCommandlet
433 /// </code>
434 /// <para>
435 /// Working directory is the project folder, regardless of actual working directory.
436 /// </para>
437 /// <para>
438 /// The following symbols are replaced by Nuke.Unreal:
439 /// </para>
440 /// <code>
441 /// ~p : Project file path
442 /// ~pdir : Project folder
443 /// ~ue : Unreal Engine folder
444 /// </code>
445 /// <code>
446 /// \--Tool (req.)
447 /// \--> (args.)
448 /// </code>
449 /// </summary>
450 Target Run { get; }
451
452 /// <summary>
453 /// <para>
454 /// **NUKE TARGET**
455 /// </para>
456 /// Run an editor commandlet with arguments passed in after `-->`
457 /// <para>
458 /// The following symbols are replaced by Nuke.Unreal:
459 /// </para>
460 /// <code>
461 /// ~p : Project file path
462 /// ~pdir : Project folder
463 /// ~ue : Unreal Engine folder
464 /// </code>
465 /// <code>
466 /// \--Cmd (req.)
467 /// \--> (args.)
468 /// </code>
469 /// </summary>
470 Target RunEditorCmd { get; }
471
472 //////// BOILERPLATE TARGETS /////////
473
474 /// <summary>
475 /// <para>
476 /// **NUKE TARGET**
477 /// </para>
478 /// Create new module in the owning project or plugin (depending on working directory)
479 /// <code>
480 /// \--Name (req,)
481 /// \--AddToTarget
482 /// \--TemplatesPath (adv.)
483 /// </code>
484 /// </summary>
485 Target NewModule { get; }
486
487 /// <summary>
488 /// <para>
489 /// **NUKE TARGET**
490 /// </para>
491 /// Add C++ code to a project which doesn't have one yet.
492 /// <code>
493 /// \--Name (req,)
494 /// \--TemplatesPath (adv.)
495 /// </code>
496 /// </summary>
497 Target AddCode { get; }
498
499 /// <summary>
500 /// <para>
501 /// **NUKE TARGET**
502 /// </para>
503 /// Create a new project plugin.
504 /// <code>
505 /// \--Name (req,)
506 /// \--TemplatesPath (adv.)
507 /// </code>
508 /// </summary>
509 Target NewPlugin { get; }
510
511 /// <summary>
512 /// <para>
513 /// **NUKE TARGET**
514 /// </para>
515 /// Create new Unreal Actor in current directory
516 /// <code>
517 /// \--Name (req,)
518 /// \--TemplatesPath (adv.)
519 /// </code>
520 /// </summary>
521 Target NewActor { get; }
522
523 /// <summary>
524 /// <para>
525 /// **NUKE TARGET**
526 /// </para>
527 /// Create new Unreal Interface in current directory
528 /// <code>
529 /// \--Name (req,)
530 /// \--TemplatesPath (adv.)
531 /// </code>
532 /// </summary>
533 Target NewInterface { get; }
534
535 /// <summary>
536 /// <para>
537 /// **NUKE TARGET**
538 /// </para>
539 /// Create new Unreal Object in current directory
540 /// <code>
541 /// \--Name (req,)
542 /// \--TemplatesPath (adv.)
543 /// </code>
544 /// </summary>
545 Target NewObject { get; }
546
547 /// <summary>
548 /// <para>
549 /// **NUKE TARGET**
550 /// </para>
551 /// Create new Unreal Struct in current directory
552 /// <code>
553 /// \--Name (req,)
554 /// \--TemplatesPath (adv.)
555 /// </code>
556 /// </summary>
557 Target NewStruct { get; }
558
559 /// <summary>
560 /// <para>
561 /// **NUKE TARGET**
562 /// </para>
563 /// Create new Unreal Automation Spec in current directory
564 /// <code>
565 /// \--Name (req,)
566 /// \--TemplatesPath (adv.)
567 /// </code>
568 /// </summary>
569 Target NewSpec { get; }
570
571 /// <summary>
572 /// <para>
573 /// **NUKE TARGET**
574 /// </para>
575 /// <para>
576 /// Create boilerplate module for third-party C++ libraries. Specify the kind of
577 /// library with `\--LibraryType Header|CMake|XRepo` The latter two will generate
578 /// extra nuke targets preparing the library to be consumed by Unreal.
579 /// Fetching/storing the library is up to the developer
580 /// (except of course with XRepo).
581 /// </para>
582 /// <para>
583 /// Use type specific targets for more comfortable CLI experience, for example <br />
584 /// `nuke use-xrepo \--Spec tracy` <br />
585 /// instead of <br />
586 /// `nuke UseLibrary --LibraryType xrepo --Spec tracy`
587 /// </para>
588 /// <para>
589 /// This only needs to be done once, you can check the results into source control.
590 /// </para>
591 /// <code>
592 /// \--Spec (req,)
593 /// \--LibraryType
594 /// \--Suffix (adv.)
595 /// </code>
596 /// </summary>
597 Target UseLibrary { get; }
598
599 /// <summary>
600 /// <para>
601 /// **NUKE TARGET**
602 /// </para>
603 /// <para>
604 /// Use libraries from the xrepo package manager. This target only configures another target which will
605 /// eventually fetch the input libraries. To make them available to Unreal run `Prepare` or `Generate`
606 /// targets.
607 /// </para>
608 /// <para>
609 /// Specify the xrepo package reference and its config separated by space. For example:
610 /// </para>
611 /// <code>
612 /// nuke UseXRepo \--Spec "zlib"
613 /// nuke UseXRepo \--Spec "zlib 1.2.x"
614 /// nuke UseXRepo \--Spec "boost regex=true,thread=true"
615 /// nuke UseXRepo \--Spec "imgui 1.91.1 freetype=true"
616 /// </code>
617 /// <para>
618 /// Or multiple libraries at once
619 /// </para>
620 /// <code>
621 /// nuke UseXRepo \--Spec "zlib 1.2.x" "boost regex=true,thread=true" "imgui 1.91.1 freetype=true"
622 /// </code>
623 /// <para>
624 /// More about xrepo: https://xrepo.xmake.io
625 /// </para>
626 /// <code>
627 /// \--Spec (req,)
628 /// \--Suffix (adv.)
629 /// </code>
630 /// </summary>
631 /// <remarks>
632 /// Since Unreal uses MD runtime linkage `runtimes='MD'` config is always appended by Nuke.Unreal, and the
633 /// user must not specify it.
634 /// </remarks>
635 Target UseXRepo { get; }
636
637 /// <summary>
638 /// <para>
639 /// **NUKE TARGET**
640 /// </para>
641 /// </summary>
642 Target UseCMake { get; }
643
644 /// <summary>
645 /// <para>
646 /// **NUKE TARGET**
647 /// </para>
648 /// </summary>
649 Target UseHeaderOnly { get; }
650}
High level representation of an Unreal Engine version.
The root class representing Unreal INI configuration.
Definition ConfigIni.cs:50
Unreal Automation Tool is a vast collection of scripts solving all aspects of deploying a program mad...
Definition UatConfig.cs:13
Unreal Build Tool defines the Unreal project structure and provides unified source building utilities...
Definition UbtConfig.cs:13
Build configurations UBT supports.
High level representation of common platforms supported by Unreal Engine (NDA ones excluded) and extr...
The regular target types UBT supports.
Base interface for build components which require an UnrealBuild main class.
AbsolutePath UnrealEnginePath
Path to the root of the associated Unreal Engine installation/source.
UbtConfig UbtGlobal(UbtConfig _)
UBT arguments to be applied globally for all UBT invocations. Override this function in your main bui...
UatConfig UatGlobal(UatConfig _)
UAT arguments to be applied globally for all UAT invocations. Override this function in your main bui...
string ProjectName
Short name of the project.
AndroidCookFlavor[] AndroidTextureMode
AbsolutePath ProjectFolder
Path to folder containing the .project file.
IEnumerable< string > GetArgumentBlock(string name="")
Get optionally named argument block (section after -->) with contextual data substituted....
AbsolutePath PluginsFolder
Path to the Unreal plugins folder of this project.
UnrealPlatform Platform
UatConfig UatCook(UatConfig _)
UAT arguments to be applied every time UAT is called for Cooking. Override this function in your main...
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.
ProjectDescriptor ProjectDescriptor
"Immutable" C# representation of the .uproject contents
AbsolutePath GetOutput()
Get an output folder where the targets should store their artifacts. Override this function in your m...
UnrealConfig[] EditorConfig
bool ForDistribution()
Enforce packaging for distribution when that is set from Game ini files. Override this function in yo...
EngineVersion GetEngineVersionFromProject()
Utility function to get the proper Engine version associated with current project....
TargetType
The type of target.
IniHierarchyLevel
Indicating the INI config hierarchy importance, from least important to most important (in terms of w...