Skip to content

Commit 2f48ec3

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

File tree

1 file changed

+63
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)