From 96cfca1c8fe711d24215f9d1bb91cea7002aa087 Mon Sep 17 00:00:00 2001 From: konsti Date: Fri, 2 May 2025 17:56:40 +0200 Subject: [PATCH] Move static feature out of perf features (#13265) #5577 fixed a bug on macos due to dynamically linking lzma/xz through static linking. In #7686, this feature was moved to the performance category. This PR moves the `xz2/static` back to the general default features, and, inspired by https://github.com/Homebrew/homebrew-core/pull/222211, it structures and documents the feature flags cleaner. We need to take care that this feature does not accidentally disable features we want. --------- Co-authored-by: Zanie Blue --- .github/workflows/ci.yml | 2 +- crates/uv-bench/Cargo.toml | 4 +-- crates/uv-dev/Cargo.toml | 7 ++--- crates/uv-distribution/Cargo.toml | 2 +- crates/uv-extract/Cargo.toml | 3 +- crates/uv/Cargo.toml | 47 +++++++++++++++++++------------ 6 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 316fc1c93..2288cbd32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2250,7 +2250,7 @@ jobs: cargo run --bin uv -- pip compile scripts/requirements/airflow.in --universal --exclude-newer 2024-08-08 --cache-dir .cache - name: "Build benchmarks" - run: cargo codspeed build --profile profiling --features "codspeed,performance" -p uv-bench + run: cargo codspeed build --profile profiling --features codspeed -p uv-bench - name: "Run benchmarks" uses: CodSpeedHQ/action@0010eb0ca6e89b80c88e8edaaa07cfe5f3e6664d # v3.5.0 diff --git a/crates/uv-bench/Cargo.toml b/crates/uv-bench/Cargo.toml index fe02b3173..70fe7a98a 100644 --- a/crates/uv-bench/Cargo.toml +++ b/crates/uv-bench/Cargo.toml @@ -58,6 +58,4 @@ ignored = ["uv-extract"] [features] codspeed = ["codspeed-criterion-compat"] -performance = [ - "uv-extract/performance" -] +static = ["uv-extract/static"] diff --git a/crates/uv-dev/Cargo.toml b/crates/uv-dev/Cargo.toml index 905b59dc5..c9d218360 100644 --- a/crates/uv-dev/Cargo.toml +++ b/crates/uv-dev/Cargo.toml @@ -66,13 +66,10 @@ name = "uv-dev" required-features = ["dev"] [features] -default = ["performance"] +default = ["performance", "uv-extract/static"] # Actually build the dev CLI. dev = [] -performance = [ - "performance-memory-allocator", - "uv-extract/performance" -] +performance = ["performance-memory-allocator"] performance-memory-allocator = ["dep:uv-performance-memory-allocator"] render = ["poloto", "resvg", "tagu"] diff --git a/crates/uv-distribution/Cargo.toml b/crates/uv-distribution/Cargo.toml index 6207fea62..55975fcc4 100644 --- a/crates/uv-distribution/Cargo.toml +++ b/crates/uv-distribution/Cargo.toml @@ -63,4 +63,4 @@ insta = { version = "1.40.0", features = ["filters", "json", "redactions"] } [features] default = [] -performance = ["uv-extract/performance"] +static = ["uv-extract/static"] diff --git a/crates/uv-extract/Cargo.toml b/crates/uv-extract/Cargo.toml index fabd03c3b..c25c2677d 100644 --- a/crates/uv-extract/Cargo.toml +++ b/crates/uv-extract/Cargo.toml @@ -40,7 +40,8 @@ zip = { workspace = true } [features] default = [] -performance = ["xz2/static"] +# Avoid a liblzma.so dependency +static = ["xz2/static"] [package.metadata.cargo-shear] ignored = ["xz2"] diff --git a/crates/uv/Cargo.toml b/crates/uv/Cargo.toml index fb6ac0266..a29a17feb 100644 --- a/crates/uv/Cargo.toml +++ b/crates/uv/Cargo.toml @@ -136,33 +136,44 @@ ignored = [ ] [features] -default = ["python", "python-managed", "pypi", "git", "performance", "crates-io", "slow-tests", "test-ecosystem"] +default = ["performance", "uv-distribution/static", "default-tests"] # Use better memory allocators, etc. -performance = [ - "performance-memory-allocator", - "uv-distribution/performance", -] +performance = ["performance-memory-allocator"] performance-memory-allocator = ["dep:uv-performance-memory-allocator"] + +# Adds self-update functionality. This feature is only enabled for uv's cargo-dist installer +# and should be left unselected when building uv for package managers. +self-update = ["axoupdater", "uv-cli/self-update"] + +# Features for development only. tracing-durations-export = ["dep:tracing-durations-export", "uv-resolver/tracing-durations-export"] -# Introduces a dependency on a local Python installation. -python = [] -# Introduces a dependency on a local Python installation with specific patch versions. -python-patch = [] -# Introduces a dependency on managed Python installations. -python-managed = [] -# Introduces a dependency on PyPI. -pypi = [] -# Introduces a dependency on Git. -git = [] -# Introduces a dependency on crates.io. +# Features that only apply when running tests, no-ops otherwise. +default-tests = [ + "crates-io", + "git", + "pypi", + "python", + "python-managed", + "slow-tests", + "test-ecosystem" +] +# Introduces a testing dependency on crates.io. crates-io = [] +# Introduces a testing dependency on Git. +git = [] +# Introduces a testing dependency on PyPI. +pypi = [] +# Introduces a testing dependency on a local Python installation. +python = [] +# Introduces a testing dependency on a local Python installation with specific patch versions. +python-patch = [] +# Introduces a testing dependency on managed Python installations. +python-managed = [] # Include "slow" test cases. slow-tests = [] # Includes test cases that require ecosystem packages test-ecosystem = [] -# Adds self-update functionality. -self-update = ["axoupdater", "uv-cli/self-update"] [package.metadata.dist] dist = true