diff --git a/Builders/LinuxBuilder.cs b/Builders/LinuxBuilder.cs index 627119c..3ddced8 100644 --- a/Builders/LinuxBuilder.cs +++ b/Builders/LinuxBuilder.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.IO; using osu.Desktop.Deploy.Uploaders; @@ -15,15 +16,26 @@ public class LinuxBuilder : Builder private readonly string stagingTarget; private readonly string publishTarget; - public LinuxBuilder(string version) + public LinuxBuilder(string version, string? arch) : base(version) { + if (string.IsNullOrEmpty(arch)) + { + Console.Write("Build for which architecture? [x64/arm64]: "); + arch = Console.ReadLine() ?? string.Empty; + } + + if (arch != "x64" && arch != "arm64") + Logger.Error($"Invalid Architecture: {arch}"); + + RuntimeIdentifier = $"{os_name}-{arch}"; + stagingTarget = Path.Combine(Program.StagingPath, app_dir); publishTarget = Path.Combine(stagingTarget, "usr", "bin"); } protected override string TargetFramework => "net8.0"; - protected override string RuntimeIdentifier => $"{os_name}-x64"; + protected override string RuntimeIdentifier { get; } public override Uploader CreateUploader() { diff --git a/Builders/WindowsBuilder.cs b/Builders/WindowsBuilder.cs index 8bad086..5de1074 100644 --- a/Builders/WindowsBuilder.cs +++ b/Builders/WindowsBuilder.cs @@ -12,15 +12,29 @@ public class WindowsBuilder : Builder { private const string app_name = "osu!.exe"; private const string os_name = "win"; - private const string channel = "win"; + private readonly string channel = "win"; - public WindowsBuilder(string version) + public WindowsBuilder(string version, string? arch) : base(version) { + if (string.IsNullOrEmpty(arch)) + { + Console.Write("Build for which architecture? [x64/arm64]: "); + arch = Console.ReadLine() ?? string.Empty; + } + + if (arch != "x64" && arch != "arm64") + Logger.Error($"Invalid Architecture: {arch}"); + + RuntimeIdentifier = $"{os_name}-{arch}"; + + // Include architecture in channel while x64 keeps using the old convention without it + if (arch != "x64") + this.channel = RuntimeIdentifier; } protected override string TargetFramework => "net8.0"; - protected override string RuntimeIdentifier => $"{os_name}-x64"; + protected override string RuntimeIdentifier { get; } public override Uploader CreateUploader() { diff --git a/Program.cs b/Program.cs index 4e0842c..6730712 100644 --- a/Program.cs +++ b/Program.cs @@ -119,11 +119,11 @@ public static void Main(string[] args) switch (targetPlatform) { case RuntimeInfo.Platform.Windows: - builder = new WindowsBuilder(version); + builder = new WindowsBuilder(version, getArg(3)); break; case RuntimeInfo.Platform.Linux: - builder = new LinuxBuilder(version); + builder = new LinuxBuilder(version, getArg(3)); break; case RuntimeInfo.Platform.macOS: diff --git a/Uploaders/LinuxVelopackUploader.cs b/Uploaders/LinuxVelopackUploader.cs index 7e5f1eb..fb03127 100644 --- a/Uploaders/LinuxVelopackUploader.cs +++ b/Uploaders/LinuxVelopackUploader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; + namespace osu.Desktop.Deploy.Uploaders { public class LinuxVelopackUploader : VelopackUploader @@ -16,7 +18,16 @@ public LinuxVelopackUploader(string applicationName, string operatingSystemName, public override void PublishBuild(string version) { base.PublishBuild(version); - RenameAsset($"{Program.PackageName}-{channel}.AppImage", "osu.AppImage"); + + if (channel != "linux-x64" && channel != "linux-arm64") + throw new Exception($"Unrecognised channel: {channel}"); + + // Include architecture in asset name while x64 keeps using the old convention without it + string arch_suffix = ""; + if (channel != "linux-x64") + arch_suffix = channel.Substring(5); + + RenameAsset($"{Program.PackageName}-{channel}.AppImage", $"osu{arch_suffix}.AppImage"); } } } diff --git a/Uploaders/WindowsVelopackUploader.cs b/Uploaders/WindowsVelopackUploader.cs index e99e2ec..7ace7e7 100644 --- a/Uploaders/WindowsVelopackUploader.cs +++ b/Uploaders/WindowsVelopackUploader.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; + namespace osu.Desktop.Deploy.Uploaders { public class WindowsVelopackUploader : VelopackUploader @@ -18,7 +20,14 @@ public WindowsVelopackUploader(string applicationName, string operatingSystemNam public override void PublishBuild(string version) { base.PublishBuild(version); - RenameAsset($"{Program.PackageName}-{channel}-Setup.exe", "install.exe"); + + if (channel != "win"/*-x64*/ && channel != "win-arm64") + throw new Exception($"Unrecognised channel: {channel}"); + + // Include architecture in asset name while x64 keeps using the old convention without it + string arch_suffix = channel.Substring(3); + + RenameAsset($"{Program.PackageName}-{channel}-Setup.exe", $"install{arch_suffix}.exe"); } } }