Put alias files in a dedicated directory

This commit is contained in:
Jeremie Dimino 2017-02-24 15:58:54 +00:00
parent dd77e045e6
commit e3722a922a
4 changed files with 12 additions and 3 deletions

View File

@ -2,8 +2,14 @@ open! Import
type t = Path.t
let aliases_path = Path.(relative root) "_build/.aliases"
let make name ~dir =
Path.relative dir (".jbuild-alias-" ^ name)
if not (Path.is_local dir) then
die "Aliases are only supported for local paths!\n\
Tried to reference alias %S in %s"
name (Path.to_string dir);
Path.append aliases_path (Path.relative dir name)
let dep = Build.path

View File

@ -1288,8 +1288,7 @@ module Gen(P : Params) = struct
|> Digest.string
|> Digest.to_hex in
let alias = Alias.make alias_conf.name ~dir in
let digest_path =
Path.relative dir (Path.basename (Alias.file alias) ^ "-" ^ digest) in
let digest_path = Path.extend_basename (Alias.file alias) ~suffix:("-" ^ digest) in
let dummy = Build.touch digest_path in
Alias.add_deps alias [digest_path];
let deps =

View File

@ -268,3 +268,5 @@ let readdir t = Sys.readdir (to_string t) |> Array.to_list
let is_directory t = Sys.is_directory (to_string t)
let rmdir t = Unix.rmdir (to_string t)
let unlink t = Sys.remove (to_string t)
let extend_basename t ~suffix = t ^ suffix

View File

@ -54,6 +54,8 @@ val append : t -> t -> t
val basename : t -> string
val parent : t -> t
val extend_basename : t -> suffix:string -> t
val extract_build_context : t -> (string * t) option
val extract_build_context_dir : t -> (t * t) option
val is_in_build_dir : t -> bool