Skip to content

Commit 75acf06

Browse files
committed
refactor: optimizing xmake.lua
1 parent c18a5d5 commit 75acf06

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

src/legacy/api/EventAPI.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "api/EventAPI.h"
22

3-
#include "../engine/LocalShareData.h"
4-
#include "../main/BuiltinCommands.h"
3+
#include "legacy/engine/LocalShareData.h"
4+
#include "legacy/main/BuiltinCommands.h"
55
#include "BaseAPI.h"
66
#include "BlockAPI.h"
77
#include "CommandCompatibleAPI.h"
@@ -12,8 +12,6 @@
1212
#include "api/PlayerAPI.h"
1313
#include "engine/EngineOwnData.h"
1414
#include "engine/GlobalShareData.h"
15-
#include "legacy/main/NodeJsHelper.h"
16-
#include "legacy/main/PythonHelper.h"
1715
#include "ll/api/chrono/GameChrono.h"
1816
#include "ll/api/coro/CoroTask.h"
1917
#include "ll/api/event/EventBus.h"
@@ -55,6 +53,14 @@
5553
#include "mc/world/level/dimension/Dimension.h"
5654
#include "ll/api/thread/ServerThreadExecutor.h"
5755

56+
#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS
57+
#include "legacy/main/NodeJsHelper.h"
58+
#endif
59+
60+
#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON
61+
#include "legacy/main/PythonHelper.h"
62+
#endif
63+
5864
#include <list>
5965
#include <shared_mutex>
6066
#include <string>

src/legacy/engine/EngineManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "engine/EngineOwnData.h"
44
#include "engine/GlobalShareData.h"
55
#include "ll/api/utils/StringUtils.h"
6+
67
#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS)
78
#include "legacy/main/NodeJsHelper.h"
89
#endif

src/legacy/main/NodeJsHelper.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma warning(disable : 4251)
22

3-
#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS)
43
#include "main/NodeJsHelper.h"
54

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

389388
} // namespace NodeJsHelper
390-
391-
#endif

src/legacy/main/NodeJsHelper.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS)
32
#pragma warning(disable : 4251)
43
#include "legacy/main/Global.h"
54
#include <ScriptX/ScriptX.h>
@@ -28,5 +27,3 @@ bool processConsoleNpmCmd(const std::string& cmd);
2827
int executeNpmCommand(std::string cmd, std::string workingDir = LLSE_NPM_EXECUTE_PATH);
2928

3029
} // namespace NodeJsHelper
31-
32-
#endif

src/legacy/main/PythonHelper.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma warning(disable : 4251)
2-
#if defined(LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON)
32
#include "PythonHelper.h"
43

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

270269
} // namespace PythonHelper
271-
272-
#endif

src/legacy/main/PythonHelper.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
2-
#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON
32
#include <ScriptX/ScriptX.h>
43
#include <filesystem>
54
#include <map>
@@ -22,5 +21,3 @@ bool processConsolePipCmd(const std::string& cmd);
2221
int executePipCommand(std::string cmd);
2322

2423
} // namespace PythonHelper
25-
26-
#endif

xmake.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ target("legacy-script-engine")
101101
add_defines(
102102
"LEGACY_SCRIPT_ENGINE_BACKEND_LUA"
103103
)
104+
remove_files("src/legacy/main/NodeJsHelper.cpp")
105+
remove_files("src/legacy/main/PythonHelper.cpp")
104106
set_basename("legacy-script-engine-lua")
105107
after_build(function(target)
106108
local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.lua")
@@ -116,6 +118,8 @@ target("legacy-script-engine")
116118
add_defines(
117119
"LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS"
118120
)
121+
remove_files("src/legacy/main/NodeJsHelper.cpp")
122+
remove_files("src/legacy/main/PythonHelper.cpp")
119123
set_basename("legacy-script-engine-quickjs")
120124
after_build(function(target)
121125
local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.js")
@@ -131,6 +135,7 @@ target("legacy-script-engine")
131135
add_defines(
132136
"LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON"
133137
)
138+
remove_files("src/legacy/main/NodeJsHelper.cpp")
134139
set_basename("legacy-script-engine-python")
135140
after_build(function(target)
136141
local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.py")
@@ -146,6 +151,7 @@ target("legacy-script-engine")
146151
add_defines(
147152
"LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS"
148153
)
154+
remove_files("src/legacy/main/PythonHelper.cpp")
149155
remove_files("src/legacy/legacyapi/db/impl/mysql/*.cpp")
150156
set_basename("legacy-script-engine-nodejs")
151157
after_build(function(target)

0 commit comments

Comments
 (0)