|
@@ -1,24 +1,13 @@
|
|
-using System;
|
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.IO.Compression;
|
|
using System.IO.Compression;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
-using Nuke.Common;
|
|
|
|
using Nuke.Common.IO;
|
|
using Nuke.Common.IO;
|
|
using Numerge;
|
|
using Numerge;
|
|
|
|
+using static Serilog.Log;
|
|
|
|
|
|
public partial class Build
|
|
public partial class Build
|
|
{
|
|
{
|
|
- internal static void Information(string info)
|
|
|
|
- {
|
|
|
|
- Logger.Info(info);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- internal static void Information(string info, params object[] args)
|
|
|
|
- {
|
|
|
|
- Logger.Info(info, args);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void Zip(AbsolutePath target, params string[] paths) => Zip(target, paths.AsEnumerable());
|
|
private void Zip(AbsolutePath target, params string[] paths) => Zip(target, paths.AsEnumerable());
|
|
|
|
|
|
private void Zip(AbsolutePath target, IEnumerable<string> paths)
|
|
private void Zip(AbsolutePath target, IEnumerable<string> paths)
|
|
@@ -44,16 +33,12 @@ public partial class Build
|
|
if (Directory.Exists(path))
|
|
if (Directory.Exists(path))
|
|
{
|
|
{
|
|
var dirInfo = new DirectoryInfo(path);
|
|
var dirInfo = new DirectoryInfo(path);
|
|
- var rootPath = Path.GetDirectoryName(dirInfo.FullName);
|
|
|
|
|
|
+ var rootPath = Path.GetDirectoryName(dirInfo.FullName)!;
|
|
foreach(var fsEntry in dirInfo.EnumerateFileSystemInfos("*", SearchOption.AllDirectories))
|
|
foreach(var fsEntry in dirInfo.EnumerateFileSystemInfos("*", SearchOption.AllDirectories))
|
|
{
|
|
{
|
|
if (fsEntry is FileInfo)
|
|
if (fsEntry is FileInfo)
|
|
{
|
|
{
|
|
-#if NET6
|
|
|
|
var relPath = Path.GetRelativePath(rootPath, fsEntry.FullName);
|
|
var relPath = Path.GetRelativePath(rootPath, fsEntry.FullName);
|
|
-#else
|
|
|
|
- var relPath = GetRelativePath(rootPath, fsEntry.FullName);
|
|
|
|
-#endif
|
|
|
|
AddFile(fsEntry.FullName, relPath);
|
|
AddFile(fsEntry.FullName, relPath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -82,27 +67,16 @@ 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
|
|
class NumergeNukeLogger : INumergeLogger
|
|
{
|
|
{
|
|
public void Log(NumergeLogLevel level, string message)
|
|
public void Log(NumergeLogLevel level, string message)
|
|
{
|
|
{
|
|
if(level == NumergeLogLevel.Error)
|
|
if(level == NumergeLogLevel.Error)
|
|
- Logger.Error(message);
|
|
|
|
|
|
+ Error(message);
|
|
else if (level == NumergeLogLevel.Warning)
|
|
else if (level == NumergeLogLevel.Warning)
|
|
- Logger.Warn(message);
|
|
|
|
|
|
+ Warning(message);
|
|
else
|
|
else
|
|
- Logger.Info(message);
|
|
|
|
|
|
+ Information(message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|