Skip to content

fix(bindings,ci): Remove unsafeFlags from swift publish#1136

Open
DaughterOfMars wants to merge 1 commit intodevelopfrom
fix/unsafe-flags
Open

fix(bindings,ci): Remove unsafeFlags from swift publish#1136
DaughterOfMars wants to merge 1 commit intodevelopfrom
fix/unsafe-flags

Conversation

@DaughterOfMars
Copy link
Copy Markdown
Contributor

@DaughterOfMars DaughterOfMars commented May 8, 2026

Summary

Fixes make swift-release-example, which currently errors with:

error: 'release': the target 'IotaSDK' in product 'IotaSDK' contains unsafe build flags

The published Package.swift on iotaledger/iota-sdk-swift carries a linkerSettings: [.unsafeFlags(["-L", "Sources/CIotaSDK", "-liota_sdk_ffi"])] clause on the IotaSDK target. SwiftPM forbids consuming a package whose targets declare .unsafeFlags(...), so any downstream consumer (including the release example) is broken. The flags were a side-effect of the publish workflow archiving the local-dev bindings/swift/Package.swift verbatim and overwriting the consumer repo's Package.swift with it on every release — the comment in that file claiming the published copy uses an XCFramework was aspirational.

This PR makes that comment true: the publish flow now builds an XCFramework from the per-target dylibs and ships a clean Package.swift that references it via .binaryTarget. The local-dev Package.swift (still using .unsafeFlags for fast in-repo iteration) is unchanged.

Changes

bindings/swift/dist/ (new)

  • Package.swift — the manifest that gets written into iota-sdk-swift on publish. Uses .binaryTarget(name: "CIotaSDK", path: "IotaSDK.xcframework"), drops the example targets and .unsafeFlags.
  • module.modulemap — bundled into each XCFramework slice's Headers/.

.github/workflows/swift_publish.yml

  • New xcframework job: lipos the macOS x86_64 + arm64 dylibs into a universal slice, then xcodebuild -create-xcframework over the macOS fat lib + iOS device dylib + iOS-sim dylib. Produces IotaSDK.xcframework as an artifact.
  • release-archives now consumes xcframework (instead of prepare-libraries-archives directly), copies dist/Package.swift over the local-dev one, removes Sources/CIotaSDK, lib, and dist before commit.
  • prepare-source-archive now ships bindings/swift/dist instead of bindings/swift/Package.swift.
  • prepare-libraries-archives matrix simplified: runs-on: macos-latest hoisted out of every entry, and the constant lib: libiota_sdk_ffi.dylib field is gone (inlined where used).

.github/workflows/{swift,csharp,go}_publish.yml

  • if: guards on prepare-libraries-archives standardized from contains(tag_name, ...) to startsWith(tag_name, ...), matching the source-archive jobs and being precise about the tag prefix format.

@DaughterOfMars DaughterOfMars requested a review from a team as a code owner May 8, 2026 09:44
Comment thread bindings/swift/dist/Package.swift
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