Skip to content

Conversation

dlskawns96
Copy link
Contributor

Bug/issue #239

Summary

This PR addresses the SwiftPM resolution failure introduced in version 0.7.0 where the Markdown target included unsafeFlags in its swiftSettings.

On non-Windows platforms (iOS, macOS, Linux), SwiftPM forbids depending on packages that contain unsafe build flags as tagged dependencies, leading to errors like: the target ‘Markdown’ in product ‘Markdown’ contains unsafe build flags

Implementation overview

  • Refactored swiftSettings so that unsafeFlags are only included when building on Windows.
  • On non-Windows, the manifest no longer includes unsafeFlags, restoring SwiftPM compatibility.

Dependencies

None.
(Future work may involve updating swift-cmark to move the CMARK_GFM_STATIC_DEFINE into its cSettings.)

Testing

Steps:

  1. Add this branch as a dependency in a SwiftPM project (iOS/macOS).
    .package(url: "https://github.com/dlskawns96/swift-markdown.git",
             .branch("fix/guard-unsafeflags-nonwindows"))
  2. Run xcodebuild -resolvePackageDependencies or open in Xcode.
  3. Confirm the package resolves successfully (previously failed with unsafe flags error).
  4. On Windows, verify that the build still succeeds with the required CMARK_GFM_STATIC_DEFINE.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests (not applicable, this is a manifest-only change)
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

Copy link
Contributor

@QuietMisdreavus QuietMisdreavus left a comment

Choose a reason for hiding this comment

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

Is this issue happening with the just-tagged 0.7.0 release? If so, i can cherry-pick it and release a 0.7.1 tag with this fix.

@QuietMisdreavus
Copy link
Contributor

@swift-ci Please test

@QuietMisdreavus
Copy link
Contributor

Oh, i just saw the issue you filed. I can go ahead and publish a 0.7.1 tag when CI passes and i can merge this PR.

@QuietMisdreavus QuietMisdreavus merged commit 8ad5dcc into swiftlang:main Sep 17, 2025
2 checks passed
@QuietMisdreavus
Copy link
Contributor

Thanks so much for opening the PR! I'll let you know when i can publish a new tag with the fix in it.

@dlskawns96
Copy link
Contributor Author

Thanks for the quick review and merge! 🙏


// On non-Windows, do not include unsafe flags so SwiftPM allows tagged dependency usage.
var markdownSwiftSettings: [SwiftSetting] = []
#if os(Windows)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work, this restricts to building on windows, not for windows.

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.

3 participants