Files
clice/pixi.toml
2026-01-03 16:23:06 +08:00

216 lines
6.8 KiB
TOML

# tombi: format.rules.table-keys-order.disabled = true
[workspace]
name = "clice"
version = "0.1.0"
description = "A next-generation C++ language server for modern C++"
authors = [
"ykiko <ykikoykikoykiko@gmail.com>",
"clice contributors <clice@clice.io>",
]
license = "Apache-2.0"
license-file = "LICENSE"
readme = "README.md"
documentation = "https://clice.io"
repository = "https://github.com/clice-io/clice"
channels = ["conda-forge"]
platforms = ["win-64", "linux-64", "osx-arm64"]
[environments]
default = ["build", "test"]
package = ["build", "test", "package"]
node = ["node"]
format = ["format"]
# ============================================================================== #
# DEPENDENCIES #
# ============================================================================== #
[feature.build.dependencies]
python = ">=3.13"
cmake = ">=3.30"
ninja = "*"
clang = "==20.1.8"
clangxx = "==20.1.8"
lld = "==20.1.8"
llvm-tools = "==20.1.8"
compiler-rt = "==20.1.8"
[feature.build.target.linux-64.dependencies]
sysroot_linux-64 = "==2.17"
gcc = "==14.2.0"
gxx = "==14.2.0"
[feature.build.target.linux-64.activation]
scripts = ["scripts/activate_linux.sh"]
[feature.build.target.win-64.activation]
scripts = ["scripts/activate_asan.bat"]
[feature.test.pypi-dependencies]
pytest = "*"
pytest-asyncio = ">=1.1.0"
[feature.package.dependencies]
xz = ">=5.8.1,<6"
# ============================================================================== #
# CMAKE #
# ============================================================================== #
[feature.build.tasks.cmake-config]
args = [
{ arg = "type", default = "RelWithDebInfo" },
{ arg = "ci", default = "OFF" },
{ arg = "extra", default = "" },
]
cmd = """
cmake -B build/{{ type }} -G Ninja \
-DCMAKE_BUILD_TYPE={{ type }} \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain.cmake \
-DCLICE_ENABLE_TEST=ON \
-DCLICE_CI_ENVIRONMENT={{ ci }} {{extra}} \
"""
[feature.build.tasks.cmake-build]
args = [{ arg = "type", default = "RelWithDebInfo" }]
cmd = "cmake --build build/{{ type }}"
[feature.build.tasks.build]
args = [
{ arg = "type", default = "RelWithDebInfo" },
{ arg = "ci", default = "OFF" },
{ arg = "extra", default = "" },
]
depends-on = [
{ task = "cmake-config", args = ["{{ type }}", "{{ ci }}", "{{extra}}"] },
{ task = "cmake-build", args = ["{{ type }}"] },
]
[feature.build.tasks.unit-test]
args = [{ arg = "type", default = "RelWithDebInfo" }]
cmd = './build/{{ type }}/bin/unit_tests --test-dir="./tests/data"'
[feature.test.tasks.integration-test]
args = [{ arg = "type", default = "RelWithDebInfo" }]
cmd = """
pytest -s --log-cli-level=INFO tests/integration \
--executable=./build/{{ type }}/bin/clice
"""
[feature.test.tasks.test]
args = [{ arg = "type", default = "RelWithDebInfo" }]
depends-on = [
{ task = "unit-test", args = ["{{ type }}"] },
{ task = "integration-test", args = ["{{ type }}"] },
]
# ============================================================================== #
# XMAKE #
# ============================================================================== #
[feature.build.tasks.xmake-config]
args = [
{ arg = "type", default = "releasedbg" },
{ arg = "ci", default = "n" },
]
cmd = "xmake config --yes --mode={{ type }} --toolchain=clang --ci={{ ci }}"
[feature.build.tasks.xmake-build]
cmd = "xmake build --verbose --diagnosis --all"
[feature.build.tasks.xmake]
args = [
{ arg = "type", default = "releasedbg" },
{ arg = "ci", default = "n" },
]
depends-on = [
{ task = "xmake-config", args = ["{{ type }}", "{{ ci }}"] },
{ task = "xmake-build" },
]
[feature.test.tasks.xmake-test]
cmd = "xmake test --verbose"
[feature.package.tasks.package]
cmd = """
xmake config --yes --toolchain=clang --mode=releasedbg \
--enable_test=n --dev=n --release=y && \
xmake pack --verbose
"""
# ============================================================================== #
# HELPER TASKS #
# ============================================================================== #
[tasks.build-llvm]
cmd = ["python3", "scripts/build-llvm.py"]
[tasks.upload-llvm]
args = ["workflow_id", "llvm_version", { "arg" = "branch", default = "main" }]
cmd = """
gh workflow run upload-llvm.yml \
--ref {{ branch }} \
--field workflow_id={{workflow_id}} \
--field version={{llvm_version}}
"""
[tasks.delete-artifacts]
args = ["file_name"]
cmd = ["scripts/delete-artifacts.bash", "{{ file_name }}"]
# ============================================================================== #
# DOCS & VSCODE EXTENSION #
# ============================================================================== #
[feature.node.dependencies]
nodejs = ">=20"
pnpm = "*"
[feature.node.tasks]
build-docs = { cwd = "docs", cmd = "pnpm run docs:build", depends-on = ["install-docs"] }
preview-docs = { cwd = "docs", cmd = "pnpm run docs:preview", depends-on = ["install-docs"] }
build-vscode = { cwd = "editors/vscode", cmd = "pnpm run package", depends-on = ["install-vscode"] }
publish-vscode = { cwd = "editors/vscode", cmd = "pnpm run publish", depends-on = ["install-vscode"] }
[feature.node.tasks.install-docs]
cwd = "docs"
cmd = "pnpm install"
inputs = ["docs/package.json", "docs/pnpm-lock.yaml"]
outputs = ["docs/node_modules/.modules.yaml"]
[feature.node.tasks.install-vscode]
cwd = "editors/vscode"
cmd = "pnpm install"
inputs = ["editors/vscode/package.json", "editors/vscode/pnpm-lock.yaml"]
outputs = ["editors/vscode/node_modules/.modules.yaml"]
# ============================================================================== #
# FORMAT #
# ============================================================================== #
[feature.format.dependencies]
ruff = "*"
tombi = "*"
stylua = "*"
fd-find = "*"
prettier = "*"
clang-format = "==21.1.7"
[feature.format.tasks]
format-cpp = "fd -H -e cpp -e h -e cc -e hpp -x clang-format -i"
format-python = "ruff format ."
format-lua = "stylua ."
format-web = "fd -H -e js -e ts -e css -x prettier --write"
format-markdown = "fd -H -e md -x prettier --write"
format-json = "fd -H -e json -E package-lock.json -x prettier --write"
format-toml = "fd -H -e toml -x tombi format"
format-yaml = """
fd -H -e yaml -e yml -E pnpm-lock.yaml -x prettier --write && \
fd -H "^\\.clang-(format|tidy)$" -x prettier --write --parser yaml
"""
format = { depends-on = [
"format-cpp",
"format-python",
"format-lua",
"format-web",
"format-markdown",
"format-json",
"format-toml",
"format-yaml"
] }