Skip to content

Use FoundationEssentials in CancellableQueue when available#76

Merged
dfed merged 1 commit into
dfed:mainfrom
PADL:foundation-essentials
Jun 9, 2026
Merged

Use FoundationEssentials in CancellableQueue when available#76
dfed merged 1 commit into
dfed:mainfrom
PADL:foundation-essentials

Conversation

@lhoward

@lhoward lhoward commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Motivation

CancellableQueue.swift is the only file in AsyncQueue that does a plain import Foundation. On Linux that single import pulls libFoundation.solibFoundationInternationalization.so_FoundationICU into the linked binary via the autolink directive — even though the file only uses UUID and DispatchQueue, and no ICU/internationalization functionality is ever called.

For size-constrained / embedded Linux targets this drags in the entire ICU data blob (tens of MB of flash) and the Foundation internationalization library for no functional benefit.

Change

#if canImport(FoundationEssentials)
import FoundationEssentials   // UUID
import Dispatch               // DispatchQueue
#else
import Foundation
#endif
  • UUID is provided by FoundationEssentials.
  • DispatchQueue comes from Dispatch (already imported directly in Utilities/Delivery.swift, so this matches existing style in the package).
  • Platforms without FoundationEssentials fall back to full Foundation exactly as before — no behavior change.

No public API change; CancellableQueue behaves identically. This just lets it link without full Foundation/ICU where FoundationEssentials exists.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (06b1cfe) to head (84cea56).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #76   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines         1301      1301           
=========================================
  Hits          1301      1301           
Files with missing lines Coverage Δ
Sources/AsyncQueue/CancellableQueue.swift 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dfed dfed left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! One nit before I merge assuming CI passes.

Comment thread Sources/AsyncQueue/CancellableQueue.swift
@lhoward lhoward force-pushed the foundation-essentials branch from 051a7c6 to 13beb97 Compare June 9, 2026 04:28
don't import Foundation if FoundationEssentials available;
conditionally and explicitly import Dispatch
@lhoward lhoward force-pushed the foundation-essentials branch from 13beb97 to 84cea56 Compare June 9, 2026 06:01
@dfed dfed merged commit ea3a614 into dfed:main Jun 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants