Make ConsoleLogger Apple-only for non-Apple builds#10
Open
leogdion wants to merge 2 commits into
Open
Conversation
ConsoleLogger imported OSLog unconditionally, breaking non-Apple builds (`no such module 'OSLog'`). Wrap the whole type in `#if canImport(OSLog)` so it stays OSLog-backed on Apple platforms and is simply unavailable where OSLog can't be imported (e.g. Linux). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Boutique (Bodega/SQLite/swift-collections) imports CryptoKit, which is unavailable off Apple platforms. Gate its target dependency to Apple via `.when(platforms:)` so SwiftPM never compiles it on Linux, and wrap `MultiSessionLogger` + its test in `#if canImport(Boutique)`. `Log.default` drops the OSLog-only `ConsoleLogger` where OSLog is absent. Bump swift-tools to 6.0 (with swiftLanguageModes [.v5]): the library uses `Synchronization.Mutex` and `Foundation.FormatStyle`, both of which only exist in the Swift 6.0 toolchain on Linux. The iOS 18 / macOS 15 floor already requires Swift 6 on Apple, so 5.10 toolchains now get a clean tools-version error instead of failing deep in the FormatStyle layer. Verified: `swift build` is green on Linux (swift:6.3) and macOS (6.3.2); 5.10 fails fast with a clear "requires Swift tools 6.0" message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3572819 to
012a3a6
Compare
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
ConsoleLoggerimportedOSLogunconditionally, which breaks non-Apple builds withno such module 'OSLog'(e.g. Linux). This wraps the whole type — the import, theLogger-backed implementation, and theOSLogTypemapping — in#if canImport(OSLog).The result:
ConsoleLoggerstays backed by Apple's unified logging system (Console.app / Xcode / OSLog tools) on Apple platforms, and is simply unavailable on platforms without OSLog — no separate code path to maintain.Notes
Sources/Broadcast/Loggers/ConsoleLogger.swift).MultiSessionLoggingpackage trait) prunes the Boutique dependency, which is what fully unblocks dependency resolution on Linux; both together reproduce Fixing WatchOS Support and Non-Apple Builds #6's state.Supersedes #7 (recreated from a fresh fork after the prior
brightdigit/Broadcastrepo was detached from the fork network).🤖 Generated with Claude Code