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

Override for development_dependencies #655

Open
jwoertink opened this issue Nov 3, 2024 · 3 comments
Open

Override for development_dependencies #655

jwoertink opened this issue Nov 3, 2024 · 3 comments

Comments

@jwoertink
Copy link

I'm trying to test an update locally on Windows, and I'm not able to use the shard override for development_dependencies.

# shard.yml
name: test
version: 0.1.0
crystal: '>= 1.14.0'
license: MIT
development_dependencies:
  db:
    github: crystal-lang/crystal-db
    version: 0.13.1
# shard.override.yml
development_dependencies:
  db:
    github: crystal-lang/crystal-db
    branch: master
> $env:SHARDS_OVERRIDE = 'shard.override.yml'
> shards install

However, I do see that overrides from dependencies make it over. It seems to be just the development_dependencies that are ignored.

Expected Output

The install output should say "Installing db (0.13.1 at 892c256)"
Checking inside of the lib\db\src I expected to see changes made since the 0.13.1 release.

Actual Output

The install output says "Installing db (0.13.1)" and the lib dir shows code from 3eaac85

@straight-shoota
Copy link
Member

straight-shoota commented Nov 3, 2024

This is not specific to Windows. The same thing happens on Linux.

It looks like overrides only apply to dependencies, not to development_dependencies:

add_lock base, lock_index, apply_overrides(spec.dependencies)

I'm not sure if this is completely intentional or just an omission.
The documentation only mentions that the override file provides overrides for dependencies (https://github.com/crystal-lang/shards/blob/master/docs/shards.adoc#files), although the language is a bit fuzzy because both dependencies and development_dependencies are categories of dependencies.

Btw. you don't need to set $env:SHARDS_OVERRIDE = 'shard.override.yml'. That's already the default value.

@ysbaddaden
Copy link
Contributor

I don't see any issues that dependencies wouldn't have, so I guess it was just an omission.

@straight-shoota
Copy link
Member

I suppose a possible explanation is that shards does not install nested development_dependencies, only those defined in the top shard.yml. So it's considerably more straightforward to override them there directly, compared to overriding nested dependencies' shard.yml.

Having to edit shard.yml directly is still not convenient for keeping a local override outside of git and consistent across branches etc. So I guess it makes sense to add overrides for development_dependencies as well.

@straight-shoota straight-shoota changed the title Shards override development_dependencies doesn't work on Windows Override for development_dependencies Nov 4, 2024
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