Skip to content

Clear out Swift library-evolution warnings on non-Apple platforms#35

Draft
nil4 wants to merge 6 commits intomainfrom
reduce-warnings-non-apple-os
Draft

Clear out Swift library-evolution warnings on non-Apple platforms#35
nil4 wants to merge 6 commits intomainfrom
reduce-warnings-non-apple-os

Conversation

@nil4
Copy link
Copy Markdown
Contributor

@nil4 nil4 commented Mar 3, 2026

On Apple platforms, Swift library evolution is a thing, but not on Linux/Windows.

The CI build logs are currently spammed by many hundreds of messages, e.g. from https://github.com/royalapplications/royalvnc/actions/runs/22570476612/job/65376761117#step:8:37 to https://github.com/royalapplications/royalvnc/actions/runs/22570476612/job/65376761117#step:8:2171 (2000+ lines) which drowns any other output and makes build issues very hard to track, understand or troubleshoot.

A few things changed here:

  1. in Package.swift, -enable-library-evolution is only enabled on Apple platforms
  2. @_implementationOnly is replaced in source by internal import
  3. when using the C SDK, @_implementationOnly is kept for Apple platforms, but changed to plain import everywhere else, since library evolution is not a thing.

This eliminates the warning spew on non-Apple platforms; see these recent CI logs going from 2000+ lines down to < 50.

I'm not entirely happy with the duplication when using the C SDK. I think we could further clean up by:

  • dropping -enable-library-evolution build flags
  • replacing @_implementationOnly with internal import (where possible) and regular import elsewhere -- this is the root cause of all the warnings

Let me know what you prefer.

On Apple platforms, Swift library evolution is a thing, but not on Linux/Windows.

The CI build logs are currently spammed by many hundreds of messages, e.g.
from https://github.com/royalapplications/royalvnc/actions/runs/22570476612/job/65376761117#step:8:37
to https://github.com/royalapplications/royalvnc/actions/runs/22570476612/job/65376761117#step:8:2171
(some 2000+ lines) which drowns any other build output and makes build issues
very hard to track, understand and troubleshoot.

A few things change here:
1. in Package.swift, `-enable-library-evolution` is only enabled on Apple platforms
2. @_implementationOnly is replaced in source by `internal import`
3. in the C SDK, @_implementationOnly is kept for Apple platforms, but changed
   to `internal import` everywhere else, since library evolution is not a thing

Hopefully reduces or eliminates the warning spew on non-Apple platforms;
let's see if CI logs show a drop from 2000 lines to something more palatable.
@nil4 nil4 requested a review from lemonmojo March 3, 2026 08:43
@nil4 nil4 self-assigned this Mar 3, 2026
@nil4 nil4 added the enhancement New feature or request label Mar 3, 2026
@lemonmojo
Copy link
Copy Markdown
Member

lemonmojo commented Mar 3, 2026

@nil4 It's not that easy unfortunately. Regular import will make Swift API clients have to import the module that is now publicly imported in RoyalVNC. That's exactly what @_implementationOnly is for. I would love to switch to the modern alternative (internal import) and I already tried but it doesn't currently work the way it's supposed to, at least in our case. I had this refactoring in place already but had to revert it at the last minute because it would cause havoc in unexpected ways that are hard to debug.

As for -enable-library-evolution, adding it only on Apple platforms might work right now and as long as Swift on other platforms doesn't support it. I'm not sure if removing it is a good idea though without proper testing. We would IMHO have to at least test using the resulting artifacts on machines that don't have any Swift libraries installed to be sure that this doesn't break anything which I currently don't fancy doing to be honest...

@nil4 nil4 marked this pull request as draft March 3, 2026 10:06
@nil4
Copy link
Copy Markdown
Contributor Author

nil4 commented Mar 3, 2026

Fair enough, let's keep this as a draft until time is right to test this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants