Feature/spm library product#1
Merged
Merged
Conversation
Set up the new SwiftPM library target and product so external packages can depend on us, with a placeholder source file. Sources move in the next commit. Executable target and tests unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Splits the package into two targets:
- LiveAudioServerCore (new library product): all the server, encoding,
streaming, and config logic. Exposes a public façade:
* struct ServerConfig (aka LiveAudioServerConfig typealias)
* final class LiveAudioServer with init(config:), start() async throws,
stop() async, isRunning
* enum LiveAudioServerError for setup-failure cases
* func parseCLI(_:) -> CLIParseResult — pure, testable
* version/notice constants
- LiveAudioServer (executable): a thin shim around the library that does
argv parsing, signal handling, and process exit.
CLame is now a dependency of the library, not the executable. Tests now
@testable import LiveAudioServerCore.
Behavior changes:
- HTTPServer.swift no longer calls exit(1) when its NWListener enters the
.failed state; library code never terminates the process.
Behavior unchanged:
- CLI flags, defaults, exit codes, on-the-wire protocol all identical.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds LiveAudioServerLogger protocol with SilentLogger and StderrLogger implementations, plus a process-wide LiveAudioServerLogging.logger sink. The library's log() function now hands every formatted line to that sink instead of calling fputs(stderr) directly. The default logger is SilentLogger so a SwiftPM consumer never gets stderr output unless they opt in. The CLI shim installs StderrLogger at startup, preserving identical CLI output. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Four new tests under "LiveAudioServer public API" exercise the public façade the way a host SwiftUI app would: - LiveAudioServerConfig defaults match CLI defaults. - start() then GET /status.json then stop() round-trips cleanly, with isRunning flipping true → false at the boundaries. Encoders are disabled in this test to sidestep a libmp3lame assertion that fires when lame_encode_flush runs without any frames having been encoded (real flow always has frames). - stop() on a never-started server is a no-op. - Calling start() while already running throws .alreadyRunning. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Documents the new LiveAudioServerCore library product: SwiftPM dependency snippet, public API usage example (config + start/stop), and integrator notes (multi-instance, SIGPIPE, encoder lifecycle gotcha, which module to import). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The build_arch helper echoed its progress line on stdout alongside the swift build --show-bin-path output, so $(build_arch arm64) captured both and the subsequent binary-existence check looked at a malformed path. Redirect the progress echo to stderr so only the bin path lands in the captured stdout. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Swap the NSLock guarding LiveAudioServer's running flag for a serial DispatchQueue, because NSLock.lock()/unlock() trip a Swift 6 availability warning inside async functions while DispatchQueue.sync is async-safe and gives the same mutual exclusion. With the lock replaced, mark both LiveAudioServer and PCMReader @unchecked Sendable so host apps can hold them across actor boundaries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Updates Version.swift and the README's SwiftPM dependency snippet and sample Bonjour TXT records to 0.1.3. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds ServerConfig.tlsIdentity (sec_identity_t) so embedders can share one already-loaded identity across multiple listeners instead of re-reading the .p12 from disk. The CLI continues to use tlsIdentityPath/tlsPassword; the new field takes precedence when set. Makes loadTLSIdentity and TLSIdentityError public so hosts can reuse the existing loader. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Merge changes for shared TLS certificates.