crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

branch master not satisfy condition >= #563

Open kostya opened 1 year ago

kostya commented 1 year ago

My project have dependencies (master because i want to test some things, before release version): shard1 shard2 branch: master

shard1 have dependencies: shard2 version >= '1.0.0'

both dependencies is ok, because master is >= 1.0.0, but shards unable to resolve this Failed to resolve dependencies.

straight-shoota commented 1 year ago

Can you provide a reproducible example? This should be expected to work, as you mention. And I'm sure shards does that correctly (in general).

kostya commented 1 year ago
dependencies:
  test_shard1:
    github: kostya/test_shard1
  test_shard2:
    github: kostya/test_shard2
    branch: master

shards --version Shards 0.17.0 [85b30b5] (2022-03-24)

shards update
Resolving dependencies
Fetching https://github.com/kostya/test_shard1.git
Fetching https://github.com/kostya/test_shard2.git
Unable to satisfy the following requirements:

- `test_shard2 (branch master)` required by `shard.yml`
- `test_shard2 (>= 1.0.0)` required by `test_shard1 0.1.0`
Failed to resolve dependencies
beta-ziliani commented 1 year ago

I think it's sensible that shards takes >= 1.0.0 to mean "releases >= than...". For such scenario, you should go with shards.override.yml (at least until we find another way).

kostya commented 1 year ago

There is a way to check if branch >= sha or not: git rev-list --count v1.0.0..master if it return number > 0, master is >= v1.0.0

straight-shoota commented 1 year ago

@kostya That check only works correctly if the commit tagged with v1.0.0 is a parent of master, which is not necessarily the case.

This is not really necessary, though. The combination of branch: master and version: >= 1.0.0 can be verified by fetching shard.yml at master and checking the reported version against the constraint.

I think that should work and that's what I would expect to happen.