mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-27 15:39:47 +00:00
Added the current CPU architecture to the metadata (#402)
This commit is contained in:
parent
c715b38f41
commit
b153b9c4e9
9
.github/workflows/build-and-release.yml
vendored
9
.github/workflows/build-and-release.yml
vendored
@ -160,6 +160,9 @@ jobs:
|
|||||||
# Format the app version:
|
# Format the app version:
|
||||||
formatted_app_version="v${app_version}"
|
formatted_app_version="v${app_version}"
|
||||||
|
|
||||||
|
# Set the architecture:
|
||||||
|
sed -i '' "10s/.*/${{ matrix.dotnet_runtime }}/" metadata.txt
|
||||||
|
|
||||||
# Write the metadata to the environment:
|
# Write the metadata to the environment:
|
||||||
echo "APP_VERSION=${app_version}" >> $GITHUB_ENV
|
echo "APP_VERSION=${app_version}" >> $GITHUB_ENV
|
||||||
echo "FORMATTED_APP_VERSION=${formatted_app_version}" >> $GITHUB_ENV
|
echo "FORMATTED_APP_VERSION=${formatted_app_version}" >> $GITHUB_ENV
|
||||||
@ -212,6 +215,12 @@ jobs:
|
|||||||
# Format the app version:
|
# Format the app version:
|
||||||
$formatted_app_version = "v${app_version}"
|
$formatted_app_version = "v${app_version}"
|
||||||
|
|
||||||
|
# Set the architecture:
|
||||||
|
$metadata[9] = "${{ matrix.dotnet_runtime }}"
|
||||||
|
|
||||||
|
# Write the changed metadata back to the file:
|
||||||
|
Set-Content -Path metadata.txt -Value $metadata
|
||||||
|
|
||||||
# Write the metadata to the environment:
|
# Write the metadata to the environment:
|
||||||
Write-Output "APP_VERSION=${app_version}" >> $env:GITHUB_ENV
|
Write-Output "APP_VERSION=${app_version}" >> $env:GITHUB_ENV
|
||||||
Write-Output "FORMATTED_APP_VERSION=${formatted_app_version}" >> $env:GITHUB_ENV
|
Write-Output "FORMATTED_APP_VERSION=${formatted_app_version}" >> $env:GITHUB_ENV
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using Build.Tools;
|
using SharedTools;
|
||||||
|
|
||||||
namespace Build.Commands;
|
namespace Build.Commands;
|
||||||
|
|
||||||
@ -77,9 +77,11 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
foreach (var rid in rids)
|
foreach (var rid in rids)
|
||||||
{
|
{
|
||||||
Console.WriteLine("==============================");
|
Console.WriteLine("==============================");
|
||||||
Console.Write($"- Start .NET build for '{rid.ToName()}' ...");
|
await this.UpdateArchitecture(rid);
|
||||||
await this.ReadCommandOutput(pathApp, "dotnet", $"clean --configuration release --runtime {rid.ToName()}");
|
|
||||||
var dotnetBuildOutput = await this.ReadCommandOutput(pathApp, "dotnet", $"publish --configuration release --runtime {rid.ToName()} --disable-build-servers --force");
|
Console.Write($"- Start .NET build for '{rid.AsMicrosoftRid()}' ...");
|
||||||
|
await this.ReadCommandOutput(pathApp, "dotnet", $"clean --configuration release --runtime {rid.AsMicrosoftRid()}");
|
||||||
|
var dotnetBuildOutput = await this.ReadCommandOutput(pathApp, "dotnet", $"publish --configuration release --runtime {rid.AsMicrosoftRid()} --disable-build-servers --force");
|
||||||
var dotnetBuildOutputLines = dotnetBuildOutput.Split([global::System.Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
|
var dotnetBuildOutputLines = dotnetBuildOutput.Split([global::System.Environment.NewLine], StringSplitOptions.RemoveEmptyEntries);
|
||||||
var foundIssue = false;
|
var foundIssue = false;
|
||||||
foreach (var buildOutputLine in dotnetBuildOutputLines)
|
foreach (var buildOutputLine in dotnetBuildOutputLines)
|
||||||
@ -125,7 +127,7 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(tauriSidecarArtifactName))
|
if (string.IsNullOrWhiteSpace(tauriSidecarArtifactName))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"- Error: Unsupported rid '{rid.ToName()}'.");
|
Console.WriteLine($"- Error: Unsupported rid '{rid.AsMicrosoftRid()}'.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
_ => "mindworkAIStudio",
|
_ => "mindworkAIStudio",
|
||||||
};
|
};
|
||||||
|
|
||||||
var dotnetPublishedPath = Path.Combine(pathApp, "bin", "release", Environment.DOTNET_VERSION, rid.ToName(), "publish", dotnetArtifactFilename);
|
var dotnetPublishedPath = Path.Combine(pathApp, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", dotnetArtifactFilename);
|
||||||
var finalDestination = Path.Combine(dotnetArtifactPath, tauriSidecarArtifactName);
|
var finalDestination = Path.Combine(dotnetArtifactPath, tauriSidecarArtifactName);
|
||||||
|
|
||||||
if(File.Exists(dotnetPublishedPath))
|
if(File.Exists(dotnetPublishedPath))
|
||||||
@ -235,6 +237,19 @@ public sealed partial class UpdateMetadataCommands
|
|||||||
await File.WriteAllTextAsync(changelogCodePath, changelogCode, Environment.UTF8_NO_BOM);
|
await File.WriteAllTextAsync(changelogCodePath, changelogCode, Environment.UTF8_NO_BOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task UpdateArchitecture(RID rid)
|
||||||
|
{
|
||||||
|
const int ARCHITECTURE_INDEX = 9;
|
||||||
|
|
||||||
|
var pathMetadata = Environment.GetMetadataPath();
|
||||||
|
var lines = await File.ReadAllLinesAsync(pathMetadata, Encoding.UTF8);
|
||||||
|
Console.Write("- Updating architecture ...");
|
||||||
|
lines[ARCHITECTURE_INDEX] = rid.AsMicrosoftRid();
|
||||||
|
|
||||||
|
await File.WriteAllLinesAsync(pathMetadata, lines, Environment.UTF8_NO_BOM);
|
||||||
|
Console.WriteLine(" done.");
|
||||||
|
}
|
||||||
|
|
||||||
private async Task UpdateProjectCommitHash()
|
private async Task UpdateProjectCommitHash()
|
||||||
{
|
{
|
||||||
const int COMMIT_HASH_INDEX = 8;
|
const int COMMIT_HASH_INDEX = 8;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
using Build.Tools;
|
using Build.Tools;
|
||||||
|
|
||||||
|
using SharedTools;
|
||||||
|
|
||||||
namespace Build.Commands;
|
namespace Build.Commands;
|
||||||
|
|
||||||
public sealed class UpdateWebAssetsCommand
|
public sealed class UpdateWebAssetsCommand
|
||||||
@ -19,7 +21,7 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
|
|
||||||
var rid = Environment.GetRidsForCurrentOS().First();
|
var rid = Environment.GetRidsForCurrentOS().First();
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.ToName(), "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"));
|
||||||
if (!isMudBlazorDirectoryPresent)
|
if (!isMudBlazorDirectoryPresent)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using SharedTools;
|
||||||
|
|
||||||
namespace Build.Tools;
|
namespace Build.Tools;
|
||||||
|
|
||||||
public static class Environment
|
public static class Environment
|
||||||
@ -7,7 +9,7 @@ public static class Environment
|
|||||||
public const string DOTNET_VERSION = "net9.0";
|
public const string DOTNET_VERSION = "net9.0";
|
||||||
public static readonly Encoding UTF8_NO_BOM = new UTF8Encoding(false);
|
public static readonly Encoding UTF8_NO_BOM = new UTF8Encoding(false);
|
||||||
|
|
||||||
private static readonly Dictionary<RID, string> ALL_RIDS = Enum.GetValues<RID>().Select(rid => new KeyValuePair<RID, string>(rid, rid.ToName())).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
private static readonly Dictionary<RID, string> ALL_RIDS = Enum.GetValues<RID>().Select(rid => new KeyValuePair<RID, string>(rid, rid.AsMicrosoftRid())).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
|
||||||
|
|
||||||
public static bool IsWorkingDirectoryValid()
|
public static bool IsWorkingDirectoryValid()
|
||||||
{
|
{
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
namespace Build.Tools;
|
|
||||||
|
|
||||||
public static class RIDExtensions
|
|
||||||
{
|
|
||||||
public static string ToName(this RID rid) => rid switch
|
|
||||||
{
|
|
||||||
RID.WIN_X64 => "win-x64",
|
|
||||||
RID.WIN_ARM64 => "win-arm64",
|
|
||||||
|
|
||||||
RID.LINUX_X64 => "linux-x64",
|
|
||||||
RID.LINUX_ARM64 => "linux-arm64",
|
|
||||||
|
|
||||||
RID.OSX_X64 => "osx-x64",
|
|
||||||
RID.OSX_ARM64 => "osx-arm64",
|
|
||||||
|
|
||||||
_ => string.Empty,
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
|
using AIStudio.Tools.Metadata;
|
||||||
using AIStudio.Tools.Rust;
|
using AIStudio.Tools.Rust;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
namespace AIStudio;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Assembly)]
|
|
||||||
public class MetaDataAttribute(
|
|
||||||
string version,
|
|
||||||
string buildTime,
|
|
||||||
uint buildNum,
|
|
||||||
string dotnetSdkVersion,
|
|
||||||
string dotnetVersion,
|
|
||||||
string rustVersion,
|
|
||||||
string mudBlazorVersion,
|
|
||||||
string tauriVersion,
|
|
||||||
string appCommitHash
|
|
||||||
) : Attribute
|
|
||||||
{
|
|
||||||
public string BuildTime { get; } = buildTime;
|
|
||||||
|
|
||||||
public string Version { get; } = version;
|
|
||||||
|
|
||||||
public uint BuildNum { get; } = buildNum;
|
|
||||||
|
|
||||||
public string DotnetVersion { get; } = dotnetVersion;
|
|
||||||
|
|
||||||
public string DotnetSdkVersion { get; } = dotnetSdkVersion;
|
|
||||||
|
|
||||||
public string RustVersion { get; } = rustVersion;
|
|
||||||
|
|
||||||
public string MudBlazorVersion { get; } = mudBlazorVersion;
|
|
||||||
|
|
||||||
public string TauriVersion { get; } = tauriVersion;
|
|
||||||
|
|
||||||
public string AppCommitHash { get; } = appCommitHash;
|
|
||||||
}
|
|
@ -78,6 +78,7 @@
|
|||||||
<MetaMudBlazorVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 6 ])</MetaMudBlazorVersion>
|
<MetaMudBlazorVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 6 ])</MetaMudBlazorVersion>
|
||||||
<MetaTauriVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 7 ])</MetaTauriVersion>
|
<MetaTauriVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 7 ])</MetaTauriVersion>
|
||||||
<MetaAppCommitHash>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 8 ])</MetaAppCommitHash>
|
<MetaAppCommitHash>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 8 ])</MetaAppCommitHash>
|
||||||
|
<MetaArchitecture>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 9 ])</MetaArchitecture>
|
||||||
|
|
||||||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
|
|
||||||
@ -87,7 +88,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AssemblyAttribute Include="AIStudio.MetaDataAttribute">
|
<AssemblyAttribute Include="AIStudio.Tools.Metadata.MetaData">
|
||||||
<_Parameter1>$(MetaVersion)</_Parameter1>
|
<_Parameter1>$(MetaVersion)</_Parameter1>
|
||||||
<_Parameter2>$(MetaBuildTime)</_Parameter2>
|
<_Parameter2>$(MetaBuildTime)</_Parameter2>
|
||||||
<_Parameter3>$(MetaBuild)</_Parameter3>
|
<_Parameter3>$(MetaBuild)</_Parameter3>
|
||||||
@ -99,6 +100,9 @@
|
|||||||
<_Parameter8>$(MetaTauriVersion)</_Parameter8>
|
<_Parameter8>$(MetaTauriVersion)</_Parameter8>
|
||||||
<_Parameter9>$(MetaAppCommitHash)</_Parameter9>
|
<_Parameter9>$(MetaAppCommitHash)</_Parameter9>
|
||||||
</AssemblyAttribute>
|
</AssemblyAttribute>
|
||||||
|
<AssemblyAttribute Include="AIStudio.Tools.Metadata.MetaDataArchitecture">
|
||||||
|
<_Parameter1>$(MetaArchitecture)</_Parameter1>
|
||||||
|
</AssemblyAttribute>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
|
using AIStudio.Tools.Metadata;
|
||||||
using AIStudio.Tools.Rust;
|
using AIStudio.Tools.Rust;
|
||||||
using AIStudio.Tools.Services;
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
using SharedTools;
|
||||||
|
|
||||||
namespace AIStudio.Pages;
|
namespace AIStudio.Pages;
|
||||||
|
|
||||||
public partial class About : ComponentBase
|
public partial class About : ComponentBase
|
||||||
@ -20,6 +23,7 @@ public partial class About : ComponentBase
|
|||||||
|
|
||||||
private static readonly Assembly ASSEMBLY = Assembly.GetExecutingAssembly();
|
private static readonly Assembly ASSEMBLY = Assembly.GetExecutingAssembly();
|
||||||
private static readonly MetaDataAttribute META_DATA = ASSEMBLY.GetCustomAttribute<MetaDataAttribute>()!;
|
private static readonly MetaDataAttribute META_DATA = ASSEMBLY.GetCustomAttribute<MetaDataAttribute>()!;
|
||||||
|
private static readonly MetaDataArchitecture META_DATA_ARCH = ASSEMBLY.GetCustomAttribute<MetaDataArchitecture>()!;
|
||||||
|
|
||||||
private static string VersionDotnetRuntime => $"Used .NET runtime: v{META_DATA.DotnetVersion}";
|
private static string VersionDotnetRuntime => $"Used .NET runtime: v{META_DATA.DotnetVersion}";
|
||||||
|
|
||||||
@ -27,7 +31,7 @@ public partial class About : ComponentBase
|
|||||||
|
|
||||||
private static string VersionRust => $"Used Rust compiler: v{META_DATA.RustVersion}";
|
private static string VersionRust => $"Used Rust compiler: v{META_DATA.RustVersion}";
|
||||||
|
|
||||||
private static string VersionApp => $"MindWork AI Studio: v{META_DATA.Version} (commit {META_DATA.AppCommitHash}, build {META_DATA.BuildNum})";
|
private static string VersionApp => $"MindWork AI Studio: v{META_DATA.Version} (commit {META_DATA.AppCommitHash}, build {META_DATA.BuildNum}, {META_DATA_ARCH.Architecture.ToRID().ToUserFriendlyName()})";
|
||||||
|
|
||||||
private static string BuildTime => $"Build time: {META_DATA.BuildTime}";
|
private static string BuildTime => $"Build time: {META_DATA.BuildTime}";
|
||||||
|
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
namespace AIStudio.Tools.Metadata;
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly)]
|
||||||
|
public class MetaDataArchitecture(string architecture) : Attribute
|
||||||
|
{
|
||||||
|
public string Architecture => architecture;
|
||||||
|
}
|
34
app/MindWork AI Studio/Tools/Metadata/MetaDataAttribute.cs
Normal file
34
app/MindWork AI Studio/Tools/Metadata/MetaDataAttribute.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// ReSharper disable ClassNeverInstantiated.Global
|
||||||
|
namespace AIStudio.Tools.Metadata;
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly)]
|
||||||
|
public class MetaDataAttribute(
|
||||||
|
string version,
|
||||||
|
string buildTime,
|
||||||
|
uint buildNum,
|
||||||
|
string dotnetSdkVersion,
|
||||||
|
string dotnetVersion,
|
||||||
|
string rustVersion,
|
||||||
|
string mudBlazorVersion,
|
||||||
|
string tauriVersion,
|
||||||
|
string appCommitHash
|
||||||
|
) : Attribute
|
||||||
|
{
|
||||||
|
public string BuildTime => buildTime;
|
||||||
|
|
||||||
|
public string Version => version;
|
||||||
|
|
||||||
|
public uint BuildNum => buildNum;
|
||||||
|
|
||||||
|
public string DotnetVersion => dotnetVersion;
|
||||||
|
|
||||||
|
public string DotnetSdkVersion => dotnetSdkVersion;
|
||||||
|
|
||||||
|
public string RustVersion => rustVersion;
|
||||||
|
|
||||||
|
public string MudBlazorVersion => mudBlazorVersion;
|
||||||
|
|
||||||
|
public string TauriVersion => tauriVersion;
|
||||||
|
|
||||||
|
public string AppCommitHash => appCommitHash;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
namespace Build.Tools;
|
namespace SharedTools;
|
||||||
|
|
||||||
public enum RID
|
public enum RID
|
||||||
{
|
{
|
46
app/SharedTools/RIDExtensions.cs
Normal file
46
app/SharedTools/RIDExtensions.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
namespace SharedTools;
|
||||||
|
|
||||||
|
public static class RIDExtensions
|
||||||
|
{
|
||||||
|
public static string AsMicrosoftRid(this RID rid) => rid switch
|
||||||
|
{
|
||||||
|
RID.WIN_X64 => "win-x64",
|
||||||
|
RID.WIN_ARM64 => "win-arm64",
|
||||||
|
|
||||||
|
RID.LINUX_X64 => "linux-x64",
|
||||||
|
RID.LINUX_ARM64 => "linux-arm64",
|
||||||
|
|
||||||
|
RID.OSX_X64 => "osx-x64",
|
||||||
|
RID.OSX_ARM64 => "osx-arm64",
|
||||||
|
|
||||||
|
_ => string.Empty,
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string ToUserFriendlyName(this RID rid) => rid switch
|
||||||
|
{
|
||||||
|
RID.WIN_X64 => "Windows x64",
|
||||||
|
RID.WIN_ARM64 => "Windows ARM64",
|
||||||
|
|
||||||
|
RID.LINUX_X64 => "Linux x64",
|
||||||
|
RID.LINUX_ARM64 => "Linux ARM64",
|
||||||
|
|
||||||
|
RID.OSX_X64 => "macOS x64",
|
||||||
|
RID.OSX_ARM64 => "macOS ARM64",
|
||||||
|
|
||||||
|
_ => "unknown",
|
||||||
|
};
|
||||||
|
|
||||||
|
public static RID ToRID(this string rid) => rid switch
|
||||||
|
{
|
||||||
|
"win-x64" => RID.WIN_X64,
|
||||||
|
"win-arm64" => RID.WIN_ARM64,
|
||||||
|
|
||||||
|
"linux-x64" => RID.LINUX_X64,
|
||||||
|
"linux-arm64" => RID.LINUX_ARM64,
|
||||||
|
|
||||||
|
"osx-x64" => RID.OSX_X64,
|
||||||
|
"osx-arm64" => RID.OSX_ARM64,
|
||||||
|
|
||||||
|
_ => RID.NONE,
|
||||||
|
};
|
||||||
|
}
|
@ -7,3 +7,4 @@
|
|||||||
8.5.1
|
8.5.1
|
||||||
1.8.1
|
1.8.1
|
||||||
19935769035, release
|
19935769035, release
|
||||||
|
osx-arm64
|
@ -2,17 +2,48 @@ use std::path::PathBuf;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri_build::build();
|
tauri_build::build();
|
||||||
|
|
||||||
// Tells Cargo to re-run this script only, when the version.txt file was changed:
|
|
||||||
println!("cargo:rerun-if-changed=../metadata.txt");
|
|
||||||
|
|
||||||
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
||||||
println!("cargo:rustc-env=OUT_DIR={}", out_dir.to_str().unwrap());
|
println!("cargo:rustc-env=OUT_DIR={}", out_dir.to_str().unwrap());
|
||||||
|
|
||||||
|
//
|
||||||
|
// When we are in debug mode, we want to set the current RID
|
||||||
|
// to the current architecture. This is necessary, so that
|
||||||
|
// the developers get the right behavior.
|
||||||
|
//
|
||||||
|
// We read the current OS and architecture and overwrite the
|
||||||
|
// current RID in the metadata file (line #10).
|
||||||
|
//
|
||||||
|
// We have to take care of different naming conventions. The
|
||||||
|
// following RIDs are supported: win-x64, win-arm64, linux-x64,
|
||||||
|
// linux-arm64, osx-x64, osx-arm64.
|
||||||
|
//
|
||||||
|
let current_os = std::env::consts::OS;
|
||||||
|
let current_arch = std::env::consts::ARCH;
|
||||||
|
let rid = match (current_os, current_arch) {
|
||||||
|
("windows", "x86_64") => "win-x64",
|
||||||
|
("windows", "aarch64") => "win-arm64",
|
||||||
|
|
||||||
|
("linux", "x86_64") => "linux-x64",
|
||||||
|
("linux", "aarch64") => "linux-arm64",
|
||||||
|
|
||||||
|
("macos", "x86_64") => "osx-x64",
|
||||||
|
("macos", "aarch64") => "osx-arm64",
|
||||||
|
|
||||||
|
_ => panic!("Unsupported OS or architecture: {current_os} {current_arch}"),
|
||||||
|
};
|
||||||
|
|
||||||
let metadata = include_str!("../metadata.txt");
|
let metadata = include_str!("../metadata.txt");
|
||||||
let mut metadata_lines = metadata.lines();
|
let mut metadata_lines = metadata.lines().collect::<Vec<_>>();
|
||||||
let version = metadata_lines.next().unwrap();
|
metadata_lines[9] = rid;
|
||||||
|
let new_metadata = metadata_lines.join("\n");
|
||||||
|
std::fs::write("../metadata.txt", new_metadata).unwrap();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read the current version and update the
|
||||||
|
// Rust and Tauri configuration files:
|
||||||
|
//
|
||||||
|
let version = metadata_lines[0];
|
||||||
update_cargo_toml("Cargo.toml", version);
|
update_cargo_toml("Cargo.toml", version);
|
||||||
update_tauri_conf("tauri.conf.json", version);
|
update_tauri_conf("tauri.conf.json", version);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ use mindwork_ai_studio::runtime_api::start_runtime_api;
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
|
||||||
let metadata = include_str!("../../metadata.txt");
|
let metadata = include_str!("../../metadata.txt");
|
||||||
let mut metadata_lines = metadata.lines();
|
let mut metadata_lines = metadata.lines();
|
||||||
let app_version = metadata_lines.next().unwrap();
|
let app_version = metadata_lines.next().unwrap();
|
||||||
@ -26,6 +25,7 @@ async fn main() {
|
|||||||
let mud_blazor_version = metadata_lines.next().unwrap();
|
let mud_blazor_version = metadata_lines.next().unwrap();
|
||||||
let tauri_version = metadata_lines.next().unwrap();
|
let tauri_version = metadata_lines.next().unwrap();
|
||||||
let app_commit_hash = metadata_lines.next().unwrap();
|
let app_commit_hash = metadata_lines.next().unwrap();
|
||||||
|
let architecture = metadata_lines.next().unwrap();
|
||||||
|
|
||||||
init_logging();
|
init_logging();
|
||||||
info!("Starting MindWork AI Studio:");
|
info!("Starting MindWork AI Studio:");
|
||||||
@ -33,7 +33,7 @@ async fn main() {
|
|||||||
let working_directory = std::env::current_dir().unwrap();
|
let working_directory = std::env::current_dir().unwrap();
|
||||||
info!(".. The working directory is: '{working_directory:?}'");
|
info!(".. The working directory is: '{working_directory:?}'");
|
||||||
|
|
||||||
info!(".. Version: v{app_version} (commit {app_commit_hash}, build {build_number})");
|
info!(".. Version: v{app_version} (commit {app_commit_hash}, build {build_number}, {architecture})");
|
||||||
info!(".. Build time: {build_time}");
|
info!(".. Build time: {build_time}");
|
||||||
info!(".. .NET SDK: v{dotnet_sdk_version}");
|
info!(".. .NET SDK: v{dotnet_sdk_version}");
|
||||||
info!(".. .NET: v{dotnet_version}");
|
info!(".. .NET: v{dotnet_version}");
|
||||||
|
Loading…
Reference in New Issue
Block a user