mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-04 23:09:40 +00:00
Added the current CPU architecture to the metadata (#402)
This commit is contained in:
1 parent
c715b38f41
commit
b153b9c4e9
16 files changed
+177
-71
No files matched your search
+38
-7
@@ -2,17 +2,48 @@ use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
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());
|
||||
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 mut metadata_lines = metadata.lines();
|
||||
let version = metadata_lines.next().unwrap();
|
||||
|
||||
let mut metadata_lines = metadata.lines().collect::<Vec<_>>();
|
||||
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_tauri_conf("tauri.conf.json", version);
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,7 +14,6 @@ use mindwork_ai_studio::runtime_api::start_runtime_api;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
||||
let metadata = include_str!("../../metadata.txt");
|
||||
let mut metadata_lines = metadata.lines();
|
||||
let app_version = metadata_lines.next().unwrap();
|
||||
@@ -26,6 +25,7 @@ async fn main() {
|
||||
let mud_blazor_version = metadata_lines.next().unwrap();
|
||||
let tauri_version = metadata_lines.next().unwrap();
|
||||
let app_commit_hash = metadata_lines.next().unwrap();
|
||||
let architecture = metadata_lines.next().unwrap();
|
||||
|
||||
init_logging();
|
||||
info!("Starting MindWork AI Studio:");
|
||||
@@ -33,7 +33,7 @@ async fn main() {
|
||||
let working_directory = std::env::current_dir().unwrap();
|
||||
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!(".. .NET SDK: v{dotnet_sdk_version}");
|
||||
info!(".. .NET: v{dotnet_version}");
|
||||
|
||||
Reference in new issue
Block a user