diff --git a/src/legacy/api/EventAPI.cpp b/src/legacy/api/EventAPI.cpp index 119c787..91bd5ad 100644 --- a/src/legacy/api/EventAPI.cpp +++ b/src/legacy/api/EventAPI.cpp @@ -1,7 +1,7 @@ #include "api/EventAPI.h" -#include "../engine/LocalShareData.h" -#include "../main/BuiltinCommands.h" +#include "legacy/engine/LocalShareData.h" +#include "legacy/main/BuiltinCommands.h" #include "BaseAPI.h" #include "BlockAPI.h" #include "CommandCompatibleAPI.h" @@ -12,8 +12,6 @@ #include "api/PlayerAPI.h" #include "engine/EngineOwnData.h" #include "engine/GlobalShareData.h" -#include "legacy/main/NodeJsHelper.h" -#include "legacy/main/PythonHelper.h" #include "ll/api/chrono/GameChrono.h" #include "ll/api/coro/CoroTask.h" #include "ll/api/event/EventBus.h" @@ -55,6 +53,14 @@ #include "mc/world/level/dimension/Dimension.h" #include "ll/api/thread/ServerThreadExecutor.h" +#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS +#include "legacy/main/NodeJsHelper.h" +#endif + +#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON +#include "legacy/main/PythonHelper.h" +#endif + #include #include #include diff --git a/src/legacy/engine/EngineManager.cpp b/src/legacy/engine/EngineManager.cpp index 09faf33..c8c8bf4 100644 --- a/src/legacy/engine/EngineManager.cpp +++ b/src/legacy/engine/EngineManager.cpp @@ -3,6 +3,7 @@ #include "engine/EngineOwnData.h" #include "engine/GlobalShareData.h" #include "ll/api/utils/StringUtils.h" + #if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS) #include "legacy/main/NodeJsHelper.h" #endif diff --git a/src/legacy/main/NodeJsHelper.cpp b/src/legacy/main/NodeJsHelper.cpp index a08b672..9123590 100644 --- a/src/legacy/main/NodeJsHelper.cpp +++ b/src/legacy/main/NodeJsHelper.cpp @@ -1,6 +1,5 @@ #pragma warning(disable : 4251) -#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS) #include "main/NodeJsHelper.h" #include "api/EventAPI.h" @@ -387,5 +386,3 @@ int executeNpmCommand(std::string cmd, std::string workingDir) { } } // namespace NodeJsHelper - -#endif diff --git a/src/legacy/main/NodeJsHelper.h b/src/legacy/main/NodeJsHelper.h index b56d93f..a1ed24b 100644 --- a/src/legacy/main/NodeJsHelper.h +++ b/src/legacy/main/NodeJsHelper.h @@ -1,5 +1,4 @@ #pragma once -#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS) #pragma warning(disable : 4251) #include "legacy/main/Global.h" #include @@ -28,5 +27,3 @@ bool processConsoleNpmCmd(const std::string& cmd); int executeNpmCommand(std::string cmd, std::string workingDir = LLSE_NPM_EXECUTE_PATH); } // namespace NodeJsHelper - -#endif diff --git a/src/legacy/main/PythonHelper.cpp b/src/legacy/main/PythonHelper.cpp index bb88e88..f5448ac 100644 --- a/src/legacy/main/PythonHelper.cpp +++ b/src/legacy/main/PythonHelper.cpp @@ -1,5 +1,4 @@ #pragma warning(disable : 4251) -#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON) #include "PythonHelper.h" #include "Global.h" @@ -268,5 +267,3 @@ int executePipCommand(std::string cmd) { } } // namespace PythonHelper - -#endif diff --git a/src/legacy/main/PythonHelper.h b/src/legacy/main/PythonHelper.h index 3ab2059..af55434 100644 --- a/src/legacy/main/PythonHelper.h +++ b/src/legacy/main/PythonHelper.h @@ -1,5 +1,4 @@ #pragma once -#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON #include #include #include @@ -22,5 +21,3 @@ bool processConsolePipCmd(const std::string& cmd); int executePipCommand(std::string cmd); } // namespace PythonHelper - -#endif diff --git a/xmake.lua b/xmake.lua index a358677..81dfa6b 100644 --- a/xmake.lua +++ b/xmake.lua @@ -101,6 +101,8 @@ target("legacy-script-engine") add_defines( "LEGACY_SCRIPT_ENGINE_BACKEND_LUA" ) + remove_files("src/legacy/main/NodeJsHelper.cpp") + remove_files("src/legacy/main/PythonHelper.cpp") set_basename("legacy-script-engine-lua") after_build(function(target) local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.lua") @@ -116,6 +118,8 @@ target("legacy-script-engine") add_defines( "LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS" ) + remove_files("src/legacy/main/NodeJsHelper.cpp") + remove_files("src/legacy/main/PythonHelper.cpp") set_basename("legacy-script-engine-quickjs") after_build(function(target) local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.js") @@ -131,6 +135,7 @@ target("legacy-script-engine") add_defines( "LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON" ) + remove_files("src/legacy/main/NodeJsHelper.cpp") set_basename("legacy-script-engine-python") after_build(function(target) local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.py") @@ -146,6 +151,7 @@ target("legacy-script-engine") add_defines( "LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS" ) + remove_files("src/legacy/main/PythonHelper.cpp") remove_files("src/legacy/legacyapi/db/impl/mysql/*.cpp") set_basename("legacy-script-engine-nodejs") after_build(function(target)