From ca6435918c9944048ac007ec41e6897ac5bf74e2 Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Thu, 28 Mar 2024 22:14:08 +0300 Subject: [PATCH] ability to switch the engine version to local version - path is hard-coded for now --- .github/workflows/ci.yml | 1 + template/src/main.rs | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb11c128e..1f916c28f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,4 +147,5 @@ jobs: cd ../ fyrox-template init --name test_project --style=3d cd test_project + fyrox-template upgrade --version=latest --local cargo build --package editor \ No newline at end of file diff --git a/template/src/main.rs b/template/src/main.rs index 46b39970b..3c00984cd 100644 --- a/template/src/main.rs +++ b/template/src/main.rs @@ -50,6 +50,10 @@ enum Commands { Upgrade { #[clap(short, long)] version: String, + /// If set, specifies path to the engine to `../Fyrox/*` folder. Could be useful for development + /// purposes. This option works only if `version` is set to `latest`. + #[clap(long, default_value = "false")] + local: bool, }, } @@ -772,7 +776,7 @@ fn main() { Commands::Script { name } => { init_script(&name); } - Commands::Upgrade { version } => { + Commands::Upgrade { version, local } => { let semver_regex = Regex::new(include_str!("regex")).unwrap(); if version != "latest" && version != "nightly" && !semver_regex.is_match(&version) { @@ -822,11 +826,28 @@ fn main() { .and_then(|i| i.as_table_mut()) { if version == "latest" { - dependencies["fyrox"] = value(CURRENT_ENGINE_VERSION); - dependencies["fyroxed_base"] = value(CURRENT_EDITOR_VERSION); - if dependencies.contains_key("fyrox_scripts") { - dependencies["fyrox_scripts"] = - value(CURRENT_SCRIPTS_VERSION); + if local { + let mut engine_table = table(); + engine_table["path"] = value("../Fyrox/fyrox"); + dependencies["fyrox"] = engine_table; + + let mut editor_table = table(); + editor_table["path"] = value("../Fyrox/editor"); + dependencies["fyroxed_base"] = editor_table; + + if dependencies.contains_key("fyrox_scripts") { + let mut scripts_table = table(); + scripts_table["path"] = value("../Fyrox/fyrox-scripts"); + dependencies["fyrox_scripts"] = scripts_table; + } + } else { + dependencies["fyrox"] = value(CURRENT_ENGINE_VERSION); + dependencies["fyroxed_base"] = + value(CURRENT_EDITOR_VERSION); + if dependencies.contains_key("fyrox_scripts") { + dependencies["fyrox_scripts"] = + value(CURRENT_SCRIPTS_VERSION); + } } } else if version == "nightly" { let mut table = table();