Skip to content

Commit

Permalink
📝 Chore: Better cheese scripts support
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynesshely committed Sep 28, 2024
1 parent a1a3e31 commit db5a04a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 19 deletions.
10 changes: 10 additions & 0 deletions .cheese/KitX.cheese.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- <OutputType>Exe</OutputType> -->
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
40 changes: 22 additions & 18 deletions .cheese/scripts/publish.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
using System.Diagnostics;
using System.Text.Json;
using System.IO.Compression;
using System.Text.Json;
using Common.BasicHelper.Utils.Extensions;
using Spectre.Console;

AnsiConsole.Write(
new FigletText("KitX Publisher")
.Centered()
.Color(Color.Blue)
);
AnsiConsole.Write(new FigletText("KitX Publisher").Centered().Color(Color.Blue));

PathHelper.Instance.AssertInSlnDirectory(out _);

var baseDir = PathHelper.Instance.BaseSlnDir;

var publishDir = $"{baseDir}/KitX Publish".GetFullPath();

if (Directory.Exists(publishDir) /* && !options.SkipGenerating */)
if (Directory.Exists(publishDir))
foreach (var dir in new DirectoryInfo(publishDir).GetDirectories())
Directory.Delete(dir.FullName, true);

Expand All @@ -25,11 +21,7 @@

var path = $"{baseDir}/KitX Clients/KitX Dashboard/KitX Dashboard/".GetFullPath();
var abPubPath = $"{path}{pro}{pub}".GetFullPath();
var files = Directory.GetFiles(
abPubPath,
"*.pubxml",
SearchOption.AllDirectories
);
var files = Directory.GetFiles(abPubPath, "*.pubxml", SearchOption.AllDirectories);

var logsDir = $"{publishDir}/logs".GetFullPath();
var log = $"{logsDir}/log-{DateTime.Now:yyyy-MM-dd-HH-mm-ss}.log".GetFullPath();
Expand Down Expand Up @@ -64,7 +56,9 @@
AnsiConsole.Write(new Rule($"[blue]Begin Generating[/]"));
AnsiConsole.MarkupLine($"{prompt} Found {files.Length} profiles");
AnsiConsole.Markup($"{prompt} Generating logs at: \"{Path.GetRelativePath(baseDir, log)}\"");
AnsiConsole.Markup(
$"{prompt} Generating logs at: \"{Path.GetRelativePath(baseDir, log)}\""
);
AnsiConsole.WriteLine();
packTask.IsIndeterminate = true;
Expand All @@ -74,7 +68,11 @@
var index = executingThreadIndex++;
var filename = Path.GetFileName(item);
const string cmd = "dotnet";
var arg = $"publish \"{(path + "/KitX.Dashboard.csproj").GetFullPath()}\" \"/p:PublishProfile={item}\"";
var arg = new StringBuilder()
.Append("publish ")
.Append($"\"{(path + "/KitX.Dashboard.csproj").GetFullPath()}\" ")
.Append($"\"/p:PublishProfile={item}\"")
.ToString();
AnsiConsole.MarkupLine($"{prompt} 📄 [white]{filename}[/]: [gray]{cmd} {arg}[/]");
Expand All @@ -86,7 +84,7 @@
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
RedirectStandardError = true,
};
process.StartInfo = psi;
process.Start();
Expand All @@ -104,7 +102,9 @@
genTask.Increment((1.0 / files.Length) * 100);
AnsiConsole.MarkupLine($"{prompt} Finished task_{index}, still {files.Length - finishedThreads} tasks waiting");
AnsiConsole.MarkupLine(
$"{prompt} Finished task_{index}, still {files.Length - finishedThreads} tasks waiting"
);
AnsiConsole.Write(new Rule($"[red]Finished task-{index}[/]"));
}
Expand All @@ -118,7 +118,9 @@
AnsiConsole.MarkupLine($"{prompt} Begin packing.");
if (packIgnoreExists)
AnsiConsole.MarkupLine($"{prompt} `.packignore` not exists, all folder will be packed.");
AnsiConsole.MarkupLine(
$"{prompt} `.packignore` not exists, all folder will be packed."
);
packTask.IsIndeterminate = false;
Expand Down Expand Up @@ -147,7 +149,9 @@
true
);
AnsiConsole.MarkupLine($" Packed to {Path.GetRelativePath(baseDir, zipFileName)}");
AnsiConsole.MarkupLine(
$" Packed to {Path.GetRelativePath(baseDir, zipFileName)}"
);
packTask.Increment((1.0 / folders.Count) * 100);
}
Expand Down
22 changes: 22 additions & 0 deletions KitX.sln
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Units", "Units", "{2E7D2566
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SyncCodes", "KitX SDK\Utils\SyncCodes\SyncCodes.csproj", "{4D8ED1CF-E2FF-4666-88D5-7D5300014301}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KitX.cheese", ".cheese\KitX.cheese.csproj", "{3EF56BF7-2969-4FBB-A445-1D43F8666502}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -705,6 +707,26 @@ Global
{4D8ED1CF-E2FF-4666-88D5-7D5300014301}.Release|x64.Build.0 = Release|Any CPU
{4D8ED1CF-E2FF-4666-88D5-7D5300014301}.Release|x86.ActiveCfg = Release|Any CPU
{4D8ED1CF-E2FF-4666-88D5-7D5300014301}.Release|x86.Build.0 = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|ARM.Build.0 = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|ARM64.Build.0 = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|x64.ActiveCfg = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|x64.Build.0 = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|x86.ActiveCfg = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Debug|x86.Build.0 = Debug|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|Any CPU.Build.0 = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|ARM.ActiveCfg = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|ARM.Build.0 = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|ARM64.ActiveCfg = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|ARM64.Build.0 = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|x64.ActiveCfg = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|x64.Build.0 = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|x86.ActiveCfg = Release|Any CPU
{3EF56BF7-2969-4FBB-A445-1D43F8666502}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit db5a04a

Please sign in to comment.