johnxnguyen / Down

Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Other
2.24k stars 319 forks source link

Make Down portable as a built Apple Framework #266

Closed erikkerber closed 1 year ago

erikkerber commented 3 years ago

Resolves #120

The Down library as-is does not generate a "portable" framework, as described very well in this blog post. The result is that anyone who attempts to build and consume Down as an Apple Framework needs to add the cmark directory from source into the SWIFT_INCLUDE_PATHS

SWIFT_INCLUDE_PATHS = $(inherited) $(PROJECT_DIR)/Carthage/Checkouts/down/Source/cmark

Additionally, having matching module names and types exposes the Down library to this bug: https://bugs.swift.org/browse/SR-14195.

This only manifests when the framework is built for distribution, but it does make building with library evolution/BUILD_LIBRARY_FOR_DISTRIBUTION = YES impossible.

This change does the following:

The renaming of the module is critical for portability, but could easily be dropped from this PR if that's something that is too aggressive at the moment.

larryonoff commented 3 years ago

I have an issue when importing this library into my Swift Package. This PR fixes this.

johnxnguyen commented 3 years ago

There's some issues with Travis CI that need working out, I'll fix it this weekend.

larryonoff commented 3 years ago

I'll make PR today. Maybe there're a bit simpler solution.

larryonoff commented 3 years ago

Please see https://github.com/johnxnguyen/Down/pull/268

MarcoEidinger commented 2 years ago

@johnxnguyen any plans to merge this PR? Being able to build a working xcframework would be really helpful!

larryonoff commented 2 years ago

@johnxnguyen any plans to merge this PR? Being able to build a working xcframework would be really helpful!

I just copied Down to our local repos for the moment. :(

johnxnguyen commented 2 years ago

The test target is failing to build, I would like to resolve this first before merging.

erikkerber commented 1 year ago

Sorry friends as I did not steward this to completion.

@johnxnguyen I rebased off master to see if the error still reproduced and, if so, actually get a CI result that hasn't been time expired.

If you think this is better off just being closed, that is fine as well. We now consume and build Down via Bazel, so the portable pre-built framework is no longer "needed" by us. Happy to land this if it helps others though.