-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Shards overrides #422
Shards overrides #422
Conversation
6971b50
to
c84e66c
Compare
Should we really touch the regular If I have to take care to not commit the dirty lock, why have a separate file for overrides in the first place? It could just be section in OTOH what's wrong with committing the overrides file and the lock changes from that? If collaborating on a project with outdated dependencies (the primary usecase for this), why should everybody have to redo the overrides? |
This whole flow with additional file seems wrong to me. I'd rather take inspiration from Elixir (already mentioned) instead, KISS plz. |
@jhass in theory there is nothing wrong with committing the override and lock with overrides. That should be done if the overrides are required for an app to work. It happens that I have more present the workflow of temporal overrides to fix things. If the story for sharing overrides, or forcing some resolution without warnings is wanted the last proposal of the proposal in #412 can be implemented later:
I think that having another lock file will generate confusion. The lock can be used as the source of truth for reinstalling the dependencies, if there are two, then there is a logic need to choose. @Sija in #412 I mention that adding a forced or override attribute similar to Elixir one is not backward compatible and we will be forced to add a version in the shard.yml. The alternative is to override as in Yarn which I mention. Having an additional files allows per-user customization similar to Bundler which I've found convenient to work with custom forks and local paths. |
c84e66c
to
6c6efa9
Compare
The logic in requirement_satisfied_by? was unable to allow bumping a nested dependency beyond the main dependency requirement
Advertise override file location in the comment of the lockfile
and do not require the user to perform update when changing the override file.
2c564e4
to
ef50f9a
Compare
shards install is conservative enough regarding nested dependencies
These were added before the changes in dependencies_for and this would lead to unable to satisfy the lock if there is a new commit in the overrides branch
Co-authored-by: Juan Wajnerman <juan.wajnerman@gmail.com>
Handle unlock from version to branch on install (with or without override) Properly handle locks on overrides branch Unify unlocking of nested dependencies behavior
This is a very useful feature but it's currently not easy to find via google – I arrived here by following a trail of issues. This may be related to the shards command page being outdated and not linked to the man page? /cc crystal-lang/crystal-book#476 |
Implements most of #412 .
Reads a
shard.override.yml
(or the file specified bySHARDS_OVERRIDE
) to override the source and restriction of a dependency. There are no changes regarding CLI options of shards.This allows the cases described in the motivation of #412
Usage sample
On a project that uses
github:crystal-lang/crystal-sqlite3
it will current usecrysta-db 0.8.0
.Let's suppose I need to work on a fix for
crystal-db
. I can create ashard.override.yml
file pointing to my working copy ofcrystal-db
Execute
$ shards update
to change the installed and locked version ofcrystal-db
.(Note: if
$ shards install
is used instead of update, the use will get an error regardingthat db has ambiguous sources due to the existing shard.lock and the shard.override.yml)
After this update you will have a symlink to the /my/path/to/crystal-db
And the
shard.lock
has some comments to clarify if the lock was computed with overrides and will not be safe to commit.Note that in this example we also bump
crystal-db
from 0.8 to 0.9 despite the fact thatcrystal-sqlite3
requires~> 0.8.0
. So we are overriding the requirements along the dependency graph.You can override to a specific version, branch, fork, local path and solve ambiguos reference in case the ecosystem do not agree what is the main fork for a shard name.
Having a
shard.master.yml
will all dependencies to the master/develop branch will simplify how to check if you the project is up to date with non-released changes of dependencies.Closes #412
Closes #105
Closes #299