[workspace]
members = ["cargo:."]

# Config for 'dist'
[dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.32.0-tinymist.5"
# A URL to use to install `cargo-dist` (with the installer script)
cargo-dist-url-override = "https://github.com/Myriad-Dreamin/cargo-dist/releases/download/v0.32.0-tinymist.5"
# CI backends to support
ci = "github"
# The installers to generate for each app
installers = ["shell", "powershell"]
# The archive format to use for windows builds (defaults .zip)
windows-archive = ".zip"
# The archive format to use for non-windows builds (defaults .tar.xz)
unix-archive = ".tar.gz"
# Target platforms to build apps for (Rust target-triple syntax)
# These targets are determined based on the awesome ruff project...
# region: targets
targets = [
    # Targets for CI
    "x86_64-pc-windows-msvc",
    "x86_64-unknown-linux-gnu",
    "aarch64-apple-darwin",

    # Targets for Releases
    "aarch64-pc-windows-msvc",
    "aarch64-unknown-linux-gnu",
    "aarch64-unknown-linux-musl",
    "arm-unknown-linux-gnueabihf",
    "arm-unknown-linux-musleabihf",
    "armv7-unknown-linux-gnueabihf",
    "armv7-unknown-linux-musleabihf",
    "x86_64-apple-darwin",
    "x86_64-unknown-linux-musl",
    "riscv64gc-unknown-linux-musl",
    "loongarch64-unknown-linux-gnu",
    "loongarch64-unknown-linux-musl",

    # Not supported yet.
    # "i686-pc-windows-msvc",
    # "i686-unknown-linux-gnu",
    # "i686-unknown-linux-musl",
    # "powerpc64-unknown-linux-gnu",
    # "powerpc64le-unknown-linux-gnu",
    # "riscv64gc-unknown-linux-gnu",
]
# region end: targets
# Whether to auto-include files like READMEs, LICENSEs, and CHANGELOGs (default true)
auto-includes = false
# Whether dist should create a Github Release or use an existing draft
create-release = false
# Which actions to run on pull requests
pr-run-mode = "skip"
# Whether CI should trigger releases with dispatches instead of tag pushes
dispatch-releases = true
# Whether to install an updater program
install-updater = false
# Path that installers should place binaries in
install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"]
# Whether to cache builds
cache-builds = true

global-artifacts-jobs = ["./build-vscode", "./ci-check-e2e"]
github-custom-job-permissions = { "build-vscode" = { contents = "write" } }

[dist.github-custom-runners]
global = "ubuntu-22.04"
aarch64-pc-windows-msvc = "windows-latest"

# Begin: https://github.com/posit-dev/air/blob/d48bad11a28942ad11c19ca97c99d5b6d1c29218/dist-workspace.toml
[dist.github-custom-runners.x86_64-apple-darwin]
# Use Intel Mac runner to build Intel binary.
# This is the dist default but we want to explicitly pin it.
# The macOS 13 runner image will be retired by December 4th, 2025.
runner = "macos-14"

[dist.github-custom-runners.aarch64-apple-darwin]
# Use ARM Mac runner to build ARM binary (not strictly required, but nice).
# dist uses `macos-13` (Intel) by default and cross-compiles to ARM.
runner = "macos-14"

[dist.github-custom-runners.x86_64-unknown-linux-gnu]
# Lock Linux to minimum supported version (Ubuntu 18.04 / RHEL 8, glibc 2.28).
# PyPa is the Python Packaging Authority, they manage old Linux variants for building Python wheels.
# The container `host` uses MUSL because dist itself may require a newer glibc than we are locked to.
# Runs on ubuntu-latest, dist defaults to oldest possible runner, but container usage means we can use latest
# and not have to worry about it being EOL-ed.
runner = "ubuntu-latest"
container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" }

[dist.github-custom-runners.aarch64-unknown-linux-gnu]
# See `x86_64-unknown-linux-gnu` comments
# For ARM Linux, dist actually uses an x86_64 host and uses cargo-zigbuild to cross compile,
# since GitHub doesn't offer a reliable free ARM Linux host yet.
runner = "ubuntu-latest"
container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" }
# End: https://github.com/posit-dev/air/blob/d48bad11a28942ad11c19ca97c99d5b6d1c29218/dist-workspace.toml
