mirror of
https://github.com/anoma/juvix.git
synced 2024-12-14 08:27:03 +03:00
dad3963c00
This PR adds lock file support to the compiler pipeline. The lock file is generated whenever a compiler pipeline command (`juvix {compile, typecheck, repl}`) is run. The lock file contains all the information necessary to reproduce the whole dependency source tree. In particular for git dependencies, branch/tag references are resolved to git hash references. ## Lock file format The lock file is a YAML `juvix.lock.yaml` file written by the compiler alongside the package's `juvix.yaml` file. ``` LOCKFILE_SPEC: { dependencies: { DEPENDENCY_SPEC, dependencies: LOCKFILE_SPEC } DEPENDENCY_SPEC: PATH_SPEC | GIT_SPEC PATH_SPEC: { path: String } GIT_SPEC: { git: {url: String, ref: String, name: String } } ``` ## Example Consider a project containing the following `juvix.yaml`: ```yaml dependencies: - .juvix-build/stdlib/ - git: url: https://github.com/anoma/juvix-containers ref: v0.7.1 name: containers name: example version: 1.0.0 ``` After running `juvix compile` the following lockfile `juvix.lock.yaml` is generated. ```yaml # This file was autogenerated by Juvix version 0.5.1. # Do not edit this file manually. dependencies: - path: .juvix-build/stdlib/ dependencies: [] - git: name: containers ref: 3debbc7f5776924eb9652731b3c1982a2ee0ff24 url: https://github.com/anoma/juvix-containers dependencies: - git: name: stdlib ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45 url: https://github.com/anoma/juvix-stdlib dependencies: [] - git: name: test ref: a7ac74cac0db92e0b5e349f279d797c3788cdfdd url: https://github.com/anoma/juvix-test dependencies: - git: name: stdlib ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45 url: https://github.com/anoma/juvix-stdlib dependencies: [] ``` For subsequent runs of the juvix compile pipeline, the lock file dependency information is used. ## Behaviour when package file and lock file are out of sync If a dependency is specified in `juvix.yaml` that is not present in the lock file, an error is raised. Continuing the example above, say we add an additional dependency: ``` dependencies: - .juvix-build/stdlib/ - git: url: https://github.com/anoma/juvix-containers ref: v0.7.1 name: containers - git: url: https://github.com/anoma/juvix-test ref: v0.6.1 name: test name: example version: 1.0.0 ``` `juvix compile` will throw an error: ``` /Users/paul/tmp/lockfile/dep/juvix.yaml:1:1: error: The dependency test is declared in the package's juvix.yaml but is not declared in the lockfile: /Users/paul/tmp/lockfile/dep/juvix.lock.json Try removing /Users/paul/tmp/lockfile/dep/juvix.lock.yaml and then run Juvix again. ``` Closes: * https://github.com/anoma/juvix/issues/2334 |
||
---|---|---|
.. | ||
Compile | ||
Dev | ||
Doctor | ||
Eval | ||
Extra | ||
Format | ||
Html | ||
Repl | ||
Typecheck | ||
Base.hs | ||
Clean.hs | ||
Compile.hs | ||
Dev.hs | ||
Doctor.hs | ||
Eval.hs | ||
Format.hs | ||
Html.hs | ||
Init.hs | ||
Repl.hs | ||
Typecheck.hs |