2using System.Collections.Generic;
4using System.Threading.Tasks;
5using System.ComponentModel;
6using Nuke.Common.Tooling;
10using Nuke.Common.Utilities;
31 AllWin = Win32 | Win64,
32 AllLinux = Linux | LinuxArm64,
33 AllDesktop = AllWin | AllLinux | Mac,
42 public override bool CanConvert(Type objectType)
44 return objectType.IsClass && objectType.IsAssignableTo(typeof(
UnrealPlatform));
47 public override object? ReadJson(JsonReader reader, Type objectType,
object? existingValue, JsonSerializer serializer)
49 if (reader.Value is
string value)
53 Assert.True(reader.TokenType == JsonToken.None
54 || reader.TokenType == JsonToken.Null
55 || reader.TokenType == JsonToken.Undefined,
56 $
"JSON value was neither a string, nor one of the 'not-existing' types. Token type: {reader.TokenType}; Object type: {objectType.Name};"
61 public override void WriteJson(JsonWriter writer,
object? value, JsonSerializer serializer)
65 writer.WriteValue(platform.UserDefinedName ?? platform.ToString());
74 [TypeConverter(typeof(TypeConverter<UnrealPlatform>))]
83 Value = nameof(
Win64),
89 Value = nameof(Win32),
94 public static readonly UnrealPlatform HoloLens =
new()
96 Value = nameof(HoloLens),
113 Value = nameof(Linux),
114 Flag = UnrealPlatformFlag.Linux
116 public static readonly UnrealPlatform LinuxArm64 =
new()
118 Value = nameof(LinuxArm64),
119 Flag = UnrealPlatformFlag.LinuxArm64
121 public static readonly UnrealPlatform Android =
new()
123 Value = nameof(Android),
124 Flag = UnrealPlatformFlag.Android
126 public static readonly UnrealPlatform IOS =
new()
132 public static readonly UnrealPlatform TVOS =
new()
134 Value = nameof(TVOS),
138 public static readonly UnrealPlatform VisionOS =
new()
140 Value = nameof(VisionOS),
165 UnrealPlatformFlag.Win64 =>
Win64,
166 UnrealPlatformFlag.Win32 => Win32,
168 UnrealPlatformFlag.HoloLens => HoloLens,
169 UnrealPlatformFlag.Mac =>
Mac,
170 UnrealPlatformFlag.Linux => Linux,
171 UnrealPlatformFlag.LinuxArm64 => LinuxArm64,
172 UnrealPlatformFlag.Android => Android,
173 UnrealPlatformFlag.IOS => IOS,
174 UnrealPlatformFlag.TVOS => TVOS,
175 UnrealPlatformFlag.VisionOS => VisionOS,
177 _ =>
throw new Exception($
"UnrealPlatformFlag {flag} didn't have matching UnrealPlatform"),
225 private string? _platformText =
null;
254 public bool IsMobile => (Flag & (UnrealPlatformFlag.Android | UnrealPlatformFlag.IOS | UnrealPlatformFlag.HoloLens |
UnrealPlatformFlag.VisionOS)) > 0;
256 public override string ToString()
269 _platformText = _platformText
273 object ICloneable.Clone()
278 public static implicit
operator string(UnrealPlatform configuration)
280 return configuration.ToString();
300 if (platformText.ContainsOrdinalIgnoreCase(
"Windows"))
301 return Win64.Clone().With(p => p.UserDefinedName = platformText);
302 if (platformText.ContainsOrdinalIgnoreCase(
"Mac") && platformText !=
"Mac")
303 return Mac.Clone().With(p => p.UserDefinedName = platformText);
306 var result = TypeDescriptor.GetConverter(typeof(
UnrealPlatform)).ConvertFrom(platformText!);
307 Assert.NotNull(result, $
"'{platformText}' is not a valid UnrealPlatform");
312 throw new AggregateException($
"'{platformText}' is not a valid UnrealPlatform", e);
UnrealPlatformFlag
Bit-field representation of Unreal platforms and platform-families.
UnrealCompatibility
A flag enum representation for checking the Unreal version compatibility of various features....