Skip to content

chore(dependencies): only depend on the windows crate when targeting windows#2024

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
external-pr/pr2020
May 22, 2026
Merged

chore(dependencies): only depend on the windows crate when targeting windows#2024
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
external-pr/pr2020

Conversation

@bantonsson
Copy link
Copy Markdown
Contributor

External Contribution

PR #2020

What does this PR do?

spawn_worker and datadog-sidecar both declare windows as an
unconditional dependency:

[dependencies.windows]
...

Cargo builds dependencies for every target, so the windows crate is
compiled on non-Windows platforms even though it is only ever used from
modules gated behind #[cfg(target_os = "windows")]
(spawn_worker::win32 and datadog_sidecar::windows).

The windows crate carries architecture-specific definitions and does
not compile on every Rust target. On a target it does not support
(e.g. FreeBSD/powerpc64) the build fails with errors such as:

error[E0425]: cannot find type `CONTEXT` in this scope
error[E0425]: cannot find type `SLIST_HEADER` in this scope

This goes unnoticed on x86_64/aarch64 because the crate happens to
compile there.

Move the dependency under [target.'cfg(windows)'.dependencies] so
cargo only builds it on Windows, matching how it is actually used. The
workspace's other windows-crate users (libdd-crashtracker,
libdd-crashtracker-ffi, libdd-telemetry) already gate it this way.

Motivation

Building on FreeBSD/powerpc64le.

How to test the change?

Build outside of x86_64/aarch64.

@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented May 21, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 72.82% (-0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d0af024 | Docs | Datadog PR Page | Give us feedback!

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.82%. Comparing base (09d307d) to head (d0af024).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2024      +/-   ##
==========================================
- Coverage   72.84%   72.82%   -0.03%     
==========================================
  Files         458      458              
  Lines       75789    75789              
==========================================
- Hits        55210    55191      -19     
- Misses      20579    20598      +19     
Components Coverage Δ
libdd-crashtracker 65.22% <ø> (ø)
libdd-crashtracker-ffi 36.82% <ø> (ø)
libdd-alloc 98.77% <ø> (ø)
libdd-data-pipeline 86.69% <ø> (ø)
libdd-data-pipeline-ffi 78.63% <ø> (ø)
libdd-common 79.81% <ø> (ø)
libdd-common-ffi 74.41% <ø> (ø)
libdd-telemetry 73.34% <ø> (-0.03%) ⬇️
libdd-telemetry-ffi 31.36% <ø> (ø)
libdd-dogstatsd-client 82.64% <ø> (ø)
datadog-ipc 74.75% <ø> (-1.47%) ⬇️
libdd-profiling 81.69% <ø> (-0.03%) ⬇️
libdd-profiling-ffi 64.79% <ø> (ø)
libdd-sampling 97.46% <ø> (ø)
datadog-sidecar 29.06% <ø> (+0.01%) ⬆️
datdog-sidecar-ffi 9.52% <ø> (+0.22%) ⬆️
spawn-worker 48.86% <ø> (ø)
libdd-tinybytes 93.16% <ø> (ø)
libdd-trace-normalization 81.71% <ø> (ø)
libdd-trace-obfuscation 87.30% <ø> (ø)
libdd-trace-protobuf 68.25% <ø> (ø)
libdd-trace-utils 88.86% <ø> (ø)
libdd-tracer-flare 86.88% <ø> (ø)
libdd-log 74.83% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`spawn_worker` and `datadog-sidecar` both declare `windows` as an
unconditional dependency:

    [dependencies.windows]
    ...

Cargo builds dependencies for every target, so the `windows` crate is
compiled on non-Windows platforms even though it is only ever used from
modules gated behind `#[cfg(target_os = "windows")]`
(`spawn_worker::win32` and `datadog_sidecar::windows`).

The `windows` crate carries architecture-specific definitions and does
not compile on every Rust target. On a target it does not support
(e.g. FreeBSD/powerpc64) the build fails with errors such as:

    error[E0425]: cannot find type `CONTEXT` in this scope
    error[E0425]: cannot find type `SLIST_HEADER` in this scope

This goes unnoticed on x86_64/aarch64 because the crate happens to
compile there.

Move the dependency under `[target.'cfg(windows)'.dependencies]` so
cargo only builds it on Windows, matching how it is actually used. The
workspace's other `windows`-crate users (`libdd-crashtracker`,
`libdd-crashtracker-ffi`, `libdd-telemetry`) already gate it this way.
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 22, 2026

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.57 MB 7.57 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 82.01 MB 82.01 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 98.27 MB 98.27 MB 0% (0 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.02 MB 10.02 MB 0% (0 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 24.54 MB 24.54 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 81.48 KB 81.48 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 180.48 MB 180.48 MB -0% (-8.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 914.99 MB 914.99 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 7.76 MB 7.76 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 81.48 KB 81.48 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 23.24 MB 23.24 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 45.50 MB 45.50 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.15 MB 21.15 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 82.76 KB 82.76 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 184.74 MB 184.71 MB --.01% (-32.00 KB) 💪
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 900.70 MB 900.70 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.01 MB 6.01 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 82.76 KB 82.76 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 24.90 MB 24.90 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 43.00 MB 43.00 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 73.11 MB 73.11 MB 0% (0 B) 👌
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.45 MB 8.45 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 90.92 MB 90.92 MB 0% (0 B) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.08 MB 10.08 MB 0% (0 B) 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants