Skip to content

Conversation

@robfeldmann
Copy link
Contributor

@robfeldmann robfeldmann commented Jul 18, 2025

Motivation

I've got a multiplatform project that uses Catalyst for macOS and I discovered (through testing the sharing-grdb-icloud alpha) that I could not archive my Mac Catalyst app to generate test builds for macOS.

Unfortunately, there seems to be a bug (Xcode or SPM?) where a package target and a package macro cannot share code from another target, else you get compilation errors when attempting to build in release for Mac Catalyst. Here is a graphic I've put together in preparation for posting in the Swift forums and/or filing a feedback:

A graphic summarizing the problem

What's in this PR?

After trying several things, the only thing that I could come up with is to borrow a page out of the swift-docc-plugin playbook where they use symbolic links as a workaround for a limitation where plugins cannot share code.

It's quite odd that this limitation seems to only apply to Mac Catalyst destinations (at least with Xcode 16.4). However, I did attempt to archive with Xcode 26 beta 3 (on macOS Sequoia 15.5) and, iirc, I was seeing the build errors even for iOS destinations.

Update: I had not downloaded fresh iOS sims so there is no way I tested iOS. The bug is still an issue with Swift 6.2 and Xcode 26 for Mac Catalyst.

How to test?

  1. From current main branch (so not including this PR) set Xcode's destination to My Mac (Mac Catalyst) and try to archive the StructuredQueries scheme:
    Xcode
  2. Observe the build errors.
  3. Now checkout this branch and perform the archive again (you may need to clean your build folder first).
  4. Confirm the archive is successful.

Alternatives considered

  • Just duplicating the two helper files and removing the StructuredQueriesSupport target altogether.

Next Steps

  • Merge this PR if/when you agree with me and don't hate this solution too bad.
  • Incorporate this into sharing-grdb
  • Incorporate this into sharing-grdb-icloud
  • There is another issue in sharing-grdb-icloud that prevents archiving for Mac Catalyst. I can follow up with a separate PR over there once it contains the fix from this PR.

Using the same technique as swift-docc-plugin to share code between plugins, this allows to share code between a macro and a target.
@robfeldmann
Copy link
Contributor Author

And here is a extremely vanilla sample project that demonstrates the issue:
MyLibrary.zip

Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

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

Thanks! I'll merge as-is. If you have any ideas oh how to get CI exercising some of the stuff that was previous failing we would be happy to take another PR, though 😄

@stephencelis stephencelis merged commit 9cfdb5c into pointfreeco:main Jul 18, 2025
3 checks passed
coenttb pushed a commit to coenttb/swift-structured-queries-postgres that referenced this pull request Oct 14, 2025
Using the same technique as swift-docc-plugin to share code between plugins, this allows to share code between a macro and a target.

Co-authored-by: Stephen Celis <[email protected]>
coenttb pushed a commit to coenttb/swift-structured-queries-postgres that referenced this pull request Oct 15, 2025
Using the same technique as swift-docc-plugin to share code between plugins, this allows to share code between a macro and a target.

Co-authored-by: Stephen Celis <[email protected]>
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.

2 participants