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

--local flag doesn't respect CRYSTAL_PATH #584

Closed
CyberTailor opened this issue May 8, 2023 · 3 comments
Closed

--local flag doesn't respect CRYSTAL_PATH #584

CyberTailor opened this issue May 8, 2023 · 3 comments

Comments

@CyberTailor
Copy link

Steps to reproduce

  1. Install dependencies to /tmp/crystalpath
  2. Add /tmp/crystalpath to the CRYSTAL_PATH environment variable
  3. Remove shards cache
  4. Run:
    shards --local build

Expected behavior

Dependencies are satisfied

Actual behavior

Resolving dependencies
Missing repository cache for "crystal-pg". Please run without --local to fetch it.
@straight-shoota
Copy link
Member

The --local flag affects the repository cache, not the lib directory where dependencies are checked out.
I figure the documentation for this option should be improved to make that clear.

If you want to have dependencies installed in a custom path, you can set the environment variable SHARDS_INSTALL_PATH.

However, if you simply want to use dependencies already installed in that path and not do any dependency resolution, there's no point in using shards at all. It has nothing to do.
After adding that path to CRYSTAL_PATH you can just run crystal build directly.

@CyberTailor
Copy link
Author

If you want to have dependencies installed in a custom path, you can set the environment variable SHARDS_INSTALL_PATH.

Same error.

After adding that path to CRYSTAL_PATH you can just run crystal build directly.

With shards build I don't have to write targets manually ;-)

@straight-shoota
Copy link
Member

Same error.

Yes. --local tells shards to not update the repository cache. But it needs all dependency repositories to be available in the cache.
When dependencies are missing, it asks to run without --local to be able to fetch them. Without a populated repository cache, shards cannot work.

Shards' job is to resolve dependencies. Your use case seems to have no need for that, so you should better do without trying to mess with shards to prevent it from its job.

If you want build recipes, I'd recommend to use a build system like make.

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

No branches or pull requests

2 participants