Skip to content

Commit

Permalink
Fix #1101
Browse files Browse the repository at this point in the history
Do not attempt to convert string -> path -> string as this loses information

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed Aug 7, 2018
1 parent 264263c commit 6dc6ac3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 11 additions & 5 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ let resolve_path path ~(setup : Main.setup) =
| [] -> can't_build path
| l -> Ok l

let resolve_target common (setup : Main.setup) s =
let resolve_target common ~(setup : Main.setup) s =
let check_path = check_path setup.contexts in
if String.is_prefix s ~prefix:"@" then begin
let pos, is_rec =
Expand Down Expand Up @@ -719,12 +719,14 @@ let log_targets ~log targets =
(Path.to_string_maybe_quoted path));
flush stdout

let resolve_targets ~log common (setup : Main.setup) user_targets =
let resolve_targets_mixed ~log common (setup : Main.setup) user_targets =
match user_targets with
| [] -> []
| _ ->
let targets =
List.map user_targets ~f:(resolve_target common setup) in
List.map user_targets ~f:(function
| `String s -> resolve_target common ~setup s
| `Path p -> resolve_path p ~setup) in
if common.config.display = Verbose then begin
Log.info log "Actual targets:";
List.concat_map targets ~f:(function
Expand All @@ -734,6 +736,10 @@ let resolve_targets ~log common (setup : Main.setup) user_targets =
end;
targets

let resolve_targets ~log common (setup : Main.setup) user_targets =
List.map ~f:(fun s -> `String s) user_targets
|> resolve_targets_mixed ~log common setup

let resolve_targets_exn ~log common setup user_targets =
resolve_targets ~log common setup user_targets
|> List.concat_map ~f:(function
Expand Down Expand Up @@ -1236,8 +1242,8 @@ let exec =
[p]
| `This_abs _ ->
[])
|> List.map ~f:Path.to_string
|> resolve_targets ~log common setup
|> List.map ~f:(fun p -> `Path p)
|> resolve_targets_mixed ~log common setup
|> List.concat_map ~f:(function
| Ok targets -> targets
| Error _ -> [])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
$ DUNE_BUILD_DIR="$PWD/_custom" dune exec ./main.exe
File unavailable: /Users/rgrinberg/reps/dune/_build/default/test/blackbox-tests/test-cases/dune-build-dir-exec-1101/_custom/default/main.exe
[1]
foobar

0 comments on commit 6dc6ac3

Please sign in to comment.