Put alias files in a dedicated directory
This commit is contained in:
parent
dd77e045e6
commit
e3722a922a
|
@ -2,8 +2,14 @@ open! Import
|
||||||
|
|
||||||
type t = Path.t
|
type t = Path.t
|
||||||
|
|
||||||
|
let aliases_path = Path.(relative root) "_build/.aliases"
|
||||||
|
|
||||||
let make name ~dir =
|
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
|
let dep = Build.path
|
||||||
|
|
||||||
|
|
|
@ -1288,8 +1288,7 @@ module Gen(P : Params) = struct
|
||||||
|> Digest.string
|
|> Digest.string
|
||||||
|> Digest.to_hex in
|
|> Digest.to_hex in
|
||||||
let alias = Alias.make alias_conf.name ~dir in
|
let alias = Alias.make alias_conf.name ~dir in
|
||||||
let digest_path =
|
let digest_path = Path.extend_basename (Alias.file alias) ~suffix:("-" ^ digest) in
|
||||||
Path.relative dir (Path.basename (Alias.file alias) ^ "-" ^ digest) in
|
|
||||||
let dummy = Build.touch digest_path in
|
let dummy = Build.touch digest_path in
|
||||||
Alias.add_deps alias [digest_path];
|
Alias.add_deps alias [digest_path];
|
||||||
let deps =
|
let deps =
|
||||||
|
|
|
@ -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 is_directory t = Sys.is_directory (to_string t)
|
||||||
let rmdir t = Unix.rmdir (to_string t)
|
let rmdir t = Unix.rmdir (to_string t)
|
||||||
let unlink t = Sys.remove (to_string t)
|
let unlink t = Sys.remove (to_string t)
|
||||||
|
|
||||||
|
let extend_basename t ~suffix = t ^ suffix
|
||||||
|
|
|
@ -54,6 +54,8 @@ val append : t -> t -> t
|
||||||
val basename : t -> string
|
val basename : t -> string
|
||||||
val parent : t -> t
|
val parent : t -> t
|
||||||
|
|
||||||
|
val extend_basename : t -> suffix:string -> t
|
||||||
|
|
||||||
val extract_build_context : t -> (string * t) option
|
val extract_build_context : t -> (string * t) option
|
||||||
val extract_build_context_dir : t -> (t * t) option
|
val extract_build_context_dir : t -> (t * t) option
|
||||||
val is_in_build_dir : t -> bool
|
val is_in_build_dir : t -> bool
|
||||||
|
|
Loading…
Reference in New Issue