Build and Test
This article explains how to build LOICollectionA from source, run tests, and package releases.
Environment Requirements
- xmake 3.0+
clang-cltoolchain (LLVM + MSVC environment)- Git
Update the xmake repository before the first build:
xmake repo -uProject dependencies (automatically downloaded by xmake):
| Dependency | Version |
|---|---|
| levilamina | 26.20.7 |
| sqlitecpp | 3.3.3 |
| nlohmann_json | 3.12.0 |
| gtest | v1.17.0 (debug mode only) |
| preloader | 1.15.7 |
| levibuildscript | Latest |
Building
Basic Build
# Clone and enter the repository
git clone https://github.com/loitietu/LOICollectionA.git
cd LOICollectionA
# Build with default configuration (release, server)
xmake
# Build debug (also compiles the test code)
xmake f -m debug
xmakeBuild Options
| Option | Default | Description |
|---|---|---|
| `-m debug | release` | release |
| `--target_type=server | client` | server |
| `--shared=y | n` | y |
# Clean and reconfigure
xmake f -c
xmake f -m debug --target_type=server
xmakeBuild Artifacts
The artifact is a shared library (LOICollectionA.dll on Windows), packaged with the modpacker rule (see below). The compile macros LL_PLAT_S (server)/LL_PLAT_C (client) are automatically defined by target_type, and modules/server/* and modules/client/* in the source are compiled mutually exclusively by target.
NOTE
The project uses c++.unity_build (batch size 8) to speed up compilation and enables the Global.h precompiled header. Recompiling after modifying a header file may be slow, which is normal.
Testing
Tests are based on gtest and run inside the game server:
- Build in debug mode (
xmake f -m debug);tests/**is automatically included - Deploy the built plugin to a LeviLamina server and start it
- Run
/test allin the server console; gtest will automatically run and output the results
TIP
The /test all command is registered by tests/server/TestCommand.cpp via a hook after the server thread starts, and tests execute after a simulated player (TestSimulatedPlayer) is created.
Test Directory Structure
tests/
├─ common/ # cross-platform tests: base (Cache/ServiceContainer/Wrapper, etc.),
│ # coro, data (Json/SQLite storage), frontend (LCUI lexer/parser/semantics/VM)
├─ server/ # server tests: mc (block/scoreboard tools, etc.), modules (plugin callbacks),
│ # TestCommand.cpp (entry), TestSimulatedPlayer (simulated player)
└─ client/ # client tests (compiled only for the client target)Packaging and Release
modpacker
xmake.lua registers the modpacker rule via scripts/modpacker.lua, which automatically organizes the plugin directory during the build (plugin files, gui, lang, and other resources).
tooth.json
The release manifest tooth.json defines the plugin metadata and installation method:
tooth: release address (github.com/loitietu/LOICollectionA)version: plugin version (must matchset_versioninxmake.lua)variants: platform variants and dependencies (e.g.win-x64+ LeviLamina 26.20.*)assets: release assets (zip packages in the Release)
Release Workflow
.github/workflows/release.yml runs automatically when a tag (e.g. v1.15.0) is created: build → package zip → create GitHub Release → upload lip install assets. Users install via lip install github.com/loitietu/LOICollectionA.
Code Standards
The repository comes with the following configurations; keep them before committing:
| File | Purpose |
|---|---|
.clang-format | Code formatting (clang-format 15+) |
.clang-tidy | Static analysis rules |
.clangd | clangd language server configuration |
Other conventions:
Global.his the precompiled header, centrally including the base libraries (ll/api, base/ tools); new public headers can be considered for addition- Compile options
set_exceptions("none")+/EHa,/utf-8,/permissive-; do not rely on C++ exceptions - Put platform-related code in
modules/server/*ormodules/client/*, and public headers ininclude/server/*orinclude/client/* - Use the
LOICOLLECTION_A_API/LOICOLLECTION_A_NDAPIexport macros for the public API