-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathLinuxBuilder.cs
51 lines (40 loc) · 1.89 KB
/
LinuxBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.IO;
using osu.Desktop.Deploy.Uploaders;
namespace osu.Desktop.Deploy.Builders
{
public class LinuxBuilder : Builder
{
private const string app_dir = "osu!.AppDir";
private const string app_name = "osu!";
private const string os_name = "linux";
private readonly string stagingTarget;
private readonly string publishTarget;
public LinuxBuilder(string version)
: base(version)
{
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";
public override Uploader CreateUploader()
{
// Temporarily fix for zstd (current default) not being supported on some systems: https://github.com/ppy/osu/issues/30175
// Todo: Remove with the next velopack release.
const string extra_args = " --compression gzip";
return new LinuxVelopackUploader(app_name, os_name, RuntimeIdentifier, RuntimeIdentifier, extraArgs: extra_args, stagingPath: stagingTarget);
}
public override void Build()
{
if (Directory.Exists(stagingTarget))
Directory.Delete(stagingTarget, true);
Directory.CreateDirectory(stagingTarget);
foreach (var file in Directory.GetFiles(Path.Combine(Program.TemplatesPath, app_dir)))
new FileInfo(file).CopyTo(Path.Combine(stagingTarget, Path.GetFileName(file)));
Program.RunCommand("chmod", $"+x {stagingTarget}/AppRun");
RunDotnetPublish(outputDir: publishTarget);
}
}
}