Skip to content

Commit 7aec46e

Browse files
authored
Merge pull request #361 from winnerspiros/copilot/merge-ppy-commit-fix-build-errors
fix: resolve three CI build/quality errors
2 parents 98af692 + 57f69f2 commit 7aec46e

27 files changed

Lines changed: 163 additions & 44 deletions

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,6 @@ jobs:
598598
-p:BuildIpa=false
599599
-p:CodesignKey=""
600600
-p:CodesignProvision=""
601-
-p:ServerGarbageCollection=true
602-
-p:ConcurrentGarbageCollection=true
603601
604602
- name: Package iOS build
605603
run: |

osu.Desktop/DiscordRichPresence.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Text;
67
using DiscordRPC;
78
using DiscordRPC.Message;
@@ -27,6 +28,7 @@
2728

2829
namespace osu.Desktop
2930
{
31+
[RequiresUnreferencedCode("Newtonsoft.Json relies on reflection over types that may be removed when trimming.")]
3032
internal partial class DiscordRichPresence : Component
3133
{
3234
private const string client_id = "1216669957799018608";

osu.Desktop/LegacyIpc/LegacyTcpIpcProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Linq;
67
using Newtonsoft.Json.Linq;
78
using osu.Framework.Logging;
@@ -20,6 +21,7 @@ namespace osu.Desktop.LegacyIpc
2021
/// <summary>
2122
/// Provides IPC to legacy osu! clients.
2223
/// </summary>
24+
[RequiresUnreferencedCode("Newtonsoft.Json relies on reflection over types that may be removed when trimming.")]
2325
public class LegacyTcpIpcProvider : TcpIpcProvider
2426
{
2527
private static readonly Logger logger = Logger.GetLogger("legacy-ipc");

osu.Desktop/MacOS/MacOSAppLocationChecker.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System;
55
using System.IO;
6-
using osu.Framework;
76
using osu.Framework.Allocation;
87
using osu.Framework.Graphics;
98
using osu.Framework.Graphics.Sprites;
@@ -26,7 +25,7 @@ protected override void LoadComplete()
2625
{
2726
base.LoadComplete();
2827

29-
string assemblyPath = RuntimeInfo.EntryAssembly.Location;
28+
string assemblyPath = AppContext.BaseDirectory;
3029

3130
bool inRootApp = assemblyPath.StartsWith("/Applications/", StringComparison.Ordinal);
3231
bool inUserApp = assemblyPath.StartsWith(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Applications/"), StringComparison.Ordinal);

osu.Desktop/Windows/Icons.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4+
using System;
45
using System.IO;
56

67
namespace osu.Desktop.Windows
@@ -10,7 +11,7 @@ public static class Icons
1011
/// <summary>
1112
/// Fully qualified path to the directory that contains icons (in the installation folder).
1213
/// </summary>
13-
private static readonly string icon_directory = Path.GetDirectoryName(typeof(Icons).Assembly.Location)!;
14+
private static readonly string icon_directory = AppContext.BaseDirectory;
1415

1516
public static string Lazer => Path.Join(icon_directory, "lazer.ico");
1617

osu.Desktop/Windows/WindowsAssociationManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static class WindowsAssociationManager
3131
/// </summary>
3232
internal const string SHELL_OPEN_COMMAND = @"Shell\Open\Command";
3333

34-
private static readonly string exe_path = Path.ChangeExtension(typeof(WindowsAssociationManager).Assembly.Location, ".exe").Replace('/', '\\');
34+
private static readonly string exe_path = Path.Combine(AppContext.BaseDirectory, Path.ChangeExtension(AppDomain.CurrentDomain.FriendlyName, ".exe")).Replace('/', '\\');
3535

3636
/// <summary>
3737
/// Program ID prefix used for file associations. Should be relatively short since the full program ID has a 39 character limit,

osu.Desktop/Windows/WindowsKey.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Runtime.InteropServices;
67

78
// ReSharper disable IdentifierTypo
@@ -47,6 +48,7 @@ private static int lowLevelKeyboardProc(int nCode, int wParam, ref KdDllHookStru
4748
return callNextHookEx(0, nCode, wParam, ref lParam);
4849
}
4950

51+
[RequiresAssemblyFiles("Uses Marshal.GetHINSTANCE which requires the assembly to be loaded from disk.")]
5052
internal static void Disable()
5153
{
5254
if (keyHook != IntPtr.Zero || isBlocked)

osu.Game.Benchmarks/BenchmarkScoreMultiplierCalculator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using BenchmarkDotNet.Attributes;
66
using NUnit.Framework;
7+
using osu.Game.Beatmaps;
78
using osu.Game.Rulesets.Mods;
89
using osu.Game.Rulesets.Osu;
910
using osu.Game.Rulesets.Osu.Mods;
@@ -42,7 +43,7 @@ public record ModTestCase(string Description, IEnumerable<Mod> Mods)
4243
public override void SetUp()
4344
{
4445
base.SetUp();
45-
calculator = new OsuRuleset().CreateScoreMultiplierCalculator(new ScoreMultiplierContext());
46+
calculator = new OsuRuleset().CreateScoreMultiplierCalculator(new ScoreMultiplierContext(new BeatmapDifficulty()));
4647
}
4748

4849
[Benchmark]

osu.Game.Rulesets.Mania.Tests/ManiaScoreMultiplierTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using NUnit.Framework;
66
using osu.Framework.Utils;
7+
using osu.Game.Beatmaps;
78
using osu.Game.Rulesets.Mania.Mods;
89
using osu.Game.Rulesets.Mods;
910
using osu.Game.Rulesets.Scoring;
@@ -212,7 +213,7 @@ [new DateTimeOffset(2026, 7, 18, 0, 20, 15, 0, TimeSpan.Zero), "2026.522.1-tachy
212213
[TestCaseSource(nameof(key_mod_multiplier_test_cases))]
213214
public void TestKeyModMultiplierCompatibility(DateTimeOffset endDate, string clientVersion, double expectedMultiplier)
214215
{
215-
var calculator = Ruleset.CreateScoreMultiplierCalculator(new ScoreMultiplierContext(new ScoreInfo
216+
var calculator = Ruleset.CreateScoreMultiplierCalculator(new ScoreMultiplierContext(new BeatmapDifficulty(), new ScoreInfo
216217
{
217218
Date = endDate,
218219
ClientVersion = clientVersion

osu.Game.Rulesets.Mania.Tests/Mods/TestSceneManiaModDoubleTime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void TestHitWindowWithDoubleTime()
5656
Mod = doubleTime,
5757
PassCondition = () => Player.ScoreProcessor.JudgedHits > 0
5858
&& Player.ScoreProcessor.Accuracy.Value == 1
59-
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * new ManiaScoreMultiplierCalculator(new ScoreMultiplierContext()).CalculateFor([doubleTime])),
59+
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * new ManiaScoreMultiplierCalculator(new ScoreMultiplierContext(new BeatmapDifficulty())).CalculateFor([doubleTime])),
6060
Autoplay = false,
6161
CreateBeatmap = () => new Beatmap
6262
{

0 commit comments

Comments
 (0)