Closed faustinoaq closed 5 years ago
Just some crystal projects works as I expected showing Dependencies are satisfied
👍
But almost every project I build keep fetching shards every time 😞
What if you run "shards install" initially then run "shards build"?
The same happens, keep fetching during shards build
even after shards install
But I'm wondering Why 👇 works?
I can reproduce this with ambrockets
. These two lines from the build command are interesting:
Installing quartz_mailer (0.2.0 at 0.2.1)
Installing smtp (0.1.0 at 0.1)
These are exactly the same versions as had been installed in the previous run of shards install
, so it seems like shards does not recognize it already has the correct versions and tries to reinstall.
Perhaps it has something to do with the reported/installed version not exactly matching the version in the spec?
The issue is in the "shards check" command. It fails, and causes the install command to run. I believe @straight-shoota is right. Something confuses shards, and it doesn't understand a version has been correctly installed.
I found the issue 🎉
The problem is v0.1
version on:
smtp:
github: raydf/smtp.cr
version: ~> 0.1
I did a fork updating smtp shard to:
smtp:
github: faustinoaq/smtp.cr
version: ~> 0.2.0
Then shards build
works again 💯
➜ shards build ambrockets
Fetching https://github.com/faustinoaq/amber.git
Fetching https://github.com/luislavena/radix.git
Fetching https://github.com/jeromegn/kilt.git
Fetching https://github.com/jeromegn/slang.git
Fetching https://github.com/stefanwille/crystal-redis.git
Fetching https://github.com/mosop/cli.git
Fetching https://github.com/mosop/optarg.git
Fetching https://github.com/mosop/callback.git
Fetching https://github.com/mosop/string_inflection.git
Fetching https://github.com/mosop/teeplate.git
Fetching https://github.com/samueleaton/sentry.git
Fetching https://github.com/juanedi/micrate.git
Fetching https://github.com/crystal-lang/crystal-db.git
Fetching https://github.com/jwaldrip/shell-table.cr.git
Fetching https://github.com/askn/spinner.git
Fetching https://github.com/will/crystal-pg.git
Fetching https://github.com/crystal-lang/crystal-mysql.git
Fetching https://github.com/crystal-lang/crystal-sqlite3.git
Fetching https://github.com/amberframework/granite-orm.git
Fetching https://github.com/faustinoaq/quartz-mailer.git
Fetching https://github.com/faustinoaq/smtp.cr.git
Fetching https://github.com/amberframework/jasper-helpers.git
Fetching https://github.com/amberframework/garnet-spec.git
Fetching https://github.com/ysbaddaden/selenium-webdriver-crystal.git
Installing amber (0.3.8)
Installing radix (0.3.8)
Installing kilt (0.4.0)
Installing slang (1.7.0)
Installing redis (1.9.0)
Installing cli (0.6.10)
Installing optarg (0.5.8)
Installing callback (0.6.3)
Installing string_inflection (0.2.1)
Installing teeplate (0.4.5)
Installing sentry (0.1.1)
Installing micrate (0.3.0)
Installing db (0.4.3)
Installing shell-table (0.9.2)
Installing spinner (0.1.1)
Installing pg (0.13.4)
Installing mysql (0.3.3)
Installing sqlite3 (0.8.3)
Installing granite_orm (0.7.8)
Installing quartz_mailer (0.2.4)
Installing smtp (0.2.0)
Installing jasper_helpers (0.1.6)
Installing garnet_spec (0.1.1)
Installing selenium (0.3.0)
Building: ambrockets
➜ ambrockets git:(master) ✗ shards build ambrockets
Dependencies are satisfied
Building: ambrockets
➜ ambrockets git:(master) ✗ shards build ambrockets
Dependencies are satisfied
Building: ambrockets
➜ ambrockets git:(master) ✗ shards build ambrockets
Dependencies are satisfied
Building: ambrockets
Now, I'm wondering, why shards
is complaining about v0.1
?
The issue is caused by a mismatch between the v1.0
tag and the version: 0.1.0
in shard.yml
in the smtp
shard.
This happens to work when resolving, because v0.1
matches the ~> 0.1.0
constraint, but the locked version will be 0.1
in shard.lock
which doesn't equal 0.1.0
, which in turn causes shards check
to fail —once a lock file is present, version constraints do not apply, and installed versions must be exact.
We should always use versions from shard.yml
, and only use the repository tags to identify/seek versions in the repository tree.
@ysbaddaden Thank you! I think I can close this issue now 👍
This is still a bug/todo.
Not exactly a bug, since this is caused by mismatched version numbers (1.0
isn't 1.0.0
), but we can smooth things out.
Hi @ysbaddaden @RX14
Always I execute
shards build
to build my crystal projects and it works very well, However shards is fetching my depencencies everytime I execute it, first time is slower because is cloning repositories, next times are a bit faster but still take some time.I'm wondering why it doesn't show something like:
Almost always I see:
Even if my shards are already satisfied
Versions: