Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLFormatter Dependency issue #199

Closed
mynona opened this issue Sep 15, 2024 · 7 comments
Closed

HTMLFormatter Dependency issue #199

mynona opened this issue Sep 15, 2024 · 7 comments

Comments

@mynona
Copy link

mynona commented Sep 15, 2024

Unfortunately, the great enhancement by @QuietMisdreavus has just been merged to "main" but not released.

When I use this feature in a library with SPM:

.package(url: "https://github.com/swiftlang/swift-markdown.git", revision: "2c126ce9fa33fc8b48258ee27ab51b33989161a3"),

(Regardless if I use revision to point to the commit or branch)

and import it as dependency to another project then SPM fails with the following error message as it doesn't accept branch or revision as a stable version.

Package XY cannot be used because package XY is required using a stable-version but XY depends on an unstable-version package 'swift-markdown' 

@QuietMisdreavus
Could you please be so kind and release this enhancement with a release version number?

Or in case, there is a work-around for SPM maybe you can support me how to reference to the commit or branch as dependency. The issue only appears when pointing to another package that has the dependency (2 level). If you import it directly to one feature it works with revision and branch. Unfortunately, SPM, will also not accept revision or branch if you try to import it in all features.

Additionally I found a small bug: added it here as it is related to the newline issue
#197

@MahdiBM
Copy link

MahdiBM commented Sep 15, 2024

@mynona have you tried forking this repo and depending on the fork instead?
SwiftPM will still complain (warning, not error), but at least you might get unblocked for now.

@mynona
Copy link
Author

mynona commented Sep 15, 2024

Hi @MahdiBM , this did not work because swift-markdown itself depends on a "non-stable" version according to SPM

 .package(url: "https://github.com/swiftlang/swift-cmark.git", branch: "gfm"),

I didn't experience this issue in the past. Maybe this is connected to XCode 16


I did more research and found out that you cannot have from: on one level and then a dependency on a branch on another level. Example: You have a repository with a release tag "1.0.0". When you create the dependeny to this repo than all dependencies in each repo you refer to must also be based on release tags. All the way back from repo to repo. Either you reference only branches and commits (branch: revision:) or you referency only release tags (from:).

Example:

some-repo.git from: "1.0.0" -> "swift-markdown.git" from: "x.x.x" -> cmark from: "x.x.x" (only FROM references)
some-repo.git branch: "main" -> "swift-markdown.git" branch: "main" -> cmark branch: "gfm" (only branch or revision references)

But SPM fails when you mix FROM & BRANCH/REVISION dependency references across repos.

It's a really weird behavior and I am 100% sure that this worked in the past prior to XCode 16

Anyway, it would be best if a release could be done for swift-markdown instead of referencing the main branch or a specific commit.

@QuietMisdreavus
Copy link
Contributor

Thank you for testing the HTML Formatter!

Swift-Markdown releases version tags based on releases of Swift itself. When a major or minor release of Swift is finalized, we tag the corresponding release/*.* branch in Swift-Markdown with a new version and push it up. This means that the code that currently lives in main (like HTMLFormatter) will only be part of a tagged release once the next version of Swift after 6.0 is released.

If you want to test the HTML Formatter before that happens, you need to depend on branch or commit versions for the entire dependency line that leads to Swift-Markdown. You cannot depend on a tagged version that itself depends on a branch or commit; that is part of the entire design of Swift Package Manager.

@QuietMisdreavus QuietMisdreavus closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2024
@mynona
Copy link
Author

mynona commented Sep 16, 2024

I guess 6.0 will anyway be released soon and this problem will be solved :-)

@QuietMisdreavus
Copy link
Contributor

6.0 will not have this change, as the formatter was not cherry-picked into release/6.0. The release after 6.0 will have this change.

@MahdiBM
Copy link

MahdiBM commented Sep 16, 2024

@QuietMisdreavus I wonder if a pre-release would be possible? Will that even solve this problem?!

I understand that this is more like a SwiftPM issue, but would be nice if libraries could be understanding of the situation. (well, even if it's a "feature", I still see it as an "issue". From a user's POV, I expect SwiftPM to just allow me to use different versions etc..., perhaps with some warnings about my bad usage, but nothing more)

@0xTim
Copy link
Member

0xTim commented Sep 17, 2024

Related - #178

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

No branches or pull requests

4 participants