Skip to content

Fix xcframework public headers for macOS and other slices#147

Open
AttilaTheFun wants to merge 1 commit into
stasel:latestfrom
AttilaTheFun:lshire-fix-macos-headers
Open

Fix xcframework public headers for macOS and other slices#147
AttilaTheFun wants to merge 1 commit into
stasel:latestfrom
AttilaTheFun:lshire-fix-macos-headers

Conversation

@AttilaTheFun
Copy link
Copy Markdown

@AttilaTheFun AttilaTheFun commented May 11, 2026

Fix xcframework public headers and versioned framework layout

Summary

This updates scripts/build.sh so each generated WebRTC.xcframework slice has a valid, self-contained framework layout before it is packaged.

The build script now:

  • Locates the correct Headers and WebRTC binary paths for both versioned and unversioned framework layouts.
  • Fixes invalid versioned framework layouts by moving PrivacyInfo.xcprivacy to Versions/A/Resources/ and removing nested Versions directories.
  • Normalizes stale source-tree header imports such as "sdk/objc/base/RTCMacros.h" to packaged framework imports such as <WebRTC/RTCMacros.h>.
  • Copies missing imported public RTC*.h headers into each framework slice.
  • Validates each packaged framework slice before zipping the xcframework.

Motivation

Recent release artifacts can contain incomplete framework header directories. In particular, the native macOS slice may package only WebRTC.framework/Versions/A/Headers/WebRTC.h, while that umbrella header imports additional public headers such as RTCAudioSource.h. This makes import WebRTC fail for macOS consumers even though the framework binary is present.

There have also been simulator artifacts with public headers that still import source-tree paths like sdk/objc/base/RTCMacros.h. Those paths are not available to SwiftPM, Bazel, CocoaPods, or Carthage consumers after the framework is packaged.

The versioned macOS and Catalyst framework layouts also need to be valid for consumers that inspect or embed the framework bundle directly. A malformed nested path such as Versions/A/Versions/A/Resources/PrivacyInfo.xcprivacy can break embedding in build systems such as rules_apple, so the packaging step now moves the privacy manifest into Versions/A/Resources/ and rejects unexpected entries under Versions/A.

Repairing and validating framework layout during xcframework assembly keeps each slice independently importable and catches broken packaging before a release asset is uploaded.

Validation

I validated this locally by building WebRTC M148 with iOS, iOS simulator, macOS, and macOS Catalyst slices enabled, then checking:

  • The xcframework contains the expected iOS device, iOS simulator, macOS, and macOS Catalyst libraries.
  • No packaged headers contain stale sdk/objc/... imports.
  • Every <WebRTC/RTC*.h> import in packaged public headers resolves to a header in the same framework slice.
  • Versioned macOS and Catalyst frameworks contain no nested Versions/A/Versions/... directory.
  • Direct Swift import WebRTC typechecks for macOS, iOS simulator, iOS device, and macOS Catalyst.

@AttilaTheFun AttilaTheFun force-pushed the lshire-fix-macos-headers branch from 2f05be2 to d47aae0 Compare May 11, 2026 19:23
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