Nuke.Unreal
Build Unreal apps in Style.
Loading...
Searching...
No Matches
AndroidSdk.cs
1using System;
2using System.Linq;
3using System.Threading.Tasks;
4using Nuke.Cola;
5using Nuke.Cola.Tooling;
6using Nuke.Common;
7using Nuke.Common.IO;
8using Nuke.Common.Tooling;
9using Serilog;
10
12
13/// <summary>
14/// Bouquet of SDK component versions used by specific Unreal version
15/// </summary>
16/// <param name="Jdk">Major JDK version</param>
17/// <param name="Sdk">Major Android SDK requirement</param>
18/// <param name="Target">Major target Android SDK</param>
19/// <param name="Ndk">Very specific NDK version</param>
20/// <param name="BuildTools">Very specific Build Tools version</param>
21/// <param name="CMake">Very specific CMake version</param>
22public record class AndroidSdkVersion(
23 int Jdk,
24 int Sdk,
25 int Target,
26 Version Ndk,
27 Version BuildTools,
28 Version CMake
29);
30
31/// <summary>
32/// Base class for managing Android SDK on any host platform
33/// </summary>
34public abstract class AndroidSdk : IPlatformSdk
35{
36 public static AndroidSdkVersion? GetSdkVersions(string unrealVersion) => unrealVersion switch
37 {
38 "5.0" => new(
39 Jdk: 17, Sdk: 30, Target: 30,
40 Ndk: new(21, 4, 7075529),
41 BuildTools: new(30, 0, 3),
42 CMake: new(3, 10, 2, 4988404)
43 ),
44 "5.1" => new(
45 Jdk: 17, Sdk: 32, Target: 32,
46 Ndk: new(25, 1, 8937393),
47 BuildTools: new(32, 0, 0),
48 CMake: new(3, 10, 2, 4988404)
49 ),
50 "5.2" => new(
51 Jdk: 17, Sdk: 32, Target: 32,
52 Ndk: new(25, 1, 8937393),
53 BuildTools: new(32, 0, 0),
54 CMake: new(3, 10, 2, 4988404)
55 ),
56 "5.3" => new(
57 Jdk: 17, Sdk: 33, Target: 33,
58 Ndk: new(25, 1, 8937393),
59 BuildTools: new(33, 0, 3),
60 CMake: new(3, 10, 2, 4988404)
61 ),
62 "5.4" => new(
63 Jdk: 17, Sdk: 34, Target: 34,
64 Ndk: new(25, 1, 8937393),
65 BuildTools: new(34, 0, 0),
66 CMake: new(3, 22, 1, 0)
67 ),
68 "5.5" => new(
69 Jdk: 17, Sdk: 34, Target: 34,
70 Ndk: new(25, 1, 8937393),
71 BuildTools: new(34, 0, 0),
72 CMake: new(3, 22, 1, 0)
73 ),
74 "5.6" => new(
75 Jdk: 21, Sdk: 35, Target: 34,
76 Ndk: new(27, 2, 12479018),
77 BuildTools: new(35, 0, 1),
78 CMake: new(3, 22, 1, 0)
79 ),
80 "5.7" => new(
81 Jdk: 21, Sdk: 35, Target: 34,
82 Ndk: new(27, 2, 12479018),
83 BuildTools: new(35, 0, 1),
84 CMake: new(3, 22, 1, 0)
85 ),
86 _ => null
87 };
88
89 public static AndroidSdkVersion? GetSdkVersions(IUnrealBuild build)
90 => GetSdkVersions(Unreal.Version(build).VersionMinor);
91
92 public static AndroidSdkVersion GetSdkVersionsChecked(IUnrealBuild build)
93 => GetSdkVersions(build)
94 .NotNull($"Couldn't determine Android SDK/JDK/NDK versions for Unreal {Unreal.Version(build)} ")
95 !;
96
97 public abstract UnrealPlatform Host { get; }
98 public abstract UnrealPlatform Target { get; }
99 public abstract Task Setup(IUnrealBuild build);
100 public abstract bool IsValid(IUnrealBuild build);
101 public abstract AbsolutePath GetSdkPath(IUnrealBuild build);
103
104 public abstract AbsolutePath GetAndroidHome(IUnrealBuild build);
105 public abstract AbsolutePath GetNdkPath(IUnrealBuild build);
106 public abstract AbsolutePath GetBuildToolsPath(IUnrealBuild build);
107 public abstract AbsolutePath GetPlatformToolsPath(IUnrealBuild build);
108
109 public abstract ToolEx GetApkSigner(IUnrealBuild build);
110 public abstract ToolEx GetAdb(IUnrealBuild build);
111}
string VersionMinor
Only the Major.Minor version components, with extra information trimmed.
Base class for managing Android SDK on any host platform.
Definition AndroidSdk.cs:35
AbsolutePath GetSdkPath(IUnrealBuild build)
The root of the currently used platform SDK in the file system, if there's one.
PlatformSdkXMakeData GetXMakeData(IUnrealBuild build)
If applicable and XMake can work with the toolchains provided by this SDK, return information for it ...
bool IsValid(IUnrealBuild build)
Would this SDK be ever valid for the given Unreal project. This check is done before Setup is called....
High level representation of common platforms supported by Unreal Engine (NDA ones excluded) and extr...
A collection of utilities around basic functions regarding the environment of the Engine we're workin...
Definition Unreal.cs:24
static EngineVersion Version(IUnrealBuild build)
Get high-level version of currently used Engine.
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.
record class AndroidSdkVersion(int Jdk, int Sdk, int Target, Version Ndk, Version BuildTools, Version CMake)
Bouquet of SDK component versions used by specific Unreal version.
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.