Module Build_path_prefix_map
: sigend
Rewrite paths for reproducible builds
Warning: this module is unstable and part of Compiler_libs .
See the BUILD_PATH_PREFIX_MAP spec
typepath = stringtypepath_prefix = stringtypeerror_message = stringvalencode_prefix : path_prefix->stringvaldecode_prefix : string->(path_prefix,error_message)resulttypepair = {
target : path_prefix ;
source : path_prefix ;
}
valencode_pair : pair->stringvaldecode_pair : string->(pair,error_message)resulttypemap = pairoptionlistvalencode_map : map->stringvaldecode_map : string->(map,error_message)resultvalrewrite_first : map->path->pathoptionrewrite_firstmappath 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 .
valrewrite_all : map->path->pathlistrewrite_allmappath 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 [] .
valrewrite : map->path->pathrewritepath uses rewrite_first to try to find a mapping for path. If found, it returns that, otherwise
it just returns path .
OCamldoc 2025-06-12 Build_path_prefix_map(3o)