[package]
name = "bougie"
version.workspace = true
edition = "2024"
description = "PHP toolchain management the luxury way."
license = "EUPL-1.2"
repository = "https://github.com/cresset-tools/bougie"
rust-version = "1.95"
default-run = "bougie"
authors.workspace = true
# Drop CI-only fixture data and the probe example from the published
# crate. Can't blanket-exclude `/tests` here: the `fake-redis` bin
# target (gated on test-fixtures) lives at tests/fixtures/fake_redis.rs.
exclude = ["/tests/fixtures/cross-check", "/examples"]

[[bin]]
name = "bougie"
path = "src/main.rs"

# Short alias binary, uvx-equivalent: `bgx <vendor/name> -- args...` is
# `bougie tool run <vendor/name> -- args...`. Real binary rather than an
# argv0 symlink so the same shape works on every platform and survives
# `bougie self update`-style binary relocations.
[[bin]]
name = "bgx"
path = "src/bin/bgx.rs"

# Phase 3 integration-test fixture. Stands in for a real redis-server
# in the supervisor tests: parses `--unixsocket <path>` and binds the
# socket, satisfying the daemon's health probe. Gated behind the
# non-default `test-fixtures` feature so `cargo install --path .` skips
# it; CI and local `cargo test` enable the feature explicitly.
[[bin]]
name = "fake-redis"
path = "tests/fixtures/fake_redis.rs"
required-features = ["test-fixtures"]

# Opt this crate back into dist (workspace default in dist-workspace.toml
# is `dist = false` because the other 24 crates are libraries that
# shouldn't ship binaries). Only `bougie` produces the user-facing
# `bougie` + `bgx` bins, so it's the only package dist needs to build.
[package.metadata.dist]
dist = true

[features]
default = ["dev-trust-root"]
# Enables the `fake-redis` test-fixture bin. Off by default so
# `cargo install` doesn't ship it; turn on with `cargo test --features
# test-fixtures` (CI does this).
test-fixtures = []
# Enables the Layer 4 cross-check integration tests that load
# pre-captured Packagist fixtures from
# `tests/fixtures/cross-check/<slug>/`. Off by default so the
# compressed fixture bytes don't inflate `cargo build`. Run with:
#   cargo test -p bougie --test composer_cross_check --features cross-check-fixtures
cross-check-fixtures = []
# Forwards through to `bougie-index/dev-trust-root` — see that crate
# for what the override allows. A `cargo install --no-default-features`
# (or a release pipeline that does the same) ships a binary where the
# env var is inert.
dev-trust-root = ["bougie-index/dev-trust-root"]

# --- Workspace crates ---

[dependencies]
bougie-backend = { workspace = true }
bougie-autoloader = { workspace = true }
bougie-cli = { workspace = true }
bougie-composer = { workspace = true }
bougie-composer-resolver = { workspace = true }
bougie-config = { workspace = true }
bougie-errors = { workspace = true }
bougie-fetch = { workspace = true }
bougie-fs = { workspace = true }
# Inline path-dep (not `{ workspace = true }`) because cargo rejects
# member-level `default-features = false` overrides when the workspace
# entry has defaults on. Carries its own annotated version literal
# (release-please rewrites it) since it bypasses the workspace entry.
bougie-index = { path = "../bougie-index", version = "0.35.1", default-features = false } # x-release-please-version
bougie-installer = { workspace = true }
bougie-installers = { workspace = true }
bougie-output = { workspace = true }
bougie-patches = { workspace = true }
bougie-paths = { workspace = true }
bougie-platform = { workspace = true }
bougie-resolver = { workspace = true }
bougie-php-discovery = { workspace = true }
bougie-scripts = { workspace = true }
bougie-server = { workspace = true }
bougie-tool = { workspace = true }
bougie-version = { workspace = true }
composer-semver = { workspace = true }
spdx = "0.10"

# `bougied` (process supervisor) and the recipe engine rely on Unix-only
# APIs (domain sockets, POSIX signals, sandbox-run's Landlock/SBPL
# backends, utimensat, /bin/sh). Gating the deps means Windows builds
# skip the crates entirely. `bougie-server` is now cross-platform
# (Windows replaces php-fpm with `php-cgi.exe -b 127.0.0.1:<port>` and
# uses named pipes for the control endpoint) and stays in the regular
# [dependencies] block above.
[target.'cfg(unix)'.dependencies]
bougie-babysit = { workspace = true }
bougie-daemon = { workspace = true }
bougie-recipe = { workspace = true }
sandbox-run = { workspace = true }

# Drives the SIGQUIT (Ctrl-\) activity dump in `debug_dump.rs`. We use
# the iterator API so signal delivery lands on a normal background
# thread (not an async-signal context), keeping the dump path plain
# safe Rust — the unsafe handler registration lives inside the crate.
signal-hook = "0.3"

# --- External deps still used directly by the bin (CLI dispatch,
#     commands/ handlers, the unzip-shim role, etc.) ---

[dependencies.clap]
version = "4.5"
default-features = false
features = ["std", "derive", "help", "usage", "error-context", "suggestions", "wrap_help", "color"]

[dependencies.color-eyre]
version = "0.6"

[dependencies.eyre]
version = "0.6"

[dependencies.reqwest]
version = "0.13"
default-features = false
# `json` deserializes the GitHub Releases API response in
# `commands/self_update.rs`. The other features were already pulled
# in by upstream callers.
features = ["blocking", "rustls", "stream", "json"]

[dependencies.serde]
version = "1.0"
features = ["derive"]

[dependencies.serde_json]
version = "1.0"
features = ["preserve_order"]

[dependencies.tempfile]
version = "3.10"

[dependencies.toml_edit]
version = "0.25"
features = ["serde"]

# Opt-in diagnostic logging. The binary installs a `tracing-subscriber`
# in `main` that's inert unless `BOUGIE_LOG` (or `RUST_LOG`) is set —
# zero-overhead for normal users, full visibility when the user wants
# to investigate timing or hangs (e.g. `BOUGIE_LOG=bougie_composer_resolver=debug`).
[dependencies.tracing]
version = "0.1"

[dependencies.tracing-subscriber]
version = "0.3"
default-features = false
features = ["env-filter", "fmt", "std"]

[dependencies.walkdir]
version = "2.5"

# In-process `unzip` shim — Composer's ZipDownloader prefers a PATH
# `unzip` over PHP's ZipArchive (faster + preserves Unix mode bits and
# symlinks). We satisfy that preference by exposing `unzip` as an
# argv[0] role on the bougie binary, implemented against this crate.
[dependencies.zip]
version = "8.0"
default-features = false
features = ["deflate"]

# `bougie self update` decompresses the tar.gz dist publishes on Unix
# (Windows uses the existing `zip` dep above). `tar` + `sha2` were
# previously dev-only — they're now linked into the release binary so
# the updater can verify and extract the archive in-process. Both add
# only a handful of KB to the final binary.
[dependencies.flate2]
version = "1"

[dependencies.tar]
version = "0.4"

[dependencies.sha2]
version = "0.11"

[lints]
workspace = true
