Skip to content

Add watchOS support via a MultiSessionLogging package trait#8

Closed
leogdion wants to merge 1 commit into
mergesort:mainfrom
brightdigit:feat/watchos-package-trait
Closed

Add watchOS support via a MultiSessionLogging package trait#8
leogdion wants to merge 1 commit into
mergesort:mainfrom
brightdigit:feat/watchos-package-trait

Conversation

@leogdion

Copy link
Copy Markdown

Summary

Makes Broadcast build cleanly on watchOS (and tvOS/visionOS) by declaring those platforms and isolating the Boutique-backed MultiSessionLogger behind a package trait, so it never burdens the default build.

Changes

Platform support

  • Added watchOS 11.0, tvOS 18.0, visionOS 2.0 floors (matching the floor required by Synchronization.Mutex).

MultiSessionLogging package trait

Boutique's dependency chain (Bodega / SQLite / swift-collections) does not declare watchOS, and Bodega's URL.documentsDirectory / .cachesDirectory usage fails to compile when a build assigns those targets a watchOS floor below 9.0. To keep the watch build clean:

  • MultiSessionLogger and its tests are guarded by #if MultiSessionLogging.
  • A new Package@swift-6.1.swift manifest declares a MultiSessionLogging trait (default OFF), gating the Boutique product with .when(traits:). With the trait off, SwiftPM prunes Boutique from the dependency graph entirely, so Bodega never compiles and Boutique stays out of Package.resolved. Consumers who want cross-launch persistence opt in by enabling the trait.
  • swiftLanguageModes: [.v5] keeps the 6.1 manifest in Swift 5 language mode, so it only adds the trait rather than also flipping the package into Swift 6 mode (which would turn the existing static var globals into hard concurrency errors).
  • The swift-tools-version:5.10 Package.swift is the fallback for older toolchains (traits require 6.1+): it carries no Boutique dependency, and MultiSessionLogger compiles to nothing there because the trait flag is never set.
  • The MultiSessionLogger tests stay declared so they appear in reports, and carry a .requiresMultiSessionLogging condition trait that disables them when the trait is off.

Notes

This is one half of a split of #6. The companion PR (#7) makes ConsoleLogger Apple-only; both together reproduce #6's state.

🤖 Generated with Claude Code

@leogdion leogdion marked this pull request as ready for review June 25, 2026 20:04
Declare watchOS/tvOS/visionOS platform floors (matching Synchronization.Mutex)
and gate MultiSessionLogger + its Boutique backing behind a new
`MultiSessionLogging` package trait (default OFF):

- Package@swift-6.1.swift declares the trait and gates the Boutique product
  with `.when(traits:)`; swiftLanguageModes: [.v5] keeps Swift 5 semantics so
  the manifest only adds the trait.
- Package.swift (tools-5.10 fallback) drops the Boutique dependency.
- MultiSessionLogger.swift and its test are wrapped in `#if MultiSessionLogging`;
  the suite/tests carry a `.requiresMultiSessionLogging` condition trait.

With the trait off, SwiftPM prunes Boutique (Bodega/SQLite/swift-collections),
so the watch build never compiles Bodega.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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