11 public static string ToCorrectString(
this XRepoArch arch) => arch.ToString().Replace(
"__",
"-");
13 public static XRepoArch GetArch(
string from) => Enum.Parse<XRepoArch>(from.Replace(
"-",
"__"));
15 public static XRepoArch GetDefaultArch(
this XRepoPlatform xrepoPlatform)
16 => xrepoPlatform
switch
18 XRepoPlatform.android => XRepoArch.arm64__v8a,
19 XRepoPlatform.appletvos => XRepoArch.arm64,
20 XRepoPlatform.applexros => XRepoArch.arm64,
21 XRepoPlatform.bsd => XRepoArch.x86_64,
22 XRepoPlatform.cygwin => XRepoArch.x86_64,
23 XRepoPlatform.haiku => XRepoArch.x86_64,
24 XRepoPlatform.harmony => XRepoArch.arm64__v8a,
25 XRepoPlatform.iphoneos => XRepoArch.arm64,
26 XRepoPlatform.linux => XRepoArch.x86_64,
27 XRepoPlatform.macos => XRepoArch.arm64,
28 XRepoPlatform.mingw => XRepoArch.x86_64,
29 XRepoPlatform.msys => XRepoArch.x86_64,
30 XRepoPlatform.wasm => XRepoArch.wasm32,
31 XRepoPlatform.watchos => XRepoArch.armv7k,
32 XRepoPlatform.windows => XRepoArch.x64,
33 _ => XRepoArch.x86_64,
36 public static UnrealPlatform? InferUnrealPlatform(
this XRepoPlatform xrepoPlatform)
37 => xrepoPlatform
switch
49 public static UnrealPlatform? GetUnrealPlatform(
this XRepoPlatformArch xrepoPlatform)
50 => xrepoPlatform
switch
54 { Platform: XRepoPlatform.windows, Arch: XRepoArch.x86 } =>
UnrealPlatform.Win32,
57 { Platform: XRepoPlatform.linux, Arch: XRepoArch.x64 } =>
UnrealPlatform.Linux,
58 { Platform: XRepoPlatform.linux, Arch: XRepoArch.x86_64 } =>
UnrealPlatform.Linux,
59 { Platform: XRepoPlatform.linux, Arch: XRepoArch.arm64 } =>
UnrealPlatform.LinuxArm64,
60 { Platform: XRepoPlatform.linux, Arch: XRepoArch.arm64__v8a } =>
UnrealPlatform.LinuxArm64,
61 { Platform: XRepoPlatform.linux, Arch: XRepoArch.arm64ec } =>
UnrealPlatform.LinuxArm64,
73 public static XRepoPlatformArch GetXRepoPlatformArch(
this UnrealPlatform platform)
76 if (platform ==
UnrealPlatform.Win32)
return new(XRepoPlatform.windows, XRepoArch.x86);
77 if (platform ==
UnrealPlatform.Linux)
return new(XRepoPlatform.linux, XRepoArch.x86_64);
78 if (platform ==
UnrealPlatform.LinuxArm64)
return new(XRepoPlatform.linux, XRepoArch.arm64);
79 if (platform ==
UnrealPlatform.Android)
return new(XRepoPlatform.android, XRepoPlatform.android.GetDefaultArch());
80 if (platform ==
UnrealPlatform.
Mac)
return new(XRepoPlatform.macos, XRepoPlatform.macos.GetDefaultArch());
81 if (platform ==
UnrealPlatform.IOS)
return new(XRepoPlatform.iphoneos, XRepoPlatform.iphoneos.GetDefaultArch());
82 if (platform ==
UnrealPlatform.TVOS)
return new(XRepoPlatform.appletvos, XRepoPlatform.appletvos.GetDefaultArch());
83 if (platform ==
UnrealPlatform.VisionOS)
return new(XRepoPlatform.applexros, XRepoPlatform.applexros.GetDefaultArch());
84 throw new Exception($
"{platform} platform was invalid.");
87 public static IEnumerable<UnrealPlatform> ParseSupportedPlatforms(
string xrepoPlatforms,
string arch)
88 => xrepoPlatforms
switch
100 _ => xrepoPlatforms.Split(
',')
101 .Select(p =>
new XRepoPlatformArch(p.Trim(), arch).GetUnrealPlatform())