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

Automatically update the lock file when the project dependencies and lock file are not in sync #2464

Closed
paulcadman opened this issue Oct 23, 2023 · 0 comments · Fixed by #2522
Milestone

Comments

@paulcadman
Copy link
Collaborator

Say you have the following project:

name: abc
dependencies:
- .juvix-build/stdlib
- git:
    name: test
    url: https://github.com/anoma/juvix-test
    ref: v0.6.0

After compiling the project the following juvix.lock.yaml is generated:

# This file was autogenerated by Juvix version 0.5.2.
# Do not edit this file manually.

dependencies:
- path: .juvix-build/stdlib
  dependencies: []
- git:
    name: test
    ref: a94c61749678ff57556ee6e4cb1f8fbbddbc4ab1
    url: https://github.com/anoma/juvix-test
  dependencies:
  - git:
      name: stdlib
      ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45
      url: https://github.com/anoma/juvix-stdlib
    dependencies: []

The v0.6.0 tag has been dereferenced to the git hash of the corresponding commit. If you now update the project file to point to a new version of juvix-test and rebuild the project, the v0.6.0 code is still used because the lock file has not changed.

The proposal in this issue is to detect when the project file dependencies and the lock file are not in sync and regenerate the lock file using the new information.

@paulcadman paulcadman added this to the 0.5.5 milestone Nov 17, 2023
jonaprieto pushed a commit that referenced this issue Nov 22, 2023
Adds a new version of the lock file that stores the hash (sha256 digest)
of the package file (Package.juvix, juvix.yaml) it was generated from as
a field:

```
# This file was autogenerated by Juvix version 0.5.4.
# Do not edit this file manually.

version: 2
checksum: d05940a4d3dc0e15451d02e1294819c875ba486ee54e26865ba8d190ac7c27c3
dependencies:
- git:
    name: stdlib
    ref: f68b0614ad695eaa13ead42f3466e0a78219f826
    url: https://github.com/anoma/juvix-stdlib.git
  dependencies: []
```

The lock file is regenerated when the hash of the package file doesn't
match the value of the `checksum` field, i.e when the user updates the
package file.

Existing lock files are automatically migrated to version 2.

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

Successfully merging a pull request may close this issue.

1 participant