Skip to content

Add XCFramework build script and publish release workflow - #838

Merged
Kyle-Ye merged 18 commits into
mainfrom
feature/build-xcframework-script
Mar 22, 2026
Merged

Add XCFramework build script and publish release workflow#838
Kyle-Ye merged 18 commits into
mainfrom
feature/build-xcframework-script

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Mar 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Scripts/build_xcframework.sh for building xcframeworks directly from Package.swift via xcodebuild archive + xcodebuild -create-xcframework
  • Add publish_release.yml GitHub Actions workflow triggered on release tags and manual dispatch
  • Fix swiftinterface leaks and library evolution issues for xcframework consumers

Close #836

Build Script

  • Supports --sdk, --archs, and --debug CLI options
  • Builds main OpenSwiftUI.xcframework plus stub xcframeworks for dependency modules (OpenSwiftUICore, OpenAttributeGraphShims, OpenCoreGraphicsShims, OpenObservation, OpenQuartzCoreShims, OpenRenderBoxShims)
  • Stub xcframeworks contain only swiftmodule/swiftinterface (code is statically linked into main framework)
  • Default SDKs: macosx and iphonesimulator. iphoneos support blocked by AG issue (Add iOS device support for OpenSwiftUI #835)

Fixes

  • Fix OpenAttributeGraphShims import leak in swiftinterface (@_spiOnly)
  • Fix OpenSwiftUI_SPI depending on OpenRenderBox instead of OpenRenderBoxShims
  • Guard UIFoundation_Private import with OPENSWIFTUI_XCFRAMEWORK_BUILD
  • Fix PreviewShims opaque return types for library evolution
  • Fix Never+View Body typealias for swiftinterface rebuild
  • Fix macOS framework bundle structure for codesigning
  • Work around xcodebuild SPM macro bug for non-macOS SDKs (Add xcframework support #836)

Test Plan

  • Build xcframeworks with bash Scripts/build_xcframework.sh OpenSwiftUI
  • Integrate into consumer Xcode project (ImageDemo)
  • Verify compile + link + launch on iOS Simulator
  • Verify compile + link + launch on macOS
  • Verify codesigning works for all stub frameworks

@github-actions github-actions Bot added enhancement platform: iOS iOS-specific behavior or support. platform: macOS macOS-specific behavior or support. labels Mar 22, 2026
@augmentcode

augmentcode Bot commented Mar 22, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds automation for producing and publishing OpenSwiftUI XCFramework artifacts, while tightening module interfaces for XCFramework consumers.

Changes:

  • Introduces Scripts/build_xcframework.sh to archive an SPM scheme per SDK/arch and assemble a primary OpenSwiftUI.xcframework.
  • Generates stub XCFrameworks for dependency modules (module interfaces only) to satisfy public .swiftinterface references.
  • Adds a publish_release.yml workflow to build, zip, compute checksums, and attach XCFrameworks to GitHub Releases (or upload as artifacts on manual runs).
  • Updates Package.swift RenderBox wiring and adjusts target settings to match the shims-based dependency layout.
  • Fixes swiftinterface “leaks” via @_spiOnly imports and guards private framework imports during XCFramework builds.
  • Adjusts preview shims to avoid opaque return types in public API and adds an XCFramework-build workaround for an SPM macro build issue.

Technical Notes: The build path uses xcodebuild archive + -create-xcframework, copies Swift module artifacts into frameworks, strips private/package interfaces by default, and includes dSYMs in slices where available.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread .github/workflows/publish_release.yml Outdated
Comment thread Scripts/build_xcframework.sh
@Kyle-Ye
Kyle-Ye force-pushed the feature/build-xcframework-script branch from 5af537d to 7b8dc7f Compare March 22, 2026 12:26
Kyle-Ye added 9 commits March 22, 2026 21:07
xcodebuild builds macro targets for the target SDK platform instead of
the host platform, causing "malformed response" errors on non-macOS SDKs.
Expand @entry macro inline under OPENSWIFTUI_XCFRAMEWORK_BUILD flag.
- Zip each xcframework individually with per-framework checksums
- On tag push: create GitHub release with all zips and .binaryTarget entries
- On manual trigger: output to step summary and upload as artifacts
- Remove zip step from build_xcframework.sh (handled by workflow)
@Kyle-Ye
Kyle-Ye force-pushed the feature/build-xcframework-script branch from 68888ff to 7ee2e49 Compare March 22, 2026 13:07
@Kyle-Ye
Kyle-Ye force-pushed the feature/build-xcframework-script branch from 7ee2e49 to c75eb64 Compare March 22, 2026 13:15
@Kyle-Ye
Kyle-Ye force-pushed the feature/build-xcframework-script branch from 831f64f to c7a487d Compare March 22, 2026 14:30
@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.93%. Comparing base (1fa5257) to head (7160e6b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #838      +/-   ##
==========================================
- Coverage   27.01%   26.93%   -0.08%     
==========================================
  Files         666      671       +5     
  Lines       42826    43332     +506     
==========================================
+ Hits        11568    11671     +103     
- Misses      31258    31661     +403     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Replace BASH_SOURCE[0] with zsh-native ${0:a:h}
- Use shell: zsh in workflow to match script shebang
@Kyle-Ye
Kyle-Ye force-pushed the feature/build-xcframework-script branch from e09f383 to 3ff690f Compare March 22, 2026 14:48
Kyle-Ye added 3 commits March 22, 2026 23:21
- Add contents: write permission for creating releases
- Fix tag name interpolation in release body URLs
- Simplify body generation using multiline strings
Use printf for multiline ENTRY to avoid breaking YAML block scalar.
- Extract common build logic into .github/actions/build-xcframework
- release.yml: triggered by version tags, creates GitHub release
- build_xcframework.yml: manual trigger, uploads artifacts
@Kyle-Ye
Kyle-Ye merged commit d74b3d3 into main Mar 22, 2026
7 of 8 checks passed
@Kyle-Ye
Kyle-Ye deleted the feature/build-xcframework-script branch March 22, 2026 15:32
@Kyle-Ye Kyle-Ye added area: tooling Developer tooling, package manifests, Tuist, scripts, formatting, or release tooling. type: build Build system, packaging, toolchain, release, or compiler support. type: ci GitHub Actions, test infrastructure, runners, checks, or automation. type: feature New API, behavior, platform support, or user-facing capability. labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tooling Developer tooling, package manifests, Tuist, scripts, formatting, or release tooling. platform: iOS iOS-specific behavior or support. platform: macOS macOS-specific behavior or support. type: build Build system, packaging, toolchain, release, or compiler support. type: ci GitHub Actions, test infrastructure, runners, checks, or automation. type: feature New API, behavior, platform support, or user-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add xcframework support

1 participant