Skip to content

Commit

Permalink
refactor: optimizing xmake.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jan 22, 2025
1 parent c18a5d5 commit 75acf06
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
14 changes: 10 additions & 4 deletions src/legacy/api/EventAPI.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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 <list>
#include <shared_mutex>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions src/legacy/engine/EngineManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/legacy/main/NodeJsHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma warning(disable : 4251)

#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS)
#include "main/NodeJsHelper.h"

#include "api/EventAPI.h"
Expand Down Expand Up @@ -387,5 +386,3 @@ int executeNpmCommand(std::string cmd, std::string workingDir) {
}

} // namespace NodeJsHelper

#endif
3 changes: 0 additions & 3 deletions src/legacy/main/NodeJsHelper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS)
#pragma warning(disable : 4251)
#include "legacy/main/Global.h"
#include <ScriptX/ScriptX.h>
Expand Down Expand Up @@ -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
3 changes: 0 additions & 3 deletions src/legacy/main/PythonHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma warning(disable : 4251)
#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON)
#include "PythonHelper.h"

#include "Global.h"
Expand Down Expand Up @@ -268,5 +267,3 @@ int executePipCommand(std::string cmd) {
}

} // namespace PythonHelper

#endif
3 changes: 0 additions & 3 deletions src/legacy/main/PythonHelper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON
#include <ScriptX/ScriptX.h>
#include <filesystem>
#include <map>
Expand All @@ -22,5 +21,3 @@ bool processConsolePipCmd(const std::string& cmd);
int executePipCommand(std::string cmd);

} // namespace PythonHelper

#endif
6 changes: 6 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit 75acf06

Please sign in to comment.