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

Versioning rework #349

Merged
merged 10 commits into from
Apr 14, 2020
Merged

Versioning rework #349

merged 10 commits into from
Apr 14, 2020

Conversation

waj
Copy link
Member

@waj waj commented Apr 10, 2020

This ended up being a not so small PR and I have more changes coming, but I prefer to split here now that at least the tests are passing 😅

This is mostly a refactor, although I fixed some cases of locks with commits that were either not working or working not totally on purpose.

For the user, there are two (non breaking) visible changes:

  • There is a shard_name.version file for each shard within the lib directory. This replaces the .sha1 file that was generated for shards not coming from a release version.
  • The shard.lock file now contains version for both releases and git refs. For versions it's the same a before, but for git refs the version is stores something like: 0.9.0+git.commit.ed686ad3015f48f8b22cf4fbec80e8c8088ef44b

Internally there are some refactors:

  • Versions contains metadata to represent references to a commit. No more need to check either commit or version.
  • The interface of the Resolver class changed slightly:
    • versions_for(Dependency) now returns the list of versions (releases or refs) matching the dependency requirement.
    • spec(version) works only with version strings, no more refs. (refs are transformed into versions first by calling the previous method)
    • install is performed by version also, no more refs.
  • Lock files with old format can still be read and they will be transformed when needed.
  • MolinilloSolver is now pretty much agnostic to git refs. There is still a minor reference to git metadata that I plan to remove soon. Understanding of whether a version matches a requirement is delegated to the resolver.

All these changes (and the ones coming) will make it easier soon to add or fix features:

  • Know if certain commit still matches a ref
  • Provide information about outdated refs (and fix Index out of bounds error in shards outdated #325)
  • Install from locks without running the resolver
  • Better support for overrides of shards (i.e: a sub-dependency with a version with an explicit dependency in shard.yml)

spec/integration/prune_spec.cr Outdated Show resolved Hide resolved
spec/unit/git_resolver_spec.cr Show resolved Hide resolved
src/resolvers/resolver.cr Outdated Show resolved Hide resolved
waj and others added 9 commits April 13, 2020 17:03
Resolvers now provides a `versions_for(Dependency)` that returns the list of available versions (releases or refs, depending on the requirements).
Handling of repository metadata is being moved inside the resolver (Git).
Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>
@waj waj merged commit bba99f2 into crystal-lang:master Apr 14, 2020
@waj waj deleted the rework-versioning branch April 14, 2020 14:17
@bcardiff bcardiff added this to the v0.11.0 milestone May 27, 2020
taylor pushed a commit to vulk/shards that referenced this pull request Aug 11, 2020
f-fr pushed a commit to f-fr/shards that referenced this pull request Jan 2, 2021
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.

Index out of bounds error in shards outdated
3 participants