Skip to content

Guard gzip pool behind canImport(zlib) for non-Darwin host builds - #2

Closed
poly-jeff wants to merge 1 commit into
mainfrom
poly/zlib-canimport-guard
Closed

Guard gzip pool behind canImport(zlib) for non-Darwin host builds#2
poly-jeff wants to merge 1 commit into
mainfrom
poly/zlib-canimport-guard

Conversation

@poly-jeff

Copy link
Copy Markdown

Why

connect-swift's GzipCompressionPool does an unconditional import zlib. The non-Darwin Swift toolchain used for Android/Skip host builds (skip export's x86_64-unknown-linux-gnu pass) has no zlib module, so the import fails with no such module 'zlib' and the whole shared package fails to compile on Linux CI runners.

What

  • Gate import zlib and the gzip compress/decompress bodies behind #if canImport(zlib), matching the fork's existing conditional-import conventions (canImport(Darwin), canImport(OSLog), canImport(FoundationNetworking)).
  • On platforms without zlib, compress/decompress throw a new GzipError.unsupportedPlatform so callers fail loudly instead of the module failing to compile.
  • Apple platforms (iOS/macOS) are unaffected.

Consumed downstream via swift-proto-gateway-usmobile-app. Tag 1.2.3-polymarket.2 will be cut from this once merged.

Made with Cursor

The non-Darwin Swift toolchain used for Android/Skip host builds (skip
export's x86_64-unknown-linux-gnu pass) has no `zlib` module, so the
unconditional `import zlib` broke compilation. Gate the import and the
gzip compress/decompress bodies behind `canImport(zlib)`, throwing
`GzipError.unsupportedPlatform` on platforms where zlib is unavailable.
Apple platforms are unaffected.

Co-authored-by: Cursor <cursoragent@cursor.com>
@poly-jeff poly-jeff changed the title fix: guard gzip pool behind canImport(zlib) for non-Darwin host builds Guard gzip pool behind canImport(zlib) for non-Darwin host builds Jul 21, 2026
@poly-jeff

Copy link
Copy Markdown
Author

Closing in favor of a self-contained CI fix in mobile-app: the Linux import zlib failure is resolved by declaring a zlib Clang module in the swiftly toolchain's glibc.modulemap in setup-skip-linux, so no connect-swift fork release is needed right now. Leaving the capability-gate idea here for reference if we later want it upstreamed.

@poly-jeff poly-jeff closed this Jul 21, 2026
@poly-jeff
poly-jeff deleted the poly/zlib-canimport-guard branch July 21, 2026 17:57
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