diff --git a/app/Build/Commands/CollectI18NKeysCommand.cs b/app/Build/Commands/CollectI18NKeysCommand.cs index 1e41640d..8b2554bf 100644 --- a/app/Build/Commands/CollectI18NKeysCommand.cs +++ b/app/Build/Commands/CollectI18NKeysCommand.cs @@ -16,6 +16,9 @@ public sealed partial class CollectI18NKeysCommand if(!Environment.IsWorkingDirectoryValid()) return; + Console.WriteLine("========================="); + Console.Write("- Collecting I18N keys ..."); + var cwd = Environment.GetAIStudioDirectory(); var binPath = Path.Join(cwd, "bin"); var objPath = Path.Join(cwd, "obj"); @@ -52,7 +55,8 @@ public sealed partial class CollectI18NKeysCommand } } - Console.WriteLine($"{counter:###,###} files processed."); + Console.WriteLine($" {counter:###,###} files processed."); + Console.WriteLine(); } private List FindAllTextTags(ReadOnlySpan fileContent) diff --git a/app/Build/Commands/UpdateMetadataCommands.cs b/app/Build/Commands/UpdateMetadataCommands.cs index 18539955..8a8aa9d3 100644 --- a/app/Build/Commands/UpdateMetadataCommands.cs +++ b/app/Build/Commands/UpdateMetadataCommands.cs @@ -11,9 +11,40 @@ namespace Build.Commands; public sealed partial class UpdateMetadataCommands { - [Command("prepare", Description = "Prepare the next release")] + [Command("release", Description = "Prepare & build the next release")] + public async Task Release(PrepareAction action) + { + if(!Environment.IsWorkingDirectoryValid()) + return; + + // Prepare the metadata for the next release: + await this.Prepare(action); + + // Build once to allow the Rust compiler to read the changed metadata + // and to update all .NET artifacts: + await this.Build(); + + // Now, we update the web assets (which may were updated by the first build): + new UpdateWebAssetsCommand().UpdateWebAssets(); + + // Collect the I18N keys from the source code. This step yields a I18N file + // that must be part of the final release: + await new CollectI18NKeysCommand().CollectI18NKeys(); + + // Build the final release, where Rust knows the updated metadata, the .NET + // artifacts are already in place, and .NET knows the updated web assets, etc.: + await this.Build(); + } + + [Command("prepare", Description = "Prepare the metadata for the next release")] public async Task Prepare(PrepareAction action) { + if(!Environment.IsWorkingDirectoryValid()) + return; + + Console.WriteLine("=============================="); + Console.WriteLine("- Prepare the metadata for the next release ..."); + var appVersion = await this.UpdateAppVersion(action); if (!string.IsNullOrWhiteSpace(appVersion)) { @@ -27,12 +58,16 @@ public sealed partial class UpdateMetadataCommands await this.UpdateProjectCommitHash(); await this.UpdateLicenceYear(Path.GetFullPath(Path.Combine(Environment.GetAIStudioDirectory(), "..", "..", "LICENSE.md"))); await this.UpdateLicenceYear(Path.GetFullPath(Path.Combine(Environment.GetAIStudioDirectory(), "Pages", "About.razor.cs"))); + Console.WriteLine(); } } [Command("build", Description = "Build MindWork AI Studio")] public async Task Build() { + if(!Environment.IsWorkingDirectoryValid()) + return; + // // Build the .NET project: // @@ -156,7 +191,10 @@ public sealed partial class UpdateMetadataCommands if(foundRustIssue) Console.WriteLine(); else + { Console.WriteLine(" completed successfully."); + Console.WriteLine(); + } } private async Task UpdateChangelog(int buildNumber, string appVersion, string buildTime) diff --git a/app/Build/Commands/UpdateWebAssetsCommand.cs b/app/Build/Commands/UpdateWebAssetsCommand.cs index fc757db3..33dc9b04 100644 --- a/app/Build/Commands/UpdateWebAssetsCommand.cs +++ b/app/Build/Commands/UpdateWebAssetsCommand.cs @@ -13,6 +13,9 @@ public sealed class UpdateWebAssetsCommand { if(!Environment.IsWorkingDirectoryValid()) return; + + Console.WriteLine("========================="); + Console.Write("- Updating web assets ..."); var rid = Environment.GetRidsForCurrentOS().First(); var cwd = Environment.GetAIStudioDirectory(); @@ -20,7 +23,8 @@ public sealed class UpdateWebAssetsCommand var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor")); if (!isMudBlazorDirectoryPresent) { - Console.WriteLine($"No web assets found for RID '{rid}'. Please publish the project first."); + Console.WriteLine(); + Console.WriteLine($"- Error: No web assets found for RID '{rid}'. Please publish the project first."); return; } @@ -38,7 +42,8 @@ public sealed class UpdateWebAssetsCommand File.Copy(sourcePath, targetPath, true); } - - Console.WriteLine($"{counter:###,###} web assets updated successfully."); + + Console.WriteLine($" {counter:###,###} web assets updated successfully."); + Console.WriteLine(); } } \ No newline at end of file