fix pubtool

This commit is contained in:
Aigio Liu
2022-07-22 08:21:05 +08:00
parent ad67ca2350
commit 1df8039650
2 changed files with 17 additions and 45 deletions
+15 -23
View File
@@ -195,31 +195,23 @@ namespace System.Application.Steps
Console.WriteLine("7z Step 正在创建压缩包...");
// 创建压缩包
var gs = publishDirs.Select(x => Task.Run(() => GenerateCompressedPackage(dev, x)));
foreach (var item in gs.ToArray())
PerformanceCounter? ramCounter = null;
if (OperatingSystem2.IsWindows())
{
await item;
var processName = Process.GetCurrentProcess().ProcessName;
ramCounter = new PerformanceCounter("Process", "Working Set", processName);
}
void WriteRAMLine()
{
if (ramCounter != null)
Console.WriteLine($"Working Set: {IOPath.GetDisplayFileSizeString(ramCounter.NextValue())}");
}
foreach (var item in publishDirs)
{
WriteRAMLine();
GenerateCompressedPackage(dev, item);
WriteRAMLine();
}
//parallelTasks.AddRange(gs);
//var processorCount = Environment.ProcessorCount;
//if (processorCount < 2) processorCount = 2;
//var parallelCount = processorCount;
//if (parallelTasks.Count > parallelCount)
//{
// var count = 0;
// while (true)
// {
// var parallelTasksSplit = parallelTasks.Skip(count++ * parallelCount).Take(parallelCount).ToArray();
// if (!parallelTasksSplit.Any()) break;
// await Task.WhenAll(parallelTasksSplit);
// }
//}
//else
//{
// await Task.WhenAll(parallelTasks);
//}
//parallelTasks.Clear();
if (hasWindows)
{
+2 -22
View File
@@ -86,8 +86,6 @@ namespace System.Application
dirNames = dirNames.ThrowIsNull(nameof(dirNames));
var parallelTasks = dirNames.Select(x => Task.Run(() => Step_cd.GenerateCompressedPackage(dev, x, type))).ToArray();
PerformanceCounter? ramCounter = null;
if (OperatingSystem2.IsWindows())
{
@@ -99,30 +97,12 @@ namespace System.Application
if (ramCounter != null)
Console.WriteLine($"Working Set: {IOPath.GetDisplayFileSizeString(ramCounter.NextValue())}");
}
foreach (var item in parallelTasks)
foreach (var item in dirNames)
{
WriteRAMLine();
await item;
Step_cd.GenerateCompressedPackage(dev, item, type);
WriteRAMLine();
}
//var processorCount = Environment.ProcessorCount;
//if (processorCount < 2) processorCount = 2;
//var parallelCount = processorCount;
//if (parallelTasks.Length > parallelCount)
//{
// var count = 0;
// while (true)
// {
// var parallelTasksSplit = parallelTasks.Skip(count++ * parallelCount).Take(parallelCount).ToArray();
// if (!parallelTasksSplit.Any()) break;
// await Task.WhenAll(parallelTasksSplit);
// }
//}
//else
//{
// await Task.WhenAll(parallelTasks);
//}
SavePublishJson(dirNames, removeFiles: false);