Skip to content

Add the opt-in Metadata trait, replacing SWIFTPM_BLUETOOTH_METADATA - #231

Merged
colemancda merged 12 commits into
masterfrom
feature/metadata-trait
Aug 3, 2026
Merged

Add the opt-in Metadata trait, replacing SWIFTPM_BLUETOOTH_METADATA#231
colemancda merged 12 commits into
masterfrom
feature/metadata-trait

Conversation

@colemancda

Copy link
Copy Markdown
Member

Summary

Replaces the SWIFTPM_BLUETOOTH_METADATA environment variable with an
opt-in Metadata package trait for gating BluetoothMetadata (the
Bluetooth SIG assigned-numbers name lookups for CompanyIdentifier,
BluetoothUUID, and UnitIdentifier). Consumers now opt in via the
standard SwiftPM trait mechanism instead of setting an env var before
building.

  • Package.swift declares the Metadata trait (default: disabled)
    and conditions BluetoothMetadata's dependency edges on it, instead
    of the old if buildMetadata { ... } env-var check.
  • BluetoothUUID, CompanyIdentifier, and UnitIdentifier's
    metadata-backed name lookups (and their *Metadata extension
    files) are gated behind the trait at the source level.
  • Corresponding test updates for the company identifier, UUID
    metadata, GAP UUID list, battery percentage, and manufacturer
    description tests.

This is a standalone extraction of the trait-migration work from a
larger, still-open C-ABI branch. Eleven of the twelve commits are
straight cherry-picks; the trait declaration itself
(Package.swift) came from a commit on that branch that bundled it
together with unrelated C-ABI scaffolding, so that one hunk was
extracted by hand into a fresh commit instead of a literal
cherry-pick.

Verified

  • swift build (Metadata trait disabled, the default) — passes.
  • swift build --traits Metadata — passes.
  • swift test (default) — 495/495 tests pass.
  • swift test --traits Metadata — 495/495 tests pass.

Test plan

  • swift build
  • swift build --traits Metadata
  • swift test
  • swift test --traits Metadata

@github-code-quality

github-code-quality Bot commented Aug 3, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Swift

Swift / code-coverage/llvm-cov

The overall coverage in commit 961bf31 in the feature/metadata-tra... branch remains at 89%, unchanged from commit 653818f in the master branch.

Show a code coverage summary of the most impacted files.
File master 653818f feature/metadata-tra... 961bf31 +/-
Sources/Bluetoo...hMetadata.swift 100% 0% -100%
Sources/Bluetoo...rMetadata.swift 100% 0% -100%
Sources/Bluetoo...DMetadata.swift 92% 0% -92%
Sources/Bluetoo...toothUUID.swift 91% 0% -91%
Sources/Bluetoo...dentifier.swift 90% 0% -90%
Sources/Bluetoo...rMetadata.swift 80% 0% -80%
Sources/Bluetoo...dentifier.swift 71% 17% -54%
Sources/Bluetoo...dentifier.swift 100% 100% 0%
Sources/Bluetoo...toothUUID.swift 95% 100% +5%

Updated August 03, 2026 03:00 UTC

@colemancda
colemancda merged commit a0b85b2 into master Aug 3, 2026
47 checks passed
@colemancda
colemancda deleted the feature/metadata-trait branch August 3, 2026 03:02
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.

1 participant