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

Equivalent of "go mod vendor"? #588

Open
MistressRemilia opened this issue Jun 11, 2023 · 2 comments
Open

Equivalent of "go mod vendor"? #588

MistressRemilia opened this issue Jun 11, 2023 · 2 comments

Comments

@MistressRemilia
Copy link
Contributor

MistressRemilia commented Jun 11, 2023

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.

@straight-shoota
Copy link
Member

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 #584 (comment)

@MistressRemilia
Copy link
Contributor Author

MistressRemilia commented Jun 15, 2023

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 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants