23 public const string LatestVersion =
"3.0.4";
24 internal static string GetBundleAppName(
string version = LatestVersion)
25 => (plat: EnvironmentInfo.Platform, arch: RuntimeInformation.OSArchitecture)
switch
27 (PlatformFamily.Windows, Architecture.X64) => $
"xmake-bundle-v{version}.win64.exe",
28 (PlatformFamily.Windows, Architecture.X86) => $
"xmake-bundle-v{version}.win32.exe",
29 (PlatformFamily.Windows, Architecture.Arm64) => $
"xmake-bundle-v{version}.arm64.exe",
30 (PlatformFamily.Linux, Architecture.X64) => $
"xmake-bundle-v{version}.linux.x86_64",
31 (PlatformFamily.OSX, Architecture.Arm64) => $
"xmake-bundle-v{version}.macos.arm64",
32 (PlatformFamily.OSX, Architecture.X64) => $
"xmake-bundle-v{version}.macos.x86_64",
33 var other =>
throw new Exception($
"Trying to use XMake on an unsupported platform: {other.plat} {other.arch}")
41 var bundleAppName = GetBundleAppName(version);
42 var xmakePath = NukeBuild.TemporaryDirectory / bundleAppName;
43 if (!xmakePath.FileExists())
45 Log.Information(
"Downloading XMake {0}", bundleAppName);
46 HttpTasks.HttpDownloadFile(
47 $
"https://github.com/xmake-io/xmake/releases/download/v{LatestVersion}/{bundleAppName}",
51 return ToolResolver.GetTool(xmakePath);
54 public static ValueOrError<Tool> EnsureXMake =>
TryGetXMake();
59 public static Tool
XMake => EnsureXMake.Get();