# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: Copyright (c) 2026, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# Centralized dependency manifest for CI workflows and documentation.
#
# Sources of truth:
#   - vcpkg.json:       C++ library dependencies for vcpkg builds (protobuf, lz4, zstd, gtest, doxygen, graphviz)
#   - This file:        System package names (apt/dnf/brew/winget) and host tools for non-vcpkg builds
#
# Roles:
#   - build:      System packages to compile the library (non-vcpkg path)
#   - vcpkg_host: Host tools only when vcpkg manages libraries (cmake, git, etc.)
#   - test:       Additional packages for unit tests
#   - docs:       Documentation generation (doxygen, graphviz, python3-venv for Sphinx)
#   - lint:       Static analysis tools (clang-tidy)
#   - dev:        Development tools (clang-format, ninja)
#   - coverage:   Code coverage reporting (gcovr)
#
# Formatter pinning:
#   - C++ formatting is pinned to clang-format major version 18 across CI and local hooks.

dependencies:
  # =========================================================================
  # Core build dependencies (library compilation)
  # NOTE: These are for manual/system-package builds only.
  # vcpkg builds should use vcpkg_host.* (tools only) and vcpkg.json for libraries.
  # =========================================================================
  build:
    apt:
      - cmake
      - build-essential
      - protobuf-compiler
      - libprotobuf-dev
      - liblz4-dev
      - libzstd-dev
      - pkg-config
    dnf:
      - cmake
      - gcc-c++
      - protobuf-devel
      - lz4-devel
      - libzstd-devel
      - pkgconf-pkg-config
    winget:
      - Kitware.CMake
      - Git.Git
      - Microsoft.VisualStudio.2022.BuildTools

  # =========================================================================
  # vcpkg host tools (no system libraries)
  # =========================================================================
  vcpkg_host:
    apt:
      - cmake
      - build-essential
      - pkg-config
      - git
      - curl
      - zip
      - unzip
    dnf:
      - cmake
      - gcc-c++
      - pkgconf-pkg-config
      - git
      - curl
      - zip
      - unzip
    brew:
      - cmake
      - pkg-config
      - git
    winget:
      - Kitware.CMake
      - Git.Git
      - Microsoft.VisualStudio.2022.BuildTools

  # =========================================================================
  # Test dependencies (unit tests)
  # =========================================================================
  test:
    apt:
      - libgtest-dev
    dnf:
      - gtest-devel

  # =========================================================================
  # Documentation dependencies (Doxygen + Sphinx)
  # =========================================================================
  # System packages only. Sphinx and its plugins are installed via pip
  # from pyproject.toml[docs]: pip install -e "python/[docs]"
  docs:
    apt:
      - doxygen
      - graphviz
      - python3-venv
    dnf:
      - doxygen
      - graphviz
    brew:
      - doxygen
      - graphviz
    winget:
      - DimitriVanHeesch.Doxygen
      - Graphviz.Graphviz

# ---------------------------------------------------------------------------
# Windows notes (local development)
# ---------------------------------------------------------------------------
# - If `winget` fails while searching the `msstore` source (e.g. certificate/proxy issues),
#   prefer `--source winget` (community repo) or disable the store source via:
#     winget source disable msstore
# - LLVM/clang-format on Windows: install LLVM 18.x to match CI's pinned formatter version.
# - Graphviz on Windows: ensure `dot -V` works in PowerShell.
#   In Git Bash/MSYS environments, `dot.exe` may fail to start if a MinGW runtime DLL is missing
#   (e.g. `libltdl-7.dll`). In that case, install MSYS2 and `mingw-w64-x86_64-libtool`, then add
#   `C:\msys64\mingw64\bin` to PATH (or place the missing DLL next to `dot.exe`).

  # =========================================================================
  # Lint/static analysis dependencies
  # =========================================================================
  lint:
    apt:
      - clang-tidy-18
    dnf:
      - clang-tools-extra
    brew:
      - llvm@18

  # =========================================================================
  # Development tools (formatting, hooks)
  # =========================================================================
  dev:
    apt:
      - clang-format-18
      - git
      - ninja-build
    dnf:
      - clang-tools-extra
      - git
      - ninja-build
    brew:
      - llvm@18
      - git
      - ninja
    winget:
      - LLVM.LLVM
      - Git.Git
      - Ninja-build.Ninja

  # =========================================================================
  # Coverage reporting
  # =========================================================================
  coverage:
    apt:
      - gcovr

# ===========================================================================
# CI Job dependency mappings
# ===========================================================================
# Use these combinations in CI workflows:
#
# ci_build.yml (Ubuntu):     build + test + coverage
# ci_build.yml (macOS):      build + test
# ci_build.yml (vcpkg):      (vcpkg handles all via vcpkg.json)
# ci_lint.yml:               build + test + lint
# ci_format.yml:             dev (clang-format only)
# cd_docs.yml:               docs + pip install -e "python/[docs]" (Doxygen XML → Sphinx HTML)

ci_jobs:
  ubuntu_build:
    description: "Ubuntu system package builds"
    apt: |
      cmake build-essential protobuf-compiler libprotobuf-dev
      liblz4-dev libzstd-dev libgtest-dev gcovr pkg-config

  ubuntu_lint:
    description: "Ubuntu static analysis"
    apt: |
      cmake build-essential protobuf-compiler libprotobuf-dev
      liblz4-dev libzstd-dev libgtest-dev clang-tidy-18 pkg-config

  ubuntu_docs:
    description: "Documentation build (Doxygen + Sphinx)"
    apt: |
      cmake doxygen graphviz python3-venv
