Nuke.Unreal
Build Unreal apps in Style.
Loading...
Searching...
No Matches
IPlatformSdk.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Threading.Tasks;
5using Nuke.Cola.Tooling;
6using Nuke.Common;
7using Nuke.Common.IO;
8
10
11/// <summary>
12/// A record for providing build information for XMake/XRepo when that may be requested
13/// </summary>
14/// <param name="Arguments"></param>
15/// <param name="Platform">
16/// XMake compatible platform name. If not specified known common platforms will be inferred.
17/// </param>
18/// <param name="ToolSetup">
19/// Arbitrary modification to the XRepo tool execution
20/// </param>
21public record class PlatformSdkXMakeData(
22 string Arguments,
23 string? Platform = null,
24 Func<ToolEx, ToolEx>? ToolSetup = null
25);
26
27/// <summary>
28/// Base interface for implementing the automatic SDK management for a host-target platform pair.
29/// </summary>
30public interface IPlatformSdk
31{
32 /// <summary>
33 /// The platform used for development, hosting this SDK to cross-compile target platform
34 /// </summary>
36
37 /// <summary>
38 /// The platform targeted by given SDK
39 /// </summary>
41
42 /// <summary>
43 /// <para>
44 /// Initial setup done when the SDK is first needed by a task in Nuke.Unreal. Download and install SDK files
45 /// here and point Unreal to it via setting process environment variables for example. Even if an SDK is
46 /// already downloaded and installed this Setup function would still need to connect Unreal to that.
47 /// </para>
48 /// <para>
49 /// This method can be called multiple times, not only at initialization. Implementations should tread
50 /// accordingly.
51 /// </para>
52 /// </summary>
53 /// <param name="build">
54 /// Current Unreal project, set or get data from it, as that's necessary for this platform SDK
55 /// </param>
56 /// <returns>
57 /// As this can be a long-running process, implementation is recommended to be async
58 /// </returns>
59 Task Setup(IUnrealBuild build);
60
61 /// <summary>
62 /// Would this SDK be ever valid for the given Unreal project. This check is done before Setup is called.
63 /// It shouldn't yet check if SDK is available locally, only that it can be made available at some point in the
64 /// future.
65 /// For checking if an installed SDK is available locally use <see cref="Exists"/>
66 /// </summary>
67 bool IsValid(IUnrealBuild build);
68
69 /// <summary>
70 /// A shared user folder for this SDK version, owned by Nuke.Unreal. This may be a parent folder to store all
71 /// the separate SDK versions. To get the path directly to the currently used SDK use <see cref="GetSdkPath"/>
72 /// </summary>
73 AbsolutePath GetSdkVersionsPath(IUnrealBuild build) => PlatformSdkManager.PlatformSdkRoot / Host / Target;
74
75 /// <summary>
76 /// The root of the currently used platform SDK in the file system, if there's one.
77 /// </summary>
78 AbsolutePath GetSdkPath(IUnrealBuild build);
79
80 /// <summary>
81 /// Get the path to a C++ toolchain folder which may be used to compile external C++ code with to maintain
82 /// ABI compatibility if that code needs to link with Unreal.
83 /// </summary>
84 AbsolutePath GetToolchainPath(IUnrealBuild build) => GetSdkPath(build);
85
86 /// <summary>
87 /// Whether a valid platform SDK exists locally for given project, and is ready to use without further
88 /// downloading and installation.
89 /// </summary>
90 bool Exists(IUnrealBuild build) => IsValid(build) && GetSdkPath(build).DirectoryExists();
91
92 /// <summary>
93 /// If applicable and XMake can work with the toolchains provided by this SDK, return information for it
94 /// how to do so.
95 /// </summary>
96 /// <param name="build"></param>
97 /// <returns></returns>
99}
High level representation of common platforms supported by Unreal Engine (NDA ones excluded) and extr...
Base interface for build components which require an UnrealBuild main class.
Base interface for implementing the automatic SDK management for a host-target platform pair.
AbsolutePath GetSdkPath(IUnrealBuild build)
The root of the currently used platform SDK in the file system, if there's one.
bool Exists(IUnrealBuild build)
Whether a valid platform SDK exists locally for given project, and is ready to use without further do...
AbsolutePath GetToolchainPath(IUnrealBuild build)
Get the path to a C++ toolchain folder which may be used to compile external C++ code with to maintai...
bool IsValid(IUnrealBuild build)
Would this SDK be ever valid for the given Unreal project. This check is done before Setup is called....
UnrealPlatform Host
The platform used for development, hosting this SDK to cross-compile target platform.
Task Setup(IUnrealBuild build)
AbsolutePath GetSdkVersionsPath(IUnrealBuild build)
A shared user folder for this SDK version, owned by Nuke.Unreal. This may be a parent folder to store...
PlatformSdkXMakeData? GetXMakeData(IUnrealBuild build)
If applicable and XMake can work with the toolchains provided by this SDK, return information for it ...
UnrealPlatform Target
The platform targeted by given SDK.
record class PlatformSdkXMakeData(string Arguments, string? Platform=null, Func< ToolEx, ToolEx >? ToolSetup=null)
A record for providing build information for XMake/XRepo when that may be requested.