-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dune build asks for relocking (#10851)
* feat: ask to re run dune pkg lock on change Signed-off-by: Etienne Marais <[email protected]>
- Loading branch information
Showing
4 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Trying to build a package after updating the dependencies in dune-project but | ||
without running `dune pkg lock` must raise an error in the context of Dune | ||
Package Managemenet. | ||
|
||
$ . ./helpers.sh | ||
|
||
Create a fake project and lock it: | ||
|
||
$ mkrepo | ||
$ mkpkg foo <<EOF | ||
> build: [ "echo" "foo" ] | ||
> EOF | ||
$ mkpkg bar <<EOF | ||
> build: [ "echo" "bar" ] | ||
> EOF | ||
|
||
$ cat > dune-project <<EOF | ||
> (lang dune 3.16) | ||
> (package | ||
> (name test) | ||
> (allow_empty) | ||
> (depends foo)) | ||
> EOF | ||
$ add_mock_repo_if_needed | ||
$ dune pkg lock | ||
Solution for dune.lock: | ||
- foo.0.0.1 | ||
|
||
As the lock file is syncronised with `dune-pkg`, the build succeeds: | ||
$ dune build | ||
foo | ||
|
||
We add the bar dependency to the test package | ||
$ cat > dune-project <<EOF | ||
> (lang dune 3.16) | ||
> (package | ||
> (name test) | ||
> (allow_empty) | ||
> (depends foo bar)) | ||
> EOF | ||
|
||
It fails as we have not regenerated the lock: | ||
$ dune build | ||
Error: The lock dir is not sync with your dune-project | ||
Hint: run dune pkg lock | ||
[1] | ||
|
||
We fix it and the build succeeds again: | ||
$ dune pkg lock | ||
Solution for dune.lock: | ||
- bar.0.0.1 | ||
- foo.0.0.1 | ||
$ dune build | ||
bar |