From 97ca9e3fe5f7b73905302a6ff9dbef25be34a8d5 Mon Sep 17 00:00:00 2001 From: Benedikt Stebner Date: Wed, 5 Oct 2022 16:01:40 +0200 Subject: [PATCH] One more --- dirs.proj | 5 +---- nukebuild/Build.cs | 2 +- nukebuild/Shims.cs | 15 +++++++++++++++ nukebuild/_build.csproj | 12 ++++++------ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/dirs.proj b/dirs.proj index bbed92a3cc..2dc5e7793c 100644 --- a/dirs.proj +++ b/dirs.proj @@ -23,10 +23,7 @@ - - - - + diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index 65d7817dba..f965080add 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -225,7 +225,7 @@ partial class Build : NukeBuild void DoMemoryTest() { var testAssembly = "tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll"; - DotMemoryUnit( + DotMemoryUnit( $"{XunitPath.DoubleQuoteIfNeeded()} --propagate-exit-code -- {testAssembly}", timeout: 120_000); } diff --git a/nukebuild/Shims.cs b/nukebuild/Shims.cs index 1ac14bf622..6f79972ad6 100644 --- a/nukebuild/Shims.cs +++ b/nukebuild/Shims.cs @@ -49,7 +49,11 @@ public partial class Build { if (fsEntry is FileInfo) { +#if NET6 var relPath = Path.GetRelativePath(rootPath, fsEntry.FullName); +#else + var relPath = GetRelativePath(rootPath, fsEntry.FullName); +#endif AddFile(fsEntry.FullName, relPath); } } @@ -78,6 +82,17 @@ public partial class Build } } + private static string GetRelativePath(string relativeTo, string path) + { + var uri = new Uri(relativeTo); + var rel = Uri.UnescapeDataString(uri.MakeRelativeUri(new Uri(path)).ToString()).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); + if (rel.Contains(Path.DirectorySeparatorChar.ToString()) == false) + { + rel = $".{Path.DirectorySeparatorChar}{rel}"; + } + return rel; + } + class NumergeNukeLogger : INumergeLogger { public void Log(NumergeLogLevel level, string message) diff --git a/nukebuild/_build.csproj b/nukebuild/_build.csproj index 6fa901d3cb..5db9579876 100644 --- a/nukebuild/_build.csproj +++ b/nukebuild/_build.csproj @@ -1,27 +1,27 @@  - Exe - net6.0 false False CS0649;CS0169 1 + net6.0 + - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +