Skip to content

Commit

Permalink
Fix local_binaries to be called on the correct dir
Browse files Browse the repository at this point in the history
Previously, it was caused on the associated dir but that was worked by accident.

Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Dec 12, 2018
1 parent cee68de commit 6354569
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/gen_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ module Gen(P : Install_rules.Params) = struct
begin match List.last comps with
| Some ".bin" ->
let src_dir = Path.parent_exn dir in
Super_context.local_binaries sctx ~dir
Super_context.local_binaries sctx ~dir:src_dir
|> List.iter ~f:(fun t ->
let src = File_bindings.src_path t ~dir:src_dir in
let dst = File_bindings.dst_path t ~dir in
Expand Down
4 changes: 2 additions & 2 deletions src/super_context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ val ocaml_flags
-> Buildable.t
-> Ocaml_flags.t

(** Binaries that are symlinked in local .bin directories. [dir]
should point to such a [.bin] directory, such as [foo/bar/.bin]. *)
(** Binaries that are symlinked in the associated .bin directory of [dir]. This
associated directory is [Path.relative dir ".bin"] *)
val local_binaries : t -> dir:Path.t -> string File_bindings.t

(** Dump a directory environment in a readable form *)
Expand Down
39 changes: 16 additions & 23 deletions test/blackbox-tests/test-cases/env-bins/run.t
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
Basic test that we can use private binaries as public ones
$ dune build --root private-bin-import
Entering directory 'private-bin-import'
File "using-priv/dune", line 7, characters 0-79:
7 | (alias
8 | (name runtest)
9 | (action
10 | (progn
11 | (run priv)
12 | (run priv-renamed))))
Error: No rule found for using-priv/.bin/priv
File "using-priv/dune", line 7, characters 0-79:
7 | (alias
8 | (name runtest)
9 | (action
10 | (progn
11 | (run priv)
12 | (run priv-renamed))))
Error: No rule found for using-priv/.bin/priv-renamed
[1]
priv alias using-priv/runtest
Executing priv as priv
PATH:
_build/default/test/blackbox-tests/test-cases/env-bins/private-bin-import/_build/default/using-priv/.bin
_build/default/test/blackbox-tests/test-cases/env-bins/private-bin-import/_build/install/default/bin
_build/install/default/bin
priv-renamed alias using-priv/runtest
Executing priv as priv-renamed
PATH:
_build/default/test/blackbox-tests/test-cases/env-bins/private-bin-import/_build/default/using-priv/.bin
_build/default/test/blackbox-tests/test-cases/env-bins/private-bin-import/_build/install/default/bin
_build/install/default/bin

Override public binary in env
$ dune build --root override-bins
Entering directory 'override-bins'
File "test/dune", line 5, characters 0-43:
5 | (alias
6 | (name runtest)
7 | (action (run foo)))
Error: No rule found for test/.bin/foo
[1]
foo alias test/runtest
private binary
foo alias default
public binary

0 comments on commit 6354569

Please sign in to comment.