mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-05-03 09:39:47 +00:00
Refactor RID handling to use the current RID only
This commit is contained in:
parent
aac8b25ae2
commit
cd4fafed1f
@ -17,5 +17,10 @@ public sealed class CheckRidsCommand
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"- {rid}");
|
Console.WriteLine($"- {rid}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine("The RID for the current OS and CPU is:");
|
||||||
|
var currentRid = Environment.GetCurrentRid();
|
||||||
|
Console.WriteLine($"- {currentRid}");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -105,9 +105,8 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
// Build the .NET project:
|
// Build the .NET project:
|
||||||
//
|
//
|
||||||
var pathApp = Environment.GetAIStudioDirectory();
|
var pathApp = Environment.GetAIStudioDirectory();
|
||||||
var rids = Environment.GetRidsForCurrentOS();
|
var rid = Environment.GetCurrentRid();
|
||||||
foreach (var rid in rids)
|
|
||||||
{
|
|
||||||
Console.WriteLine("==============================");
|
Console.WriteLine("==============================");
|
||||||
await this.UpdateArchitecture(rid);
|
await this.UpdateArchitecture(rid);
|
||||||
|
|
||||||
@ -196,14 +195,9 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
Console.WriteLine($" - Error: {e.Message}");
|
Console.WriteLine($" - Error: {e.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build the Rust project / runtime:
|
// Build the Rust project / runtime:
|
||||||
//
|
//
|
||||||
|
|
||||||
Console.WriteLine("==============================");
|
|
||||||
Console.WriteLine("- Start building the Rust runtime ...");
|
Console.WriteLine("- Start building the Rust runtime ...");
|
||||||
|
|
||||||
var pathRuntime = Environment.GetRustRuntimeDirectory();
|
var pathRuntime = Environment.GetRustRuntimeDirectory();
|
||||||
|
@ -17,7 +17,7 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
Console.WriteLine("=========================");
|
Console.WriteLine("=========================");
|
||||||
Console.Write("- Updating web assets ...");
|
Console.Write("- Updating web assets ...");
|
||||||
|
|
||||||
var rid = Environment.GetRidsForCurrentOS().First();
|
var rid = Environment.GetCurrentRid();
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
||||||
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
||||||
|
@ -76,4 +76,38 @@ public static class Environment
|
|||||||
Console.WriteLine($"Error: Unsupported OS '{RuntimeInformation.OSDescription}'");
|
Console.WriteLine($"Error: Unsupported OS '{RuntimeInformation.OSDescription}'");
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RID GetCurrentRid()
|
||||||
|
{
|
||||||
|
var arch = RuntimeInformation.ProcessArchitecture;
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
return arch switch
|
||||||
|
{
|
||||||
|
Architecture.X64 => RID.WIN_X64,
|
||||||
|
Architecture.Arm64 => RID.WIN_ARM64,
|
||||||
|
|
||||||
|
_ => RID.NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
return arch switch
|
||||||
|
{
|
||||||
|
Architecture.X64 => RID.OSX_X64,
|
||||||
|
Architecture.Arm64 => RID.OSX_ARM64,
|
||||||
|
|
||||||
|
_ => RID.NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
return arch switch
|
||||||
|
{
|
||||||
|
Architecture.X64 => RID.LINUX_X64,
|
||||||
|
Architecture.Arm64 => RID.LINUX_ARM64,
|
||||||
|
|
||||||
|
_ => RID.NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
Console.WriteLine($"Error: Unsupported OS '{RuntimeInformation.OSDescription}'");
|
||||||
|
return RID.NONE;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user