Module Ocaml_utils.Build_path_prefix_map
Rewrite paths for reproducible builds
Warning: this module is unstable and part of compiler-libs.
See the BUILD_PATH_PREFIX_MAP spec
val encode_prefix : Ocaml_utils.Build_path_prefix_map.path_prefix -> stringval decode_prefix :
string ->
(Ocaml_utils.Build_path_prefix_map.path_prefix,
Ocaml_utils.Build_path_prefix_map.error_message)
Stdlib.resulttype pair = {target : Ocaml_utils.Build_path_prefix_map.path_prefix;source : Ocaml_utils.Build_path_prefix_map.path_prefix;
}val encode_pair : Ocaml_utils.Build_path_prefix_map.pair -> stringval decode_pair :
string ->
(Ocaml_utils.Build_path_prefix_map.pair,
Ocaml_utils.Build_path_prefix_map.error_message)
Stdlib.resulttype map = Ocaml_utils.Build_path_prefix_map.pair option listval encode_map : Ocaml_utils.Build_path_prefix_map.map -> stringval decode_map :
string ->
(Ocaml_utils.Build_path_prefix_map.map,
Ocaml_utils.Build_path_prefix_map.error_message)
Stdlib.resultval rewrite_first :
Ocaml_utils.Build_path_prefix_map.map ->
Ocaml_utils.Build_path_prefix_map.path ->
Ocaml_utils.Build_path_prefix_map.path optionrewrite_first map path tries to find a source in map that is a prefix of the input path. If it succeeds, it replaces this prefix with the corresponding target. If it fails, it just returns None.
val rewrite_all :
Ocaml_utils.Build_path_prefix_map.map ->
Ocaml_utils.Build_path_prefix_map.path ->
Ocaml_utils.Build_path_prefix_map.path listrewrite_all map path finds all sources in map that are a prefix of the input path. For each matching source, in priority order, it replaces this prefix with the corresponding target and adds the result to the returned list. If there are no matches, it just returns [].
val rewrite :
Ocaml_utils.Build_path_prefix_map.map ->
Ocaml_utils.Build_path_prefix_map.path ->
Ocaml_utils.Build_path_prefix_map.pathrewrite path uses rewrite_first to try to find a mapping for path. If found, it returns that, otherwise it just returns path.