Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Builders/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

using System;
using System.IO;
using System.IO.Compression;
using osu.Desktop.Deploy.Uploaders;
using osu.Framework.IO.Network;

namespace osu.Desktop.Deploy.Builders
{
Expand Down Expand Up @@ -44,6 +46,28 @@ protected void RunDotnetPublish(string? extraArgs = null, string? outputDir = nu
+ $" {Program.ProjectName}");
}

protected void AttachSatoriGC(string? outputDir = null)
{
outputDir ??= Program.StagingPath;

if (Program.UseSatoriGC)
{
Logger.Write("Downloading Satori GC release...");
string satoriArchivePath = Path.GetTempFileName();
using (var req = new FileWebRequest(satoriArchivePath, $"https://github.com/ppy/Satori/releases/latest/download/{RuntimeIdentifier}.zip"))
req.Perform();

Logger.Write("Extracting Satori GC into staging folder...");

using (var stream = File.OpenRead(satoriArchivePath))
using (var archive = new ZipArchive(stream))
{
foreach (var entry in archive.Entries)
entry.ExtractToFile(Path.Combine(outputDir, entry.Name), true);
}
}
}

private static void refreshDirectory(string directory)
{
if (Directory.Exists(directory))
Expand Down
17 changes: 9 additions & 8 deletions Builders/LinuxBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,29 @@ public override Uploader CreateUploader()
}

// https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
static void CopyDirectory(string sourceDir, string destinationDir, bool recursive)
private static void copyDirectory(string sourceDir, string destinationDir, bool recursive)
{
var dir = new DirectoryInfo(sourceDir);

if (!dir.Exists)
throw new DirectoryNotFoundException($"Source directory not found: {dir.FullName}");

DirectoryInfo[] dirs = dir.GetDirectories();

Directory.CreateDirectory(destinationDir);

foreach (FileInfo file in dir.GetFiles())
{
string targetFilePath = Path.Combine(destinationDir, file.Name);
file.CopyTo(targetFilePath);
}

if (recursive)
{
foreach (DirectoryInfo subDir in dirs)
{
string newDestinationDir = Path.Combine(destinationDir, subDir.Name);
CopyDirectory(subDir.FullName, newDestinationDir, true);
copyDirectory(subDir.FullName, newDestinationDir, true);
}
}
}
Expand All @@ -67,13 +67,14 @@ public override void Build()
if (Directory.Exists(stagingTarget))
Directory.Delete(stagingTarget, true);

CopyDirectory(Path.Combine(Program.TemplatesPath, app_dir), stagingTarget, true);
copyDirectory(Path.Combine(Program.TemplatesPath, app_dir), stagingTarget, true);

File.CreateSymbolicLink(Path.Combine(stagingTarget, ".DirIcon"), "osu.png");

Program.RunCommand("chmod", $"+x {stagingTarget}/AppRun");

RunDotnetPublish(outputDir: publishTarget);
AttachSatoriGC(outputDir: publishTarget);
}
}
}
1 change: 1 addition & 0 deletions Builders/MacOSBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public override void Build()
Program.RunCommand("cp", $"-r \"{Path.Combine(Program.TemplatesPath, app_dir)}\" \"{stagingTarget}\"");

RunDotnetPublish(outputDir: publishTarget);
AttachSatoriGC(outputDir: publishTarget);

// without touching the app bundle itself, changes to file associations / icons / etc. will be cached at a macOS level and not updated.
Program.RunCommand("touch", $"\"{stagingTarget}\" {Program.StagingPath}", false);
Expand Down
4 changes: 3 additions & 1 deletion Builders/WindowsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public override Uploader CreateUploader()
.Where(File.Exists)
.Last();

extraArgs += $" --signTemplate=\"\\\"{signToolPath}\\\" sign /td sha256 /fd sha256 /dlib \\\"{dllPath}\\\" /dmdf \\\"{Path.GetFullPath(Program.WindowsCodeSigningMetadataPath)}\\\" /tr http://timestamp.acs.microsoft.com {{{{file...}}}}";
extraArgs +=
$" --signTemplate=\"\\\"{signToolPath}\\\" sign /td sha256 /fd sha256 /dlib \\\"{dllPath}\\\" /dmdf \\\"{Path.GetFullPath(Program.WindowsCodeSigningMetadataPath)}\\\" /tr http://timestamp.acs.microsoft.com {{{{file...}}}}";
}

return new WindowsVelopackUploader(app_name, os_name, RuntimeIdentifier, channel, extraArgs: extraArgs);
Expand All @@ -57,6 +58,7 @@ public override Uploader CreateUploader()
public override void Build()
{
RunDotnetPublish();
AttachSatoriGC();

bool rcEditCommand =
Program.RunCommand("tools/rcedit-x64.exe", $"\"{Path.Combine(Program.StagingPath, "osu!.exe")}\""
Expand Down
2 changes: 2 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ internal static class Program

public static bool IncrementVersion => bool.Parse(ConfigurationManager.AppSettings["IncrementVersion"] ?? "true");

public static bool UseSatoriGC => bool.TryParse(Environment.GetEnvironmentVariable("USE_SATORI_GC"), out bool useSatori) && useSatori;

public static string SolutionPath { get; private set; } = null!;

private static bool interactive;
Expand Down