Skip to content

Commit 1809abc

Browse files
committed
test: switching to custom lock dir
Signed-off-by: Ali Caglayan <[email protected]>
1 parent d87f4a7 commit 1809abc

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
This test checks what happens when you lock with default directory then change
2+
workspace to use a custom lock directory.
3+
4+
$ . ./helpers.sh
5+
$ mkrepo
6+
$ mkpkg foo
7+
8+
$ cat > dune-workspace <<EOF
9+
> (lang dune 3.21)
10+
> (lock_dir
11+
> (repositories mock))
12+
> (repository
13+
> (name mock)
14+
> (url "file://$(pwd)/mock-opam-repository"))
15+
> EOF
16+
17+
$ cat > dune-project <<EOF
18+
> (lang dune 3.21)
19+
> (package
20+
> (name myproject)
21+
> (depends foo))
22+
> EOF
23+
24+
Lock with default directory name:
25+
26+
$ dune pkg lock
27+
Solution for dune.lock:
28+
- foo.0.0.1
29+
30+
Now change the workspace to use a custom lock directory:
31+
32+
$ cat > dune-workspace <<EOF
33+
> (lang dune 3.21)
34+
> (lock_dir
35+
> (path custom.lock)
36+
> (repositories mock))
37+
> (repository
38+
> (name mock)
39+
> (url "file://$(pwd)/mock-opam-repository"))
40+
> EOF
41+
42+
$ dune build
43+
Error: No rule found for default/.lock/dune.lock (context _private)
44+
[1]
45+
46+
Now try with a context stanza that references the custom lock directory with a
47+
context stanza:
48+
49+
$ cat > dune-workspace <<EOF
50+
> (lang dune 3.21)
51+
> (context
52+
> (default
53+
> (lock_dir custom.lock)))
54+
> (lock_dir
55+
> (path custom.lock)
56+
> (repositories mock))
57+
> (repository
58+
> (name mock)
59+
> (url "file://$(pwd)/mock-opam-repository"))
60+
> EOF
61+
62+
This gives an internal error:
63+
64+
$ dune build
65+
Error: The package myproject does not have any user defined stanzas attached
66+
to it. If this is intentional, add (allow_empty) to the package definition in
67+
the dune-project file
68+
-> required by _build/default/myproject.install
69+
-> required by alias all
70+
-> required by alias default
71+
[1]

0 commit comments

Comments
 (0)