Add the opt-in Metadata trait, replacing SWIFTPM_BLUETOOTH_METADATA - #231
Merged
Conversation
Moves BluetoothMetadata behind a package trait instead of an environment variable, so the base package no longer links Foundation and a resource bundle unconditionally — consumers opt in per the usual SwiftPM trait mechanism instead of setting an env var before build. Manually extracted from feature/c-abi's "Add the opt-in BluetoothABI/CBluetooth C ABI targets and a Metadata trait" (which bundled this with unrelated C ABI scaffolding this branch doesn't want) rather than a straight cherry-pick.
Code Coverage OverviewLanguages: Swift Swift / code-coverage/llvm-covThe overall coverage in commit 961bf31 in the Show a code coverage summary of the most impacted files.
Updated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the
SWIFTPM_BLUETOOTH_METADATAenvironment variable with anopt-in
Metadatapackage trait for gatingBluetoothMetadata(theBluetooth SIG assigned-numbers name lookups for
CompanyIdentifier,BluetoothUUID, andUnitIdentifier). Consumers now opt in via thestandard SwiftPM trait mechanism instead of setting an env var before
building.
Package.swiftdeclares theMetadatatrait (default: disabled)and conditions
BluetoothMetadata's dependency edges on it, insteadof the old
if buildMetadata { ... }env-var check.BluetoothUUID,CompanyIdentifier, andUnitIdentifier'smetadata-backed
namelookups (and their*Metadataextensionfiles) are gated behind the trait at the source level.
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 ittogether 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 buildswift build --traits Metadataswift testswift test --traits Metadata