1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 08:27:03 +03:00
juvix/test
Paul Cadman dad3963c00
Add package lockfile support (#2388)
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
2023-10-02 17:51:14 +02:00
..
Arity Report termination errors after typechecking (#2318) 2023-08-30 16:38:59 +02:00
Asm Test numbering (#1977) 2023-04-04 19:29:25 +02:00
BackendGeb VampIR integration (#2103) 2023-05-22 20:18:18 +02:00
Compilation Improve closure calls in the runtime (#2396) 2023-09-29 14:20:00 +02:00
Core Fix bug in computeTypeInfo (#2234) 2023-06-28 16:08:12 +02:00
Examples Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Formatter Update ci to use ormolu 0.5.3.0 and reformat project (#2313) 2023-08-25 17:37:23 +01:00
Internal Remove abstract (#2219) 2023-06-30 15:01:46 +02:00
Parsing Error on local instances (#2376) 2023-09-21 10:34:28 +01:00
Reachability Remove abstract (#2219) 2023-06-30 15:01:46 +02:00
Runtime Improve closure calls in the runtime (#2396) 2023-09-29 14:20:00 +02:00
Scope Add package lockfile support (#2388) 2023-10-02 17:51:14 +02:00
Termination Report termination errors after typechecking (#2318) 2023-08-30 16:38:59 +02:00
Typecheck Add nodes with no edges to the dependency graph (#2390) 2023-09-26 13:17:50 +02:00
VampIR VampIR range checks and error handling (#2344) 2023-09-12 19:56:28 +02:00
Arity.hs Support implicit arguments (#144) 2022-06-13 14:25:22 +02:00
Asm.hs Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
BackendGeb.hs End-to-end Geb compilation tests (#1942) 2023-03-29 14:02:40 +02:00
Base.hs Update ci to use ormolu 0.5.3.0 and reformat project (#2313) 2023-08-25 17:37:23 +01:00
Compilation.hs Pattern matching compilation (#1874) 2023-03-27 10:42:27 +02:00
Core.hs Implement core transformation let-hoisting (#2076) 2023-05-16 13:42:44 +02:00
Examples.hs Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Format.hs Improve formatting of single-constructor types and records (#2342) 2023-09-07 16:20:14 +02:00
Formatter.hs Add juvix format command (#1886) 2023-03-29 15:51:04 +02:00
Internal.hs Add translation from Internal to Core (#1567) 2022-11-07 14:47:56 +01:00
Main.hs VampIR integration (#2103) 2023-05-22 20:18:18 +02:00
Parsing.hs Disallow tab characters as spaces (#1523) 2022-09-07 13:59:41 +02:00
Reachability.hs Compute name dependency graph and filter unreachable definitions (#1408) 2022-07-25 18:38:44 +02:00
Runtime.hs Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
Scope.hs [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Termination.hs Add the termination checker to the pipeline (#111) 2022-05-30 13:40:52 +02:00
Typecheck.hs Add lambda expressions to internal and add typechecking support (#1538) 2022-09-23 15:43:18 +02:00
VampIR.hs Check valid argument names in YAML (#2193) 2023-06-15 16:42:58 +02:00