Fix build issues by making Compression module conditional for cross-platform compatibility #2
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.
The repository was failing to build on non-Apple platforms (Linux) due to unconditional imports of the
Compressionmodule, which is only available on macOS and iOS.Problem
The build was failing with errors like:
This occurred because:
STComparator.swiftimportedCompressionunconditionallyDownloadableFile.swiftused compression functionality without platform checksSolution
Applied minimal surgical changes following the existing conditional compilation patterns in the codebase:
Made STComparator conditional: Wrapped the entire
STComparator.swiftfile in#if canImport(Compression)to only compile on platforms where compression is available.Made compression API conditional: Updated
DownloadableFile.swiftto only expose thecompression()method when the Compression module is available.Made tests conditional: Updated compression tests to only run on platforms that support compression.
Benefits
The compression functionality remains fully available on macOS and iOS where it's supported, while allowing the library to build and function on other platforms without compression features.
Fixes #1.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.