[webkit-changes] [WebKit/WebKit] 0989df: [Build] Forward-declare SPI of public Swift modules

Elliott Williams noreply at github.com
Thu Sep 5 10:38:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0989dff43b2be30c821bb0ffded99720abce12f5
      https://github.com/WebKit/WebKit/commit/0989dff43b2be30c821bb0ffded99720abce12f5
  Author: Elliott Williams <emw at apple.com>
  Date:   2024-09-05 (Thu, 05 Sep 2024)

  Changed paths:
    M Configurations/CommonBase.xcconfig
    A Source/WebKit/Platform/spi/visionos/QuickLook_SPI.swiftinterface
    M Source/WebKit/WebKitSwift/Preview/PreviewWindowController.swift

  Log Message:
  -----------
  [Build] Forward-declare SPI of public Swift modules
https://bugs.webkit.org/show_bug.cgi?id=278736
rdar://problem/134794714

Reviewed by Andy Estes.

WebKit on visionOS 2 introduces our first use of SPI in a public,
Swift-only framework--`PreviewApplication` in QuickLook. Add a
handwritten .swiftinterface that declares the SPI.

Unlike LinearMediaKit <https://commits.webkit.org/278332@main>, which is
a private Swift framework, we should not replace the entire
.swiftinterface from the SDK. Doing so would require re-declaraing every
public interface of QuickLook.

Instead, add a new "QuickLook_SPI" .swiftinterface which re-exports
QuickLook and declares the SPI we're using. Import it when the public
SDK is in use.

QuickLook_SPI's .swiftinterface specificies `-module-abi-name
QuickLook`, so the mangled symbols names match what is actually present
in the framework.

Unfortunately, there doesn't seem to be an obvious way to
have the _SPI module re-export the _real_ SPI on internal SDKs, because
even with @_exported, Swift's @_spi imports only provide visibility to
the source file they are written in.

* Configurations/CommonBase.xcconfig: Expose USE_APPLE_INTERNAL_SDK as a
  compilation condition, since we currently don't have a way for the
  Swift compiler to read platform flags.
* Source/WebKit/Platform/spi/visionos/QuickLook_SPI.swiftinterface: Added.
* Source/WebKit/WebKitSwift/Preview/PreviewWindowController.swift:

Canonical link: https://commits.webkit.org/283222@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list