shards
shards copied to clipboard
Equivalent of "go mod vendor"?
Is there any plan to add a command similar to go mod vendor
, or something similar that can make tarballs of a Shard's dependencies automatically?
The reason I'm asking is because Slackware Linux's community packages, called SlackBuilds, strongly discourages the downloading of any sort of dependencies at build time. Instead, all sources needed for building should be downloadable ahead of time. I use Slackware myself and would really like to distribute some of my Crystal software as SlackBuilds.
However, Shards seems to clash with the way SlackBuilds are handled. For example, if I check out a shard and run shards build
, Shards will download dependencies via git/mercurial/fossil/etc into a lib
directory. It looks like it also symlinks this directory into a lib
directory for each dependency.
People who maintain Go-based programs often use the go mod vendor
command to wrap up everything needed into a separate vendor
directory (for example, nwg-bar). Rust packages do something similar, where the crates are downloaded ahead of time (e.g. alacritty).
I've already tried manually putting the dependencies in a lib
directory that I created myself, but Shards insists on re-downloading them. Adding --local
doesn't help. So far the only solution I've found is to call the compiler directly, but this seems to run counter to having Shards build stuff in the first place.
So far the only solution I've found is to call the compiler directly, but this seems to run counter to having Shards build stuff in the first place.
I think this is a perfectly fine solution. Shards' purpose is to manage dependencies. If you don't need that because all dependencies are already packaged, there's simply no point in using Shards.
This is basically the same argument as https://github.com/crystal-lang/shards/issues/584#issuecomment-1538743238
I was under the impression that Shards managed dependencies and acted as a build tool. But, if the recommended way is to just reconstruct the lib/
directory by hand (as I'm doing now), then that's fine.
I do still think it would benefit from some sort of vendor
command, though, where it tarballs your dependencies for you. It took me far longer to tarball the correct dependencies for Benben as specified by shards.lock the other day than I care to admit :sweat_smile: