|
| 1 | +Checks whether dev-tool locking takes custom build directories correctly into account. |
| 2 | + |
| 3 | + $ . ./helpers.sh |
| 4 | + |
| 5 | +Set up some ocamlformat that we want to install. |
| 6 | + |
| 7 | + $ ocamlformat_version="0.26.2" |
| 8 | + $ make_fake_ocamlformat "${ocamlformat_version}" |
| 9 | + $ make_ocamlformat_opam_pkg "${ocamlformat_version}" |
| 10 | + |
| 11 | + $ cat > .ocamlformat <<EOF |
| 12 | + > version = ${ocamlformat_version} |
| 13 | + > EOF |
| 14 | + |
| 15 | +Override the build directory that we want to build in. We do this by replacing |
| 16 | +the build directory in `$dev_tool_lock_dir` with our custom build directory. |
| 17 | + |
| 18 | + $ default_build_dir="_build" |
| 19 | + $ custom_build_dir="_other_build" |
| 20 | + $ default_dev_tool_lock_dir="${dev_tool_lock_dir}" |
| 21 | + $ dev_tool_lock_dir="${dev_tool_lock_dir/#$default_build_dir/$custom_build_dir}" |
| 22 | +
|
| 23 | +Create a configuration with this custom build directory |
| 24 | +
|
| 25 | + $ make_project_with_dev_tool_lockdir |
| 26 | + $ enable_pkg |
| 27 | +
|
| 28 | +Make sure we don't have a lock dir |
| 29 | +
|
| 30 | + $ [ -e "${dev_tool_lock_dir}"/lock.dune ] || echo "Lock dir does not exist in custom location" |
| 31 | + Lock dir does not exist in custom location |
| 32 | + $ [ -e "${default_dev_tool_lock_dir}"/lock.dune ] || echo "Lock dir does not exist in default location" |
| 33 | + Lock dir does not exist in default location |
| 34 | +
|
| 35 | +Install our fake ocamlformat, making sure to override the build directory. |
| 36 | +
|
| 37 | + $ dune tools install ocamlformat --build-dir="${custom_build_dir}" |
| 38 | + Solution for _other_build/.dev-tools.locks/ocamlformat: |
| 39 | + - ocamlformat.0.26.2 |
| 40 | +
|
| 41 | +This should've worked and picked up our ocamlformat using the lock dir |
| 42 | +configuration from the dune-workspace. But also, we should now have a lock dir |
| 43 | +at the right location, in our custom build dir. |
| 44 | +
|
| 45 | + $ [ -e "${dev_tool_lock_dir}"/lock.dune ] && echo "Lock dir created correct, custom location" |
| 46 | + Lock dir created correct, custom location |
| 47 | + $ [ -e "${default_dev_tool_lock_dir}"/lock.dune ] || echo "Lock dir does not exist in default location" |
| 48 | + Lock dir does not exist in default location |
0 commit comments