The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Misc.invert_build_path_prefix_map

+31
+11
utils/build_path_prefix_map.ml
··· 116 116 match rewrite_first prefix_map path with 117 117 | None -> path 118 118 | Some path -> path 119 + 120 + let make_source path : pair option -> path option = function 121 + | None -> None 122 + | Some { target; source } -> 123 + if String.starts_with ~prefix:target path then 124 + Some (source ^ (String.sub path (String.length target) 125 + (String.length path - String.length target))) 126 + else None 127 + 128 + let invert_all prefix_map path = 129 + List.filter_map (make_source path) (List.rev prefix_map)
+7
utils/build_path_prefix_map.mli
··· 59 59 (** [rewrite path] uses [rewrite_first] to try to find a 60 60 mapping for path. If found, it returns that, otherwise 61 61 it just returns [path]. *) 62 + 63 + val invert_all : map -> path -> path list 64 + (** [invert_all map path] finds all targets in [map] that are a prefix 65 + of the input [path]. For each matching target, in priority order, 66 + it replaces this prefix with the corresponding source and adds the 67 + result to the returned list. If there are no matches, it just 68 + returns [[]]. *)
+8
utils/misc.ml
··· 1138 1138 end; 1139 1139 !map_cache 1140 1140 1141 + let invert_build_path_prefix_map path = 1142 + match get_build_path_prefix_map () with 1143 + | None -> [path] 1144 + | Some prefix_map -> 1145 + match Build_path_prefix_map.invert_all prefix_map path with 1146 + | [] -> [path] 1147 + | matches -> matches 1148 + 1141 1149 let debug_prefix_map_flags () = 1142 1150 if not Config.as_has_debug_prefix_map then 1143 1151 []
+5
utils/misc.mli
··· 607 607 (** Returns the map encoded in the [BUILD_PATH_PREFIX_MAP] environment 608 608 variable. *) 609 609 610 + val invert_build_path_prefix_map: string -> string list 611 + (** Returns the potential paths (in priority order) from which the 612 + given path can originate from before rewrite using 613 + [BUILD_PATH_PREFIX_MAP] environment variable. *) 614 + 610 615 val debug_prefix_map_flags: unit -> string list 611 616 (** Returns the list of [--debug-prefix-map] flags to be passed to the 612 617 assembler, built from the [BUILD_PATH_PREFIX_MAP] environment variable. *)