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

✨ Select highest tag when there are sibling tags #279

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jprudent
Copy link

@jprudent jprudent commented Nov 7, 2023

This fixes issue #238

@SethTisue SethTisue self-assigned this Nov 29, 2023
@jprudent
Copy link
Author

jprudent commented Dec 4, 2023

Oh I didn't notice tests were not passing on CI. I don't have time today I think. I will definitely try to fix those.

@SethTisue SethTisue removed their assignment Dec 4, 2023
@SethTisue
Copy link
Member

I had to approve CI to run. I'll see any further updates sooner now that I'm watching the PR.

@SethTisue SethTisue marked this pull request as draft December 4, 2023 15:26
@jprudent
Copy link
Author

I run the tests locally. They are passing.
Thanks for your review!

@jprudent jprudent marked this pull request as ready for review December 15, 2023 09:37
@SethTisue
Copy link
Member

I'll take a look later this week.

@SethTisue
Copy link
Member

SethTisue commented Jan 7, 2024

(sorry for the slower-than-promised response time)

Well, this looks reasonable to me, though I don't know the code in this repo — my involvement here is largely administrative. So I'd be inclined to optimistically merge, as it could always be refined later.

But I have one question for @dwijnand and @eed3si9n — is there prior art for the version number comparison logic, something we could be using instead of adding or own custom code...? (I imagine this wheel has been reinvented many times in many programming languages...) Something in sbt itself perhaps?

@eed3si9n
Copy link
Member

eed3si9n commented Jan 8, 2024

The exact detail of what's considered high or low actually depends on the impl detail of Ivy or Coursier for somethings like 1.0-A1 vs 1.0-RC1, iirc but sbt implements https://www.scala-sbt.org/1.x/api/sbt/librarymanagement/SemanticSelector.html, which lets you create a semantic versioning selector a la npm version expression, which can say greater than based on SemVer logic, which is usually good enough.

@SethTisue
Copy link
Member

@jprudent want to take a stab at using the API Eugene suggests?

@jprudent
Copy link
Author

jprudent commented Jan 8, 2024

sure! let's change the status of PR to changes required, I'll have a look soon

@SethTisue SethTisue marked this pull request as draft January 8, 2024 16:00
@jprudent
Copy link
Author

Hello fellows, I need a bit of advice.

This project has 2 modules:

  • dynver which contains the "pure" logic and independant of SBT
  • sbtdynver which contains the nuts and bolts of an Sbt plugin. It depends of dynver.

The class SemanticSelector is provided by librarymanagement-core which is an SBT artifact, and not available in dynver module. To use it I need to introduce a dependency or merge both modules. What would you do ?

@dwijnand
Copy link
Member

Add the dependency to the core.

@jprudent jprudent marked this pull request as ready for review January 17, 2024 08:34
@jprudent
Copy link
Author

jprudent commented Jan 17, 2024

Hello,

I added the dependency as provided. I also added a few tests.

sbt test

Commits can be squashed.

README.md Outdated Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
@SethTisue
Copy link
Member

SethTisue commented Jan 30, 2024

I added the dependency as provided

What's the reasoning there?

Note that CI is failing.

@SethTisue SethTisue marked this pull request as draft January 30, 2024 15:21
@jprudent
Copy link
Author

Hello Seth, thanks again for your time and feedback.

I didn't notice that the project was cross compiled. The CI does a sbt +test that runs tests for all scala versions, I didn't know.

I just changed the dependency to pull the correct artifact depending of scala version. Note that scala 3 artifacts are still alpha in the repo

The theory behind the Provided was that since the plugin is running in SBT, it already has the library in its classloader when executed and doesn't need to hard depend on it.
But with the new definition of dependency in my last commit fce4d43, the dependency clashes with the one provided by SBT (tests failed in scripted). So I will reintroduce Provided. The danger with this kind of dependency is that the code is compiled against a given version of it, but at runtime the API may change or the Class can't be found. Since I only use a very small subset of it that looks quite stable (VersionSelector and SemanticSelector) we can expect that will never happen.

I will set the dep as Provided and I will write a scripted test (that I discovered in the process...) in a future commit of this PR.

Thanks again and sorry for all that churn.

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.

None yet

4 participants