Do not attempt to convert string -> path -> string as this loses information

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-08-07 01:08:15 +03:00
parent 264263c819
commit 6dc6ac3668
2 changed files with 12 additions and 7 deletions

View File

@ -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 =
@ -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
@ -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
@ -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 _ -> [])

View File

@ -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