From c9ccf6cee841da12ec479586457059ce69c4e821 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 10 May 2024 21:48:42 +0200 Subject: [PATCH 01/27] Disable NPM --- MudBlazor.Markdown/MudBlazor.Markdown.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MudBlazor.Markdown/MudBlazor.Markdown.csproj b/MudBlazor.Markdown/MudBlazor.Markdown.csproj index 5cc94f5..283b869 100644 --- a/MudBlazor.Markdown/MudBlazor.Markdown.csproj +++ b/MudBlazor.Markdown/MudBlazor.Markdown.csproj @@ -30,7 +30,7 @@ - + From 1c5451fccf242a8d65f6994df2d94bdb07e58811 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 10 May 2024 21:49:26 +0200 Subject: [PATCH 02/27] Configured Gitlab server --- app/.idea/.idea.MindWork AI Studio/.idea/misc.xml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/.idea/.idea.MindWork AI Studio/.idea/misc.xml diff --git a/app/.idea/.idea.MindWork AI Studio/.idea/misc.xml b/app/.idea/.idea.MindWork AI Studio/.idea/misc.xml new file mode 100644 index 0000000..92330fe --- /dev/null +++ b/app/.idea/.idea.MindWork AI Studio/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 64cbf1fcb35ce2cfba766971f5ff3d36b880715d Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 10 May 2024 21:51:36 +0200 Subject: [PATCH 03/27] Added a cross-platform build script --- app/MindWork AI Studio/build.nu | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 app/MindWork AI Studio/build.nu diff --git a/app/MindWork AI Studio/build.nu b/app/MindWork AI Studio/build.nu new file mode 100755 index 0000000..5928261 --- /dev/null +++ b/app/MindWork AI Studio/build.nu @@ -0,0 +1,29 @@ +#!/usr/bin/env nu + +build + +def build [] { + # Define the list of RIDs to build for, cf. https://learn.microsoft.com/en-us/dotnet/core/rid-catalog: + let rids = ["win-x64", "win-arm64", "linux-x64", "linux-arm64", "osx-arm64", "osx-x64"] + + # Get the current OS: + let current_os = (sys).host.name | str downcase + let current_os = match $current_os { + "windows" => "win-", + "linux" => "linux-", + "darwin" => "osx-", + _ => { + print $"Unsupported OS: ($current_os)" + return + } + } + + # Filter the RIDs to build for the current OS: + let rids = $rids | where $it =~ $current_os + + # Build for each RID: + for rid in $rids { + print $"Start building for ($rid)..." + ^dotnet publish -c release -r $rid + } +} \ No newline at end of file From 3b4d44dbe68b9ae72bc5ee39d06bc5f0e94f65a8 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 10 May 2024 21:52:19 +0200 Subject: [PATCH 04/27] Configured publishing, trimming, and static file embedding --- .../MindWork AI Studio.csproj | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/MindWork AI Studio/MindWork AI Studio.csproj b/app/MindWork AI Studio/MindWork AI Studio.csproj index 35c8a30..d9f2504 100644 --- a/app/MindWork AI Studio/MindWork AI Studio.csproj +++ b/app/MindWork AI Studio/MindWork AI Studio.csproj @@ -7,15 +7,37 @@ enable AIStudio mindworkAIStudio + + true + true + true + true + + true + partial + true + false + false + true + true + IL2026 + + + + + + + + From 58f8875015d4cdd8bba27e4dcc277db711057fb3 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Fri, 10 May 2024 21:52:37 +0200 Subject: [PATCH 05/27] Enabled static file embedding --- app/MindWork AI Studio/Program.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/MindWork AI Studio/Program.cs b/app/MindWork AI Studio/Program.cs index 46e21ac..016ae09 100644 --- a/app/MindWork AI Studio/Program.cs +++ b/app/MindWork AI Studio/Program.cs @@ -1,8 +1,12 @@ +using System.Reflection; + using AIStudio; using AIStudio.Components; using AIStudio.Settings; using AIStudio.Tools; +using Microsoft.Extensions.FileProviders; + using MudBlazor; using MudBlazor.Services; @@ -31,13 +35,16 @@ builder.Services.AddRazorComponents() x.MaximumReceiveMessageSize = null; }); -builder.WebHost.UseKestrel(); -builder.WebHost.UseWebRoot("wwwroot"); -builder.WebHost.UseStaticWebAssets(); builder.WebHost.UseUrls("http://localhost:5000"); +var fileProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(type: typeof(Program))!, "wwwroot"); var app = builder.Build(); -app.UseStaticFiles(); +app.UseStaticFiles(new StaticFileOptions +{ + FileProvider = fileProvider, + RequestPath = string.Empty, +}); + app.UseAntiforgery(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); From f15c6b4878210303a8caa596e0f73bd61f7a0a6f Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 11 May 2024 13:30:17 +0200 Subject: [PATCH 06/27] Use the port provided by args or default 5000 for dev --- app/MindWork AI Studio/Program.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/MindWork AI Studio/Program.cs b/app/MindWork AI Studio/Program.cs index 016ae09..ad90b05 100644 --- a/app/MindWork AI Studio/Program.cs +++ b/app/MindWork AI Studio/Program.cs @@ -10,7 +10,7 @@ using Microsoft.Extensions.FileProviders; using MudBlazor; using MudBlazor.Services; -var builder = WebApplication.CreateBuilder(args); +var builder = WebApplication.CreateBuilder(); builder.Services.AddMudServices(config => { config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft; @@ -35,7 +35,8 @@ builder.Services.AddRazorComponents() x.MaximumReceiveMessageSize = null; }); -builder.WebHost.UseUrls("http://localhost:5000"); +var port = args.Length > 0 ? args[0] : "5000"; +builder.WebHost.UseUrls($"http://localhost:{port}"); var fileProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(type: typeof(Program))!, "wwwroot"); var app = builder.Build(); From 18d53a09dcc2116e18b4c44e35fab055faa5a923 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 11 May 2024 13:31:54 +0200 Subject: [PATCH 07/27] Move compiled .NET app to dist folder using expected platform naming --- app/MindWork AI Studio/build.nu | 45 +++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/app/MindWork AI Studio/build.nu b/app/MindWork AI Studio/build.nu index 5928261..375f1ed 100755 --- a/app/MindWork AI Studio/build.nu +++ b/app/MindWork AI Studio/build.nu @@ -3,27 +3,68 @@ build def build [] { + + # Ensure, that the dist directory exists: + mkdir bin/dist + # Define the list of RIDs to build for, cf. https://learn.microsoft.com/en-us/dotnet/core/rid-catalog: let rids = ["win-x64", "win-arm64", "linux-x64", "linux-arm64", "osx-arm64", "osx-x64"] # Get the current OS: let current_os = (sys).host.name | str downcase - let current_os = match $current_os { + let current_os_dotnet = match $current_os { "windows" => "win-", "linux" => "linux-", "darwin" => "osx-", + _ => { print $"Unsupported OS: ($current_os)" return } } + let published_filename_dotnet = match $current_os { + "windows" => "mindworkAIStudio.exe", + _ => "mindworkAIStudio" + } + # Filter the RIDs to build for the current OS: - let rids = $rids | where $it =~ $current_os + let rids = $rids | where $it =~ $current_os_dotnet # Build for each RID: for rid in $rids { + print "==============================" print $"Start building for ($rid)..." + ^dotnet publish -c release -r $rid + + let final_filename = match $rid { + "win-x64" => "mindworkAIStudio-x86_64-pc-windows-msvc.exe", + "win-arm64" => "mindworkAIStudio-aarch64-pc-windows-msvc.exe", + "linux-x64" => "mindworkAIStudio-x86_64-unknown-linux-gnu", + "linux-arm64" => "mindworkAIStudio-aarch64-unknown-linux-gnu", + "osx-arm64" => "mindworkAIStudio-aarch64-apple-darwin", + "osx-x64" => "mindworkAIStudio-x86_64-apple-darwin", + + _ => { + print $"Unsupported RID for final filename: ($rid)" + return + } + } + + let published_path = $"bin/release/net8.0/($rid)/publish/($published_filename_dotnet)" + let final_path = $"bin/dist/($final_filename)" + + if ($published_path | path exists) { + print $"Published file ($published_path) exists." + } else { + print $"Published file ($published_path) does not exist. Compiling might failed?" + return + } + + print $"Moving ($published_path) to ($final_path)..." + mv --force $published_path $final_path } + + print "==============================" } \ No newline at end of file From a45d162d2aac59ddcb1a8f9463e10cad1265a42e Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 12 May 2024 14:31:33 +0200 Subject: [PATCH 08/27] Update --- app/.run/AI Studio.run.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/.run/AI Studio.run.xml b/app/.run/AI Studio.run.xml index 7256936..061dae6 100644 --- a/app/.run/AI Studio.run.xml +++ b/app/.run/AI Studio.run.xml @@ -1,6 +1,6 @@ -