Skip to content
553 words 3 min read

Build and Test ​

This article explains how to build LOICollectionA from source, run tests, and package releases.

Environment Requirements ​

  • xmake 3.0+
  • clang-cl toolchain (LLVM + MSVC environment)
  • Git

Update the xmake repository before the first build:

bash
xmake repo -u

Project dependencies (automatically downloaded by xmake):

DependencyVersion
levilamina26.51.6
sqlitecpp3.3.3
nlohmann_json3.12.0
asio1.36.0
gtestv1.17.0 (debug mode only)
preloader1.15.7
levibuildscriptLatest
imguiv1.92.9+b (client target only)

Building ​

Basic Build ​

bash
# 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
xmake

Build Options ​

OptionDefaultDescription
`-m debugrelease`release
`--target_type=serverclient`server
`--shared=yn`y
bash
# Clean and reconfigure
xmake f -c
xmake f -m debug --target_type=server
xmake

Build 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: a debug build compiles tests/** into the plugin, and after deploying it to a LeviLamina server you trigger the whole suite by running /test all in the console.

bash
xmake f -m debug --target_type=server -y
xmake -y

TIP

The test entry point is triggered automatically by tests/server/TestMain.cpp when it receives ServerStartedEvent, and tests execute after a simulated player (TestSimulatedPlayer) is created.

For the full testing guide — directory layout and the responsibility of each layer, how to add a test, the unity-build naming convention you must follow, fuzzing, and the current CI situation — see Testing Guide.

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 match set_version in xmake.lua)
  • variants: platform variants and dependencies (e.g. win-x64 + LeviLamina 26.50.*)
  • assets: release assets (zip packages in the Release)

Release Workflow ​

.github/workflows/release.yml runs automatically when a tag (e.g. v1.17.1) 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:

FilePurpose
.clang-formatCode formatting (clang-format 15+)
.clang-tidyStatic analysis rules
.clangdclangd language server configuration

Other conventions:

  • Global.h is 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/* or modules/client/*, and public headers in include/server/* or include/client/*
  • Use the LOICOLLECTION_A_API / LOICOLLECTION_A_NDAPI export macros for the public API

LOICollectionA · A ready-to-use multifunctional plugin set for LeviLamina