Repository navigation
Description
This was generated by AI.
Where #13 left this
PR #15 made Destinations build on Linux and added a Linux build CI job. Fixes #13 closed the issue, but one part of its acceptance is not met: swift build and swift test for the whole package still fail on Linux, and CI runs no test there. The job only builds 8 modules and 6 test targets one by one.
What blocks it
SwiftPM builds every target on Linux, and these need Apple frameworks:
| Target | Needs | How much of it |
|---|---|---|
CoreAudioIO |
AudioToolbox, CoreAudio | 1 file (InputSession.swift); the other 5 are already inside #if os(...) |
MixerLink |
Network | 2 files import it; 19 of 23 files need the types those two declare |
Appearance, Meters |
SwiftUI | most files |
BroadcastWaveTests |
AVFoundation | 4 files (1 already guarded inside) |
MixerLinkTests, MetersTests, AppearanceTests |
the modules above | most files |
swift test builds every test target, so one failing target stops all tests.
Constraints
- Apple builds do not change: same products, same targets, same sources compiled.
- The
MixerLinkandMetersproducts must resolve on every platform. ShowRecorderKit namesMixerLinkwith no condition (Apple only in practice). SoundcheckKit namesMixerLinkandMeterswithcondition: .when(platforms: apple)and tests on Linux; a product missing from the manifest fails resolution even behind a condition.
Options
A. Guards in the sources (recommended). Wrap each file that needs an Apple framework in #if canImport(<framework>) ... #endif, at file level, named for the framework it needs (Network, SwiftUI, AudioToolbox, AVFoundation). Package.swift does not change. On Linux, MixerLink, Appearance, Meters and CoreAudioIO build with little or nothing in them, and files that need no framework still build and run their tests.
- For: it is what the code already does (
CoreAudioIO,DriveFolderStore,StereoStemTests, and SoundcheckKit's#if canImport(MixerLink)). The condition is about the platform being built for, so it is right when cross-compiling. Each guard is true wherever the file compiles today, so Apple builds get the same sources. Tests of pure code keep running on Linux (all ofBroadcastWaveTestsexcept the AVFoundation files). - Against: many files get two lines each (about 19 in
MixerLink, most of its tests). A new file in these modules needs the guard too; the Linux job fails until it has one.
B. Conditions in Package.swift. On a non-Apple host, point the Apple-only targets at empty stub folders (or list files to exclude), keeping the products.
- For: a small diff (the manifest and a few stub files); no source file changes.
- Against:
#ifin a manifest tests the machine running SwiftPM, not the platform built for. Two definitions of each target to keep in step. All or nothing per target, soBroadcastWaveTestswould still need source guards or lose its Linux run. Nothing in either repo does this today.
C. Remove the Apple-only targets and products on Linux. Ruled out: SoundcheckKit's manifest would no longer resolve.
Recommendation
Option A. One caveat for consumers: once MixerLink and Meters build (mostly empty) on Linux, canImport(MixerLink) is true there for a consumer that depends on them without a platform condition. SoundcheckKit keeps its condition, so nothing changes for it.
Acceptance
swift buildandswift testpass for the whole package on Linux (Swift 6.2 and later), and the tests that need no Apple framework run.- The CI Linux job runs whole-package
swift buildandswift test. - SoundcheckKit's
swift teststill passes on Linux against this. - No change on Apple platforms;
Package.swiftproducts and targets are the same.
Activity
The whole package builds and tests on Linux: files that need an Apple…