Nuke.Unreal
Build Unreal apps in Style.
Loading...
Searching...
No Matches
UnrealBuildTest.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Threading.Tasks;
5using Nuke.Common;
6using Nuke.Common.Tools.Git;
7using Serilog;
8
9namespace Nuke.Unreal;
10
11/// <summary>
12/// Used only for testing purposes. It has no external use outside of Nuke.Unreal development.
13/// </summary>
15{
16 [Parameter]
17 bool TestMode = false;
18
19 protected override void OnBuildCreated()
20 {
21 base.OnBuildCreated();
22 NoLogo = true;
23 }
24
25 protected virtual void Cleanup()
26 {
27 GitTasks.Git("clean -xdf -e Nuke.Targets/ -e .nuke/", workingDirectory: ProjectFolder);
28 GitTasks.Git("restore . -- :(exclude)Nuke.Targets/ :(exclude).nuke/", workingDirectory: ProjectFolder);
29 }
30
31 protected virtual void PostBuildCheck() {}
32
33 protected override void OnBuildFinished()
34 {
35 if (!TestMode) return;
36 try
37 {
38 PostBuildCheck();
39 }
40 catch (Exception e)
41 {
42 Log.Error(e, "Post build check failed");
43 ExitCode = -1;
44 }
45 Cleanup();
46 }
47}
Used only for testing purposes. It has no external use outside of Nuke.Unreal development.
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.